h5analysis.beamlines.REIXS.StackLoader

class h5analysis.beamlines.REIXS.StackLoader

Bases: Load3d

Object to hold a 3d stack of images

Methods

add(config, filename, scan_stream, detector, ...)

Adds 3d stacks of images with identical scales

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

Subtracts the defined data from all loaded data

background_3d(config, file, ind_stream, ...)

Subtracts the defined data from all loaded data

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.

load(config, filename, scan_stream, ...)

Shows a 3d stack of images interactively

movie(filename[, framerate, aspect, xlim, ...])

Export Stack image as movie

plot([plot_width, plot_height])

Plot all data assosciated with class instance/object.

subtract(config, filename, scan_stream, ...)

Subtracts 3d stacks of images with identical scales

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

Adds 3d stacks of images with identical scales

Parameters:
  • See Load3d function.

  • Adds all scans specified in *args.

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

background_3d(config, file, ind_stream, stack, *args, tempclass=None, **kwargs)

Subtracts the defined data from all loaded data

Parameters:
  • config (dict) – h5 configuration

  • file (string) – filename

  • ind_stream (string) – independent stream, corresponding to stack’s first dim

  • stack (string) – alias of an image STACK

  • args (int) – scan number

  • kwargs

    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

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

load(config, filename, scan_stream, detector, *args, **kwargs)

Shows a 3d stack of images interactively

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

  • filename (string) – filename

  • scan_stream (string) – independent scanned stream,corresponding to stack’s first dim

  • detector (string) – alias of an image STACK

  • args (int) – scan number

  • kwargs

    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

movie(filename, framerate=20, aspect=1, xlim=None, ylim=None, filetype='gif', **kwargs)

Export Stack image as movie

Parameters:
  • filename (string)

  • framerate (int) – number of frames per second

  • aspect (float) – aspect ratio

  • xlim (None, tuple)

  • ylim (None, tuple)

  • filetype (string) – Use: “gif” or “mp4”

  • kwargs – all matplotlib figure key-word arguments

plot(plot_width=900, plot_height=600, **kwargs)

Plot all data assosciated with class instance/object.

Parameters:
  • title (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) – Normalizes to the maximum z-value across all images in the stack

  • kwargs – all bokeh figure key-word arguments

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

Subtracts 3d stacks of images with identical scales

Parameters:
  • See Load3d function,but

  • minuend (list) – adds all images in list,generates minuend

  • subtrahend (list) – adds all images in list,generates subtrahend