h5analysis.beamlines.REIXS.ELOSSMapper

class h5analysis.beamlines.REIXS.ELOSSMapper

Bases: Object2dTransform

Load and plot x-ray emission map on energy loss scale

Methods

add(config, filename, detector, *args, **kwargs)

Add specified images for selected streams.

background_1d(config, file, x_stream, ...[, ...])

Subtracts the defined data from all loaded data

background_2d(config, file, x_stream, ...[, ...])

Subtracts the defined data from all loaded data

baseline(algorithm[, smooth, subtract])

Add baseline from the pybaselines module

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, filename, detector, *args, **kwargs)

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

plot([xlabel, ylabel, plot_width, plot_height])

Plot all data assosciated with class instance/object.

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(config, filename, detector, *args, ...)

Stitch specified scans for selected image.

subtract(config, filename, detector, *args, ...)

Subtract specified images for selected streams.

transform(trans_y[, xlim, ylim])

Apply math operations on a per data point basis.

transpose()

Transpose loaded image and swap axes

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, filename, detector, *args, **kwargs)

Add specified images for selected streams.

Parameters:
  • See loader function.

  • Adds all scans specified in *args.

background_1d(config, file, x_stream, y_stream, *args, axis='y', **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 stream

  • *args (int) – scans

  • **kwargs

    axis: string

    <<x>> or <<y>> axis for subtraction direction

    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

background_2d(config, file, x_stream, detector, *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

  • detector (string) – alias of the MCA detector

  • *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

    binsize_x: int

    puts data in bins of specified size in the horizontal direction

    binsize: int

    puts data in bins of specified size in the vertical direction

baseline(algorithm, smooth=None, subtract=True, **kwargs)

Add baseline from the pybaselines module

Parameters:
  • algorithm (str) – name of the algorithm

  • smooth (tuple) – Sets Savitsky-Golay filter properties: (window length, polynomial order)

  • subtract (Boolean) – Whether the baseline is subtracted from the data or replaces the existing data stream

  • kwargs (dict) – Key-word arguments for tuning of baseline algorithm

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:

  • f (string.IO object) – Motor and Detector Scales. Pandas Data Series. 1) Rewind memory with f.seek(0) 2) Load with pandas.read_csv(f,skiprows=3)

  • g (string.IO object) – Actual gridded detector image. 1) Rewind memory with g.seek(0) 2) Load with numpy.genfromtxt(g,skip_header=4)

  • raw_data (list) – List of lists with series data, series header, and matrix_data

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, filename, detector, *args, **kwargs)

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

Parameters:
  • config (dict) – REIXS beamline endstation configuration

  • filename (string) – filename

  • detector (string) – alias of the MCA detector

  • arg (int) – scan number

  • **kwargs

    norm: boolean

    Can be boolean or None (as False)

    xoffset: list of tuples

    fitted offset (x-stream)

    xcoffset: float

    constant offset (x-stream)

    yoffset: list of tuples

    fitted offset (y-stream)

    ycoffset: float

    constant offset (y-stream)

    grid_x: list

    grid equally spaced in x with [start,stop,delta]

    grid_y: list

    grid equally spaced in y with [start,stop,delta]

    norm_by: string

    norm MCA by defined h5 key or SCA alias

    binsize_x: int

    puts data in bins of specified size in the horizontal direction

    binsize: int

    puts data in bins of specified size in the vertical direction

plot(xlabel='Energy Loss [eV]', ylabel='Excitation Energy [eV]', plot_width=900, plot_height=600, **kwargs)

Plot all data assosciated with class instance/object.

Parameters:
  • title (string,optional)

  • kind (string,optional)

  • xlabel (string,optional)

  • ylabel (string,optional)

  • zlabel (string,optional)

  • plot_height (int,optional)

  • plot_width (int,optional)

  • vmin (float,optional)

  • vmax (float,optional)

  • colormap (string) – Use: “linear” or “log”

  • norm (boolean) – to normalize the plot to the maximum

  • kwargs – all bokeh figure key-word arguments

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

cmap: string

name of matplotlib colourmap

levels: int

determines how many levels the z data should be binned in

aspect: [equal, auto]

Set the axis to scale or stretch figszize

colorbar: Boolean

Display a colorbar

zlabel: string

Label of the colorbar

fontsize_colorbar: string or int

Fontsize of the colorbar ticks

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(config, filename, detector, *args, **kwargs)

Stitch specified scans for selected image.

Parameters:
  • See loader function.

  • Stitches all scans specified in *args.

subtract(config, filename, detector, *args, **kwargs)

Subtract specified images for selected streams.

Parameters:
  • See loader function.

  • Subtracts all imnages from the first element.

transform(trans_y, xlim=(None, None), ylim=(None, None))

Apply math operations on a per data point basis. Change second axis (y) for all data along first (x) axis

Parameters:
  • trans_y (string) – math expression to be evaluated at every x data point available variables include ‘x’, ‘y’, ‘z’.

  • xlim (tuple) – specify lower and upper bound of x-limits, cropped before transformation

  • ylim (tuple) – specify lower and upper bound of y-limits included in matrix after transformation

transpose()

Transpose loaded image and swap axes

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)