h5analysis.MathData.Object1dStitch

class h5analysis.MathData.Object1dStitch

Bases: Load1d

Apply stitching on loader objects

Methods

add(config, file, x_stream, y_stream, *args)

Add specified scans for selected streams.

background(config, file, x_stream, y_stream, ...)

Subtracts the defined data from all loaded data

evaluate([average, adjust_scale, filename, ...])

Evaluate the request

export(filename[, split_files])

Export and write data to specified file.

exportWidgetStep()

Helper function for exporter widget.

exporter()

Interactive exporter widget.

get_data()

Make data available in memory as exported to file.

hline(pos, **kwargs)

Draw a horizontal line in the plot.

label(pos_x, pos_y, text, **kwargs)

Draw a text box in the plot.

load(config, file, x_stream, y_stream, ...)

Load one or multiple specific scan(s) for selected streams.

loadObj(obj, line)

Loads data previously specified in a loader

plot([linewidth, title, xlabel, ylabel, ...])

Plot all data assosciated with class instance/object.

plot_legend(pos)

Overwrite default legend position.

save_plot(fname, **kwargs)

Create a matplotlib plot window

show_fluorescence(element, siegbahn_symbol)

Draw a line in the plot for the requested fluorescence line.

stitch(obj, line, scan)

Loader objects to be added

subtract(config, file, x_stream, y_stream, ...)

Subtract specified scans for selected streams.

vline(pos, **kwargs)

Draw a vertical line in the plot.

xlim(lower, upper)

Set x-axis limits applied to data stream.

ylim(lower, upper)

Set y-axis limits applied to data stream.

add(config, file, x_stream, y_stream, *args, legend_item=None, twin_y=False, matplotlib_props={}, tempclass=None, **kwargs)

Add specified scans for selected streams.

Parameters:
  • See loader function.

  • Adds all scans specified in *args.

background(config, file, x_stream, y_stream, *args, tempclass=None, **kwargs)

Subtracts the defined data from all loaded data

Parameters:
  • config (dict) – h5 configuration

  • file (string) – file name

  • x_stream (string) – h5 key or alias of 1d stream

  • y_stream (string) – h5 key or alias of 1d, 2d, or 3d stream

  • *args (int) – scans

  • **kwargs

    norm: boolean

    normalizes to [0,1]

    xoffset: list

    fitting offset (x-stream)

    xcoffset: float

    constant offset (x-stream)

    yoffset: list

    fitting offset (y-stream)

    ycoffset: float

    constant offset (y-stream)

    grid_x: list

    grid data evenly with [start,stop,delta]

    savgol: tuple

    (window length, polynomial order, derivative)

    binsize: int

    puts data in bins of specified size

    legend_items: dict

    dict[scan number] = description for legend

evaluate(average=True, adjust_scale=False, filename=None, legend_item=None, twin_y=False, matplotlib_props={})

Evaluate the request

Parameters:

kwargs

average: Boolean

For overlap, whether the first scan takes precedence (False) or if overlap is averaged (True)

adjust_scale: Boolean

Adjusts the intensity of consecutive scans to match the precessors intensity in the overlap Automatically sets average True

filename: str

Name of the data file

legend_item: str

Text to appear in legend

twin_y: Boolean

Switch to display data on second y axis

matplotlib_props: dict

Dictionary for matplotlib properties

export(filename, split_files=False)

Export and write data to specified file.

Parameters:
  • filename (string)

  • split_files (Boolean) – Sets whether scans are exported appended to one file (False), or separately (True)

exportWidgetStep()

Helper function for exporter widget.

exporter()

Interactive exporter widget.

get_data()

Make data available in memory as exported to file.

Returns:

  • dfT (pandas DataFrame) – All loaded data.

  • files (list) – List of all loaded files.

hline(pos, **kwargs)

Draw a horizontal line in the plot.

Parameters:
  • pos (float)

  • **kwargs (dict, optional) – See bokeh manual for available options.

label(pos_x, pos_y, text, **kwargs)

Draw a text box in the plot.

Parameters:
  • pos_x (float)

  • pos_y (float)

  • text (string)

  • **kwargs (dict, optional) – See bokeh manual for available options.

load(config, file, x_stream, y_stream, *args, **kwargs)

Load one or multiple specific scan(s) for selected streams.

