h5analysis.MathData.Object3dHistogramTransform
- class h5analysis.MathData.Object3dHistogramTransform
Bases:
LoadHistogram3dApply transformations to a 3d image stack
Methods
add(config, file, x_stream, y_stream, ...[, ...])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, 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.
Helper function for exporter widget.
exporter()Interactive exporter widget.
get_data()Make data available in memory as exported to file.
load(config, file, x_stream, y_stream, ...)Load (x,y,z) stream data to histogram
movie(filename[, framerate, aspect, xlim, ...])Export Stack image as movie
plot([title, xlabel, ylabel, zlabel, ...])Plot all data assosciated with class instance/object.
subtract(config, file, x_stream, y_stream, ...)Subtracts 3d stacks of images with identical scales
- add(config, file, x_stream, y_stream, z_stream, *args, tempclass=None, **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, x_stream, y_stream, z_stream, *args, tempclass=None, **kwargs)
Subtracts the defined data from all loaded data
- Parameters:
See LoadHistogram3d function
- 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
- load(config, file, x_stream, y_stream, z_stream, *args, **kwargs)
Load (x,y,z) stream data to histogram
- Parameters:
config (dict) – h5 configuration
file (string) – file name
x_stream (string) – key name or alias of 1d stream
y_stream (string) – key name or alias of 1d stream
z_stream (string) – key name or alias of 2d stream
*args (ints) – scan numbers, 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)
- binsize_x: int
puts x-data in bins of specified size
- binsize_y: int
puts y-data in bins of specified size
- binsize_z: int
puts z-data in bins of specified size (along scale direction)
- 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(title=None, xlabel=None, ylabel=None, zlabel=None, plot_height=600, plot_width=600, vmin=None, vmax=None, colormap='linear', norm=False, xprec=None, yprec=None, **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
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
- subtract(config, file, x_stream, y_stream, z_stream, minuend, subtrahend, tempclass=None, **kwargs)
Subtracts 3d stacks of images with identical scales
- Parameters:
See LoadHistogram3d function, but
minuend (list) – adds all images in list, generates minuend
subtrahend (list) – adds all images in list, generates subtrahend