Parameters:
  • config (dict) – h5 configuration

  • file (string) – file name

  • x_stream (string) – h5 key or alias of 1d stream

  • y_stream (string) – h5 key or alias of 1d, 2d, or 3d stream

  • *args (ints) – scans, comma separated

  • **kwargs

    norm: boolean

    normalizes to [0,1]

    xoffset: list

    fitting offset (x-stream)

    xcoffset: float

    constant offset (x-stream)

    yoffset: list

    fitting offset (y-stream)

    ycoffset: float

    constant offset (y-stream)

    grid_x: list

    grid data evenly with [start,stop,delta]

    savgol: tuple

    (window length, polynomial order, derivative)

    binsize: int

    puts data in bins of specified size

    legend_items: dict

    dict[scan number] = description for legend

    twin_y: boolean

    supports a second y-axis on the right-hand side

    matplotlib_props: dict
    dict[scan number] = dict with props that takes keys:
    • linewidth

    • color

    • linestyle

    • marker

    • markersize

    • etc.

loadObj(obj, line)

Loads data previously specified in a loader

Parameters:
  • obj (object) – name of the Loader object

  • line (int) – Number of the load, add, subtract line (start indexing with 0)

plot(linewidth=4, title=None, xlabel=None, ylabel=None, ylabel_right=None, plot_height=450, plot_width=700, norm=False, waterfall=None, xprec=None, yprec=None, **kwargs)

Plot all data assosciated with class instance/object.

Parameters:
  • linewidth (int, optional)

  • title (string, optional)

  • xlabel (string, optional)

  • ylabel (string, optional)

  • ylabel_right (string, optional)

  • plot_height (int, optional)

  • plot_width (int, optional)

  • norm (boolean, optional) – Normalized plot output to [0,1]

  • waterfall (float) – Normalizes plot output to [0,1] and applies offset specified

  • xprec (int, optional) – Specifies the forced floating point X precision of the hover tool

  • yprec (int, optional) – Specifies the forced floating point Y precision of the hover tool

  • kwargs – all bokeh figure key-word arguments

plot_legend(pos)

Overwrite default legend position.

Parameters:

pos (string) – See bokeh manual for available options.

save_plot(fname, **kwargs)

Create a matplotlib plot window

fname: string

path and file name of the exported file

kwargs:
figsize: tuple

determines size of plot

x_minor_ticks: float

distance between minor ticks on primary axis

x_major_ticks: float

distance between major ticks on primary axis

y_minor_ticks: float

distance between minor ticks on secondary axis

y_major_ticks: float

distance between major ticks on secondary axis

top: Boolean

Display ticks on top of the plot

right: Boolean

Display ticks on the right of the plot

fontsize_axes: string or int

Set the fontsize of the axes ticks

fontsize_labels: string or int

Set fontsize of the axis labels

fontsize_title: string or int

Set fontsize of the title

title_pad: int

Padding between title and the top of the plot

xlabel: string

Label of the primary axis

ylabel: string

Label of the secondary axis

title: string

Title displayed at the top of the plot

xlim: tuple

Limits the visible x-range

ylim: tuple

Limits the visible y-range

legend: Boolean

Show/Hide plot legend

fontsize_legend: int

Fontsize of the legend entries

data_format: string, [pdf,svg,png]

Sets the output data format and matplotlib backend used

show_fluorescence(element, siegbahn_symbol, orientation='v', **kwargs)

Draw a line in the plot for the requested fluorescence line.

Parameters:
  • element (string) – IUPAC element abbreviation

  • siegbahn_symbol (string) – Siegbahn symbol for requested energy transition

  • orientation ([‘v’,’h’]) – Determines if a vertical or horizontal line is drawn

  • **kwargs (dict, optional) – See bokeh manual for available options.

stitch(obj, line, scan)

Loader objects to be added

Parameters:
  • obj (object) – Loader object

  • line (int) – load, add, subtract line of object (indexing with 0)

  • scan (int) – number of the scan to be accessed

subtract(config, file, x_stream, y_stream, minuend, subtrahend, legend_item=None, twin_y=False, tempclass=None, matplotlib_props={}, **kwargs)

Subtract specified scans for selected streams.

Parameters:
  • See loader function.

  • Subtracts two scans. May add scans by specifying list of scans as first/second arg.

vline(pos, **kwargs)

Draw a vertical line in the plot.

Parameters:
  • pos (float)

  • **kwargs (dict, optional) – See bokeh manual for available options.

xlim(lower, upper)

Set x-axis limits applied to data stream.

Parameters:
  • lower (float)

  • upper (float)

ylim(lower, upper)

Set y-axis limits applied to data stream.

Parameters:
  • lower (float)

  • upper (float)