5. Calibrator
5.1. Momentum calibration and correction
sed.calibrator.momentum module. Code for momentum calibration and distortion correction. Mostly ported from https://github.com/mpes-kit/mpes.
- class sed.calibrator.momentum.MomentumCorrector(data=None, bin_ranges=None, rotsym=6, config=None)
Bases:
objectMomentum distortion correction and momentum calibration workflow functions.
- Parameters:
data (Union[xr.DataArray, np.ndarray], optional) – Multidimensional hypervolume containing the data. Defaults to None.
bin_ranges (List[Tuple], optional) – Binning ranges of the data volume, if provided as np.ndarray. Defaults to None.
rotsym (int, optional) – Rotational symmetry of the data. Defaults to 6.
config (dict, optional) – Config dictionary. Defaults to None.
- property features: dict
Dictionary of detected features for the symmetrization process.
self.featuresis a derived attribute from existing ones.- Returns:
Dict containing features “verts” and “center”.
- Return type:
dict
- property symscores: dict
Dictionary of symmetry-related scores.
- Returns:
Dictionary containing symmetry scores.
- Return type:
dict
- load_data(data, bin_ranges=None)
Load binned data into the momentum calibrator class
- Parameters:
data (Union[xr.DataArray, np.ndarray]) – 2D or 3D data array, either as np.ndarray or xr.DataArray.
bin_ranges (List[Tuple], optional) – Binning ranges. Needs to be provided in case the data are given as np.ndarray. Otherwise, they are determined from the coords of the xr.DataArray. Defaults to None.
- Raises:
ValueError – Raised if the dimensions of the input data do not fit.
- select_slicer(plane=0, width=5, axis=2, apply=False)
Interactive panel to select (hyper)slice from a (hyper)volume.
- Parameters:
plane (int, optional) – initial value of the plane slider. Defaults to 0.
width (int, optional) – initial value of the width slider. Defaults to 5.
axis (int, optional) – Axis along which to slice the image. Defaults to 2.
apply (bool, optional) – Option to directly apply the values and select the slice. Defaults to False.
- select_slice(selector, axis=2)
Select (hyper)slice from a (hyper)volume.
- Parameters:
selector (Union[slice, List[int], int]) – Selector along the specified axis to extract the slice (image). Use the construct slice(start, stop, step) to select a range of images and sum them. Use an integer to specify only a particular slice.
axis (int, optional) – Axis along which to select the image. Defaults to 2.
- Raises:
ValueError – Raised if self.image is already 2D.
- add_features(features=None, direction='ccw', rotsym=6, symscores=True, **kwds)
Add features as reference points provided as np.ndarray. If provided, detects the center of the points and orders the points.
- Parameters:
features (np.ndarray, optional) – Array of landmarks, possibly including a center peak. Its shape should be (n,2), where n is equal to the rotation symmetry, or the rotation symmetry+1, if the center is included. Defaults to config[“momentum”][“correction”][“feature_points”].
direction (str, optional) – Direction for ordering the points. Defaults to “ccw”.
symscores (bool, optional) – Option to calculate symmetry scores. Defaults to False.
rotsym (int, optional) – Rotational symmetry of the data. Defaults to 6.
**kwds –
Keyword arguments.
symtype (str): Type of symmetry scores to calculte if symscores is True.
- Raises:
ValueError – Raised if the number of points does not match the rotsym.
- feature_extract(image=None, direction='ccw', feature_type='points', rotsym=6, symscores=True, **kwds)
Extract features from the selected 2D slice. Currently only point feature detection is implemented.
- Parameters:
image (np.ndarray, optional) – The (2D) image slice to extract features from. Defaults to self.slice
direction (str, optional) – The circular direction to reorder the features in (‘cw’ or ‘ccw’). Defaults to “ccw”.
feature_type (str, optional) – The type of features to extract. Defaults to “points”.
rotsym (int, optional) – Rotational symmetry of the data. Defaults to 6.
symscores (bool, optional) – Option for calculating symmetry scores. Defaults to True.
**kwds – Extra keyword arguments for
symmetrize.pointops.peakdetect2d().
- Raises:
NotImplementedError – Raised for undefined feature_types.
- feature_select(image=None, features=None, include_center=True, rotsym=6, apply=False, **kwds)
Extract features from the selected 2D slice. Currently only point feature detection is implemented.
- Parameters:
image (np.ndarray, optional) – The (2D) image slice to extract features from. Defaults to self.slice
include_center (bool, optional) – Option to include the image center/centroid in the registration process. Defaults to True.
features (np.ndarray, optional) – Array of landmarks, possibly including a center peak. Its shape should be (n,2), where n is equal to the rotation symmetry, or the rotation symmetry+1, if the center is included. If omitted, an array filled with zeros is generated.
rotsym (int, optional) – Rotational symmetry of the data. Defaults to 6.
apply (bool, optional) – Option to directly store the features in the class. Defaults to False.
**kwds – Extra keyword arguments for
symmetrize.pointops.peakdetect2d().
- Raises:
ValueError – If no valid image is found from which to ge the coordinates.
- calc_geometric_distances()
Calculate geometric distances involving the center and the vertices. Distances calculated include center-vertex and nearest-neighbor vertex-vertex distances.
- calc_symmetry_scores(symtype='rotation')
Calculate the symmetry scores from geometric quantities.
- Parameters:
symtype (str, optional) – Type of symmetry score to calculate. Defaults to “rotation”.
- Returns:
Calculated symmetry score.
- Return type:
float
- spline_warp_estimate(image=None, use_center=None, fixed_center=True, interp_order=1, verbose=True, **kwds)
Estimate the spline deformation field using thin plate spline registration.
- Parameters:
image (np.ndarray, optional) – 2D array. Image slice to be corrected. Defaults to self.slice.
use_center (bool, optional) – Option to use the image center/centroid in the registration process. Defaults to config value, or True.
fixed_center (bool, optional) – Option to have a fixed center during registration-based symmetrization. Defaults to True.
interp_order (int, optional) – Order of interpolation (see
scipy.ndimage.map_coordinates()). Defaults to 1.verbose (bool, optional) – Option to report the used landmarks for correction. Defaults to True.
**kwds –
keyword arguments:
landmarks: (list/array): Landmark positions (row, column) used for registration. Defaults to self.pouter_ord
targets: (list/array): Target positions (row, column) used for registration. If empty, it will be generated by
symmetrize.rotVertexGenerator().new_centers: (dict): User-specified center positions for the reference and target sets. {‘lmkcenter’: (row, col), ‘targcenter’: (row, col)}
- Returns:
The corrected image.
- Return type:
np.ndarray
- apply_correction(image, axis, dfield=None)
Apply a 2D transform to a stack of 2D images (3D) along a specific axis.
- Parameters:
image (np.ndarray) – Image which to apply the transformation to
axis (int) – Axis for slice selection.
dfield (np.ndarray, optional) – row and column deformation field. Defaults to [self.rdeform_field, self.cdeformfield].
- Returns:
The corrected image.
- Return type:
np.ndarray
- reset_deformation(**kwds)
Reset the deformation field.
- Parameters:
**kwds –
keyword arguments:
image: the image to base the deformation fields on. Its sizes are used. Defaults to self.slice
coordtype: The coordinate system to use. Defaults to ‘cartesian’.
- update_deformation(rdeform, cdeform)
Update the class deformation field by applying the provided column/row deformation fields.
- Parameters:
rdeform (np.ndarray) – 2D array of row-ordered deformation field.
cdeform (np.ndarray) – 2D array of column-ordered deformation field.
- coordinate_transform(transform_type, keep=False, interp_order=1, mapkwds=None, **kwds)
Apply a pixel-wise coordinate transform to the image by means of the deformation field.
- Parameters:
transform_type (str) –
Type of deformation to apply to image slice. Possible values are:
translation.
rotation.
rotation_auto.
scaling.
scaling_auto.
homomorphy.
keep (bool, optional) – Option to keep the specified coordinate transform in the class. Defaults to False.
interp_order (int, optional) – Interpolation order for filling in missed pixels. Defaults to 1.
mapkwds (dict, optional) – Additional arguments passed to
scipy.ndimage.map_coordinates(). Defaults to None.**kwds – keyword arguments. Additional arguments in specific deformation field. See
symmetrize.symmodule.
- Returns:
The corrected image.
- Return type:
np.ndarray
- pose_adjustment(scale=1, xtrans=0, ytrans=0, angle=0, apply=False, reset=True, verbose=True)
Interactive panel to adjust transformations that are applied to the image. Applies first a scaling, next a x/y translation, and last a rotation around the center of the image (pixel 256/256).
- Parameters:
scale (float, optional) – Initial value of the scaling slider. Defaults to 1.
xtrans (float, optional) – Initial value of the xtrans slider. Defaults to 0.
ytrans (float, optional) – Initial value of the ytrans slider. Defaults to 0.
angle (float, optional) – Initial value of the angle slider. Defaults to 0.
apply (bool, optional) – Option to directly apply the provided transformations. Defaults to False.
reset (bool, optional) – Option to reset the correction before transformation. Defaults to True.
verbose (bool, optional) – Option to report the performed transformations. Defaults to True.
- calc_inverse_dfield()
Calculate the inverse dfield from the cdeform and rdeform fields
- view(image=None, origin='lower', cmap='terrain_r', figsize=(4, 4), points=None, annotated=False, backend='matplotlib', imkwds={}, scatterkwds={}, cross=False, crosshair=False, crosshair_radii=[50, 100, 150], crosshair_thickness=1, **kwds)
Display image slice with specified annotations.
- Parameters:
image (np.ndarray, optional) – The image to plot. Defaults to self.slice.
origin (str, optional) – Figure origin specification (‘lower’ or ‘upper’). Defaults to “lower”.
cmap (str, optional) – Colormap specification. Defaults to “terrain_r”.
figsize (Tuple[int, int], optional) – Figure size. Defaults to (4, 4).
points (dict, optional) – Points for annotation. Defaults to None.
annotated (bool, optional) – Option to add annotation. Defaults to False.
backend (str, optional) –
Visualization backend specification. Defaults to “matplotlib”.
’matplotlib’: use static display rendered by matplotlib.
’bokeh’: use interactive display rendered by bokeh.
imkwds (dict, optional) – Keyword arguments for
matplotlib.pyplot.imshow(). Defaults to {}.scatterkwds (dict, optional) – Keyword arguments for
matplotlib.pyplot.scatter(). Defaults to {}.cross (bool, optional) – Option to display a horizontal/vertical lines at self.pcent. Defaults to False.
crosshair (bool, optional) – Display option to plot circles around center self.pcent. Works only in bokeh backend. Defaults to False.
crosshair_radii (List[int], optional) – Pixel radii of circles to plot when crosshair option is activated. Defaults to [50, 100, 150].
crosshair_thickness (int, optional) – Thickness of crosshair circles. Defaults to 1.
**kwds – keyword arguments. General extra arguments for the plotting procedure.
- select_k_range(point_a=None, point_b=None, k_distance=None, k_coord_a=None, k_coord_b=array([0., 0.]), equiscale=True, apply=False)
Interactive selection function for features for the Momentum axes calibra- tion. It allows the user to select the pixel positions of two symmetry points (a and b) and the k-space distance of the two. Alternatively, the corrdinates of both points can be provided. See the equiscale option for details on the specifications of point coordinates.
- Parameters:
point_a (Union[np.ndarray, List[int]], optional) – Pixel coordinates of the symmetry point a.
point_b (Union[np.ndarray, List[int]], optional) – Pixel coordinates of the symmetry point b. Defaults to the center pixel of the image, defined by config[“momentum”][“center_pixel”].
k_distance (float, optional) – The known momentum space distance between the two symmetry points.
k_coord_a (Union[np.ndarray, List[float]], optional) – Momentum coordinate of the symmetry points a. Only valid if equiscale=False.
k_coord_b (Union[np.ndarray, List[float]], optional) – Momentum coordinate of the symmetry points b. Only valid if equiscale=False. Defaults to the k-space center np.array([0.0, 0.0]).
equiscale (bool, optional) –
Option to adopt equal scale along both the x and y directions.
True: Use a uniform scale for both x and y directions in the image coordinate system. This applies to the situation where k_distance is given and the points a and b are (close to) parallel with one of the two image axes.
False: Calculate the momentum scale for both x and y directions separately. This applies to the situation where the points a and b are sufficiently different in both x and y directions in the image coordinate system.
Defaults to ‘True’.
apply (bool, optional) – Option to directly store the calibration parameters to the class. Defaults to False.
- Raises:
ValueError – If no valid image is found from which to ge the coordinates.
- calibrate(point_a, point_b, k_distance=None, k_coord_a=None, k_coord_b=array([0., 0.]), equiscale=True, image=None)
Momentum axes calibration using the pixel positions of two symmetry points (a and b) and the absolute coordinate of a single point (b), defaulted to [0., 0.]. All coordinates should be specified in the (x/y), i.e. (column_index, row_index) format. See the equiscale option for details on the specifications of point coordinates.
- Parameters:
point_a (Union[np.ndarray, List[int]], optional) – Pixel coordinates of the symmetry point a.
point_b (Union[np.ndarray, List[int]], optional) – Pixel coordinates of the symmetry point b. Defaults to the center pixel of the image, defined by config[“momentum”][“center_pixel”].
k_distance (float, optional) – The known momentum space distance between the two symmetry points.
k_coord_a (Union[np.ndarray, List[float]], optional) – Momentum coordinate of the symmetry points a. Only valid if equiscale=False.
k_coord_b (Union[np.ndarray, List[float]], optional) – Momentum coordinate of the symmetry points b. Only valid if equiscale=False. Defaults to the k-space center np.array([0.0, 0.0]).
equiscale (bool, optional) –
Option to adopt equal scale along both the x and y directions.
True: Use a uniform scale for both x and y directions in the image coordinate system. This applies to the situation where k_distance is given and the points a and b are (close to) parallel with one of the two image axes.
False: Calculate the momentum scale for both x and y directions separately. This applies to the situation where the points a and b are sufficiently different in both x and y directions in the image coordinate system.
Defaults to ‘True’.
image (np.ndarray, optional) – The energy slice for which to return the calibration. Defaults to self.slice_corrected.
- Returns:
dictionary with following entries:
”axes”: Tuple of 1D arrays Momentum coordinates of the row and column.
”extent”: list Extent of the two momentum axis (can be used directly in imshow).
”grid”: Tuple of 2D arrays Row and column mesh grid generated from the coordinates (can be used directly in pcolormesh).
”coeffs”: Tuple of (x, y) calibration coefficients
”x_center”, “y_center”: Pixel positions of the k-space center
”cstart”, “rstart”: Detector positions of the image used for calibration
”cstep”, “rstep”: Step size of detector coordinates in the image used for calibration
- Return type:
dict
- apply_corrections(df, x_column=None, y_column=None, new_x_column=None, new_y_column=None, **kwds)
Calculate and replace the X and Y values with their distortion-corrected version.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to apply the distotion correction to.
x_column (str, optional) – Label of the ‘X’ column before momentum distortion correction. Defaults to config[“momentum”][“x_column”].
y_column (str, optional) – Label of the ‘Y’ column before momentum distortion correction. Defaults to config[“momentum”][“y_column”].
new_x_column (str, optional) – Label of the ‘X’ column after momentum distortion correction. Defaults to config[“momentum”][“corrected_x_column”].
new_y_column (str, optional) – Label of the ‘Y’ column after momentum distortion correction. Defaults to config[“momentum”][“corrected_y_column”].
**kwds –
Keyword arguments:
dfield: Inverse dfield
cdeform_field, rdeform_field: Column- and row-wise forward deformation fields.
Additional keyword arguments are passed to
apply_dfield.
- Returns:
Dataframe with added columns and momentum correction metadata dictionary.
- Return type:
Tuple[Union[pd.DataFrame, dask.dataframe.DataFrame], dict]
- gather_correction_metadata()
Collect meta data for momentum correction.
- Returns:
generated correction metadata dictionary.
- Return type:
dict
- append_k_axis(df, x_column=None, y_column=None, new_x_column=None, new_y_column=None, calibration=None, **kwds)
Calculate and append the k axis coordinates (kx, ky) to the events dataframe.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to apply the distotion correction to.
x_column (str, optional) – Label of the source ‘X’ column. Defaults to config[“momentum”][“corrected_x_column”] or config[“momentum”][“x_column”] (whichever is present).
y_column (str, optional) – Label of the source ‘Y’ column. Defaults to config[“momentum”][“corrected_y_column”] or config[“momentum”][“y_column”] (whichever is present).
new_x_column (str, optional) – Label of the destination ‘X’ column after momentum calibration. Defaults to config[“momentum”][“kx_column”].
new_y_column (str, optional) – Label of the destination ‘Y’ column after momentum calibration. Defaults to config[“momentum”][“ky_column”].
calibration (dict, optional) – Dictionary containing calibration parameters. Defaults to ‘self.calibration’ or config[“momentum”][“calibration”].
**kwds – Keyword parameters for momentum calibration. Parameters are added to the calibration dictionary.
- Returns:
Dataframe with added columns and momentum calibration metadata dictionary.
- Return type:
Tuple[Union[pd.DataFrame, dask.dataframe.DataFrame], dict]
- gather_calibration_metadata(calibration=None)
Collect meta data for momentum calibration
- Parameters:
calibration (dict, optional) – Dictionary with momentum calibration parameters. If omitted will be taken from the class.
- Returns:
Generated metadata dictionary.
- Return type:
dict
- sed.calibrator.momentum.cm2palette(cmap_name)
Convert certain matplotlib colormap (cm) to bokeh palette.
- Parameters:
cmap_name (str) – Name of the colormap/palette.
- Returns:
List of colors in hex representation (a bokoeh palette).
- Return type:
list
- sed.calibrator.momentum.dictmerge(main_dict, other_entries)
Merge a dictionary with other dictionaries.
- Parameters:
main_dict (dict) – Main dictionary.
other_entries (Union[List[dict], Tuple[dict], dict]) – Other dictionary or composite dictionarized elements.
- Returns:
Merged dictionary.
- Return type:
dict
- sed.calibrator.momentum.detector_coordiantes_2_k_koordinates(r_det, c_det, r_start, c_start, r_center, c_center, r_conversion, c_conversion, r_step, c_step)
Conversion from detector coordinates (rdet, cdet) to momentum coordinates (kr, kc).
- Parameters:
r_det (float) – Row detector coordinates.
c_det (float) – Column detector coordinates.
r_start (float) – Start value for row detector coordinates.
c_start (float) – Start value for column detector coordinates.
r_center (float) – Center value for row detector coordinates.
c_center (float) – Center value for column detector coordinates.
r_conversion (float) – Row conversion factor.
c_conversion (float) – Column conversion factor.
r_step (float) – Row stepping factor.
c_step (float) – Column stepping factor.
- Returns:
Converted momentum space row/column coordinates.
- Return type:
Tuple[float, float]
- sed.calibrator.momentum.apply_dfield(df, dfield, x_column, y_column, new_x_column, new_y_column, detector_ranges)
Application of the inverse displacement-field to the dataframe coordinates.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to apply the distotion correction to.
dfield (np.ndarray) – The distortion correction field. 3D matrix, with column and row distortion fields stacked along the first dimension.
x_column (str) – Label of the ‘X’ source column.
y_column (str) – Label of the ‘Y’ source column.
new_x_column (str) – Label of the ‘X’ destination column.
new_y_column (str) – Label of the ‘Y’ destination column.
detector_ranges (List[Tuple]) – tuple of pixel ranges of the detector x/y coordinates
- Returns:
dataframe with added columns
- Return type:
Union[pd.DataFrame, dask.dataframe.DataFrame]
- sed.calibrator.momentum.generate_inverse_dfield(rdeform_field, cdeform_field, bin_ranges, detector_ranges)
Generate inverse deformation field using inperpolation with griddata. Assuming the binning range of the input
rdeform_fieldandcdeform_fieldcovers the whole detector.- Parameters:
rdeform_field (np.ndarray) – Row-wise deformation field.
cdeform_field (np.ndarray) – Column-wise deformation field.
bin_ranges (List[Tuple]) – Detector ranges of the binned coordinates.
detector_ranges (List[Tuple]) – Ranges of detector coordinates to interpolate to.
- Returns:
The calculated inverse deformation field (row/column)
- Return type:
np.ndarray
- sed.calibrator.momentum.load_dfield(file)
Load inverse dfield from file
- Parameters:
file (str) – Path to file containing the inverse dfield
- Returns:
the loaded inverse deformation field
- Return type:
np.ndarray
5.2. Energy calibration and correction
sed.calibrator.energy module. Code for energy calibration and correction. Mostly ported from https://github.com/mpes-kit/mpes.
- class sed.calibrator.energy.EnergyCalibrator(loader, biases=None, traces=None, tof=None, config=None)
Bases:
objectElectron binding energy calibration workflow.
For the initialization of the EnergyCalibrator class an instance of a loader is required. The data can be loaded using the optional arguments, or using the load_data method or bin_data method.
- Parameters:
loader (BaseLoader) – Instance of a loader, subclassed from BaseLoader.
biases (np.ndarray, optional) – Bias voltages used. Defaults to None.
traces (np.ndarray, optional) – TOF-Data traces corresponding to the bias values. Defaults to None.
tof (np.ndarray, optional) – TOF-values for the data traces. Defaults to None.
config (dict, optional) – Config dictionary. Defaults to None.
- property ntraces: int
Property returning the number of traces.
- Returns:
The number of loaded/calculated traces.
- Return type:
int
- property nranges: int
Property returning the number of specified feature ranges which Can be a multiple of ntraces.
- Returns:
The number of specified feature ranges.
- Return type:
int
- property dup: int
Property returning the duplication number, i.e. the number of feature ranges per trace.
- Returns:
The duplication number.
- Return type:
int
- load_data(biases=None, traces=None, tof=None)
Load data into the class. Not provided parameters will be overwritten by empty arrays.
- Parameters:
biases (np.ndarray, optional) – Bias voltages used. Defaults to None.
traces (np.ndarray, optional) – TOF-Data traces corresponding to the bias values. Defaults to None.
tof (np.ndarray, optional) – TOF-values for the data traces. Defaults to None.
- bin_data(data_files, axes=None, bins=None, ranges=None, biases=None, bias_key=None, **kwds)
Bin data from single-event files, and load into class.
- Parameters:
data_files (List[str]) – list of file names to bin
axes (List[str], optional) – bin axes. Defaults to config[“dataframe”][“tof_column”].
bins (List[int], optional) – number of bins. Defaults to config[“energy”][“bins”].
ranges (Sequence[Tuple[float, float]], optional) – bin ranges. Defaults to config[“energy”][“ranges”].
biases (np.ndarray, optional) – Bias voltages used. If not provided, biases are extracted from the file meta data.
bias_key (str, optional) – hdf5 path where bias values are stored. Defaults to config[“energy”][“bias_key”].
**kwds – Keyword parameters for bin_dataframe
- normalize(smooth=False, span=7, order=1)
Normalize the spectra along an axis.
- Parameters:
smooth (bool, optional) – Option to smooth the signals before normalization. Defaults to False.
span (int, optional) – span smoothing parameters of the LOESS method (see
scipy.signal.savgol_filter()). Defaults to 7.order (int, optional) – order smoothing parameters of the LOESS method (see
scipy.signal.savgol_filter()). Defaults to 1.
- adjust_ranges(ranges, ref_id=0, traces=None, peak_window=7, apply=False, **kwds)
Display a tool to select or extract the equivalent feature ranges (containing the peaks) among all traces.
- Parameters:
ranges (Tuple) – Collection of feature detection ranges, within which an algorithm (i.e. 1D peak detector) with look for the feature.
ref_id (int, optional) – Index of the reference trace. Defaults to 0.
traces (np.ndarray, optional) – Collection of energy dispersion curves. Defaults to self.traces_normed.
peak_window (int, optional) – area around a peak to check for other peaks. Defaults to 7.
apply (bool, optional) – Option to directly apply the provided parameters. Defaults to False.
**kwds – keyword arguments for trace alignment (see
find_correspondence()).
- add_ranges(ranges, ref_id=0, traces=None, infer_others=True, mode='replace', **kwds)
Select or extract the equivalent feature ranges (containing the peaks) among all traces.
- Parameters:
ranges (Union[List[Tuple], Tuple]) – Collection of feature detection ranges, within which an algorithm (i.e. 1D peak detector) with look for the feature.
ref_id (int, optional) – Index of the reference trace. Defaults to 0.
traces (np.ndarray, optional) – Collection of energy dispersion curves. Defaults to self.traces_normed.
infer_others (bool, optional) – Option to infer the feature detection range in other traces from a given one using a time warp algorthm. Defaults to True.
mode (str, optional) – Specification on how to change the feature ranges (‘append’ or ‘replace’). Defaults to “replace”.
**kwds – keyword arguments for trace alignment (see
find_correspondence()).
- feature_extract(ranges=None, traces=None, peak_window=7)
Select or extract the equivalent landmarks (e.g. peaks) among all traces.
- Parameters:
ranges (List[Tuple], optional) – List of ranges in each trace to look for the peak feature, [start, end]. Defaults to self.featranges.
traces (np.ndarray, optional) – Collection of 1D spectra to use for calibration. Defaults to self.traces_normed.
peak_window (int, optional) – area around a peak to check for other peaks. Defaults to 7.
- calibrate(ref_id=0, method='lmfit', energy_scale='kinetic', landmarks=None, biases=None, t=None, **kwds)
Calculate the functional mapping between time-of-flight and the energy scale using optimization methods.
- Parameters:
ref_id (int, optional) – The reference trace index (an integer). Defaults to 0.
method (str, optional) –
Method for determining the energy calibration.
’lmfit’: Energy calibration using lmfit and 1/t^2 form.
’lstsq’, ‘lsqr’: Energy calibration using polynomial form.
Defaults to ‘lmfit’.
energy_scale (str, optional) –
Direction of increasing energy scale.
’kinetic’: increasing energy with decreasing TOF.
’binding’: increasing energy with increasing TOF.
Defaults to “kinetic”.
landmarks (np.ndarray, optional) – Extracted peak positions (TOF) used for calibration. Defaults to self.peaks.
biases (np.ndarray, optional) – Bias values. Defaults to self.biases.
t (np.ndarray, optional) – TOF values. Defaults to self.tof.
**kwds – keyword arguments. See available keywords for
poly_energy_calibration()andfit_energy_calibration()
- Raises:
ValueError – Raised if invalid ‘energy_scale’ is passed.
NotImplementedError – Raised if invalid ‘method’ is passed.
- Returns:
Calibration dictionary with coefficients.
- Return type:
dict
- view(traces, segs=None, peaks=None, show_legend=True, backend='matplotlib', linekwds={}, linesegkwds={}, scatterkwds={}, legkwds={}, **kwds)
Display a plot showing line traces with annotation.
- Parameters:
traces (np.ndarray) – Matrix of traces to visualize.
segs (List[Tuple], optional) – Segments to be highlighted in the visualization. Defaults to None.
peaks (np.ndarray, optional) – Peak positions for labelling the traces. Defaults to None.
show_legend (bool, optional) – Option to display bias voltages as legends. Defaults to True.
backend (str, optional) – Backend specification, choose between ‘matplotlib’ (static) or ‘bokeh’ (interactive). Defaults to “matplotlib”.
linekwds (dict, optional) – Keyword arguments for line plotting (see
matplotlib.pyplot.plot()). Defaults to {}.linesegkwds (dict, optional) – Keyword arguments for line segments plotting (see
matplotlib.pyplot.plot()). Defaults to {}.scatterkwds (dict, optional) – Keyword arguments for scatter plot (see
matplotlib.pyplot.scatter()). Defaults to {}.legkwds (dict, optional) – Keyword arguments for legend (see
matplotlib.pyplot.legend()). Defaults to {}.**kwds –
keyword arguments:
labels (list): Labels for each curve
xaxis (np.ndarray): x (horizontal) axis values
title (str): Title of the plot
legend_location (str): Location of the plot legend
align (bool): Option to shift traces by bias voltage
- get_current_calibration()
Return the current calibration dictionary. :rtype:
dictif none is present, return the one from the config. If none is present there,
return an empty dictionary.
- Returns:
dict: Calibration dictionary.
- append_energy_axis(df, tof_column=None, energy_column=None, calibration=None, **kwds)
Calculate and append the energy axis to the events dataframe.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to apply the energy axis calibration to.
tof_column (str, optional) – Label of the source column. Defaults to config[“dataframe”][“tof_column”].
energy_column (str, optional) – Label of the destination column. Defaults to config[“dataframe”][“energy_column”].
calibration (dict, optional) – Calibration dictionary. If provided, overrides calibration from class or config. Defaults to self.calibration or config[“energy”][“calibration”].
**kwds – additional keyword arguments for the energy conversion. They are added to the calibration dictionary.
- Raises:
ValueError – Raised if expected calibration parameters are missing.
NotImplementedError – Raised if an invalid calib_type is found.
- Returns:
dataframe with added column and energy calibration metadata dictionary.
- Return type:
Union[pd.DataFrame, dask.dataframe.DataFrame]
- append_tof_ns_axis(df, tof_column=None, tof_ns_column=None, **kwds)
Converts the time-of-flight time from steps to time in ns.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to convert.
tof_column (str, optional) – Name of the column containing the time-of-flight steps. Defaults to config[“dataframe”][“tof_column”].
tof_ns_column (str, optional) – Name of the column to store the time-of-flight in nanoseconds. Defaults to config[“dataframe”][“tof_ns_column”].
binwidth (float, optional) – Time-of-flight binwidth in ns. Defaults to config[“energy”][“tof_binwidth”].
binning (int, optional) – Time-of-flight binning factor. Defaults to config[“energy”][“tof_binning”].
- Returns:
Dataframe with the new columns. dict: Metadata dictionary.
- Return type:
dask.dataframe.DataFrame
- gather_calibration_metadata(calibration=None)
Collects metadata from the energy calibration
- Parameters:
calibration (dict, optional) – Dictionary with energy calibration parameters. Defaults to None.
- Returns:
Generated metadata dictionary.
- Return type:
dict
- adjust_energy_correction(image, correction_type=None, amplitude=None, center=None, correction=None, apply=False, **kwds)
Visualize the energy correction function on top of the TOF/X/Y graphs.
- Parameters:
image (xr.DataArray) – Image data cube (x, y, tof) of binned data to plot.
correction_type (str, optional) –
Type of correction to apply to the TOF axis. Valid values are:
’spherical’
’Lorentzian’
’Gaussian’
’Lorentzian_asymmetric’
Defaults to config[“energy”][“correction_type”].
amplitude (float, optional) – Amplitude of the time-of-flight correction term. Defaults to config[“energy”][“correction”][“correction_type”].
center (Tuple[float, float], optional) – Center (x/y) coordinates for the correction. Defaults to config[“energy”][“correction”][“center”].
correction (dict, optional) – Correction dict. Defaults to the config values and is updated from provided and adjusted parameters.
apply (bool, optional) – whether to store the provided parameters within the class. Defaults to False.
**kwds –
Additional parameters to use for the adjustment plots:
x_column (str): Name of the x column.
y_column (str): Name of the y column.
tof_column (str): Name of the tog column to convert.
x_width (int, int): x range to integrate around the center
y_width (int, int): y range to integrate around the center
tof_fermi (int): TOF value of the Fermi level
tof_width (int, int): TOF range to plot around tof_fermi
color_clip (int): highest value to plot in the color range
Additional parameters for the correction functions:
d (float): Field-free drift distance.
gamma (float): Linewidth value for correction using a 2D Lorentz profile.
sigma (float): Standard deviation for correction using a 2D Gaussian profile.
gamma2 (float): Linewidth value for correction using an asymmetric 2D Lorentz profile, X-direction.
amplitude2 (float): Amplitude value for correction using an asymmetric 2D Lorentz profile, X-direction.
- Raises:
NotImplementedError – Raised for invalid correction_type.
- apply_energy_correction(df, tof_column=None, new_tof_column=None, correction_type=None, amplitude=None, correction=None, **kwds)
Apply correction to the time-of-flight (TOF) axis of single-event data.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – The dataframe where to apply the energy correction to.
tof_column (str, optional) – Name of the source column to convert. Defaults to config[“dataframe”][“tof_column”].
new_tof_column (str, optional) – Name of the destination column to convert. Defaults to config[“dataframe”][“corrected_tof_column”].
correction_type (str, optional) –
Type of correction to apply to the TOF axis. Valid values are:
’spherical’
’Lorentzian’
’Gaussian’
’Lorentzian_asymmetric’
Defaults to config[“energy”][“correction_type”].
amplitude (float, optional) – Amplitude of the time-of-flight correction term. Defaults to config[“energy”][“correction”][“correction_type”].
correction (dict, optional) – Correction dictionary containing paramters for the correction. Defaults to self.correction or config[“energy”][“correction”].
**kwds –
Additional parameters to use for the correction:
x_column (str): Name of the x column.
y_column (str): Name of the y column.
d (float): Field-free drift distance.
gamma (float): Linewidth value for correction using a 2D Lorentz profile.
sigma (float): Standard deviation for correction using a 2D Gaussian profile.
gamma2 (float): Linewidth value for correction using an asymmetric 2D Lorentz profile, X-direction.
amplitude2 (float): Amplitude value for correction using an asymmetric 2D Lorentz profile, X-direction.
- Returns:
dataframe with added column and Energy correction metadata dictionary.
- Return type:
Union[pd.DataFrame, dask.dataframe.DataFrame]
- gather_correction_metadata(correction=None)
Collect meta data for energy correction
- Parameters:
correction (dict, optional) – Dictionary with energy correction parameters. Defaults to None.
- Returns:
Generated metadata dictionary.
- Return type:
dict
- align_dld_sectors(df, tof_column=None, sector_id_column=None, sector_delays=None)
Aligns the time-of-flight axis of the different sections of a detector.
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to use.
tof_column (str, optional) – Name of the column containing the time-of-flight values. Defaults to config[“dataframe”][“tof_column”].
sector_id_column (str, optional) – Name of the column containing the sector id values. Defaults to config[“dataframe”][“sector_id_column”].
sector_delays (np.ndarray, optional) – Array containing the sector delays. Defaults to config[“dataframe”][“sector_delays”].
- Returns:
Dataframe with the new columns. dict: Metadata dictionary.
- Return type:
dask.dataframe.DataFrame
- add_offsets(df=None, constant=None, columns=None, signs=None, preserve_mean=False, reductions=None, energy_column=None)
Apply an offset to the energy column by the values of the provided columns.
If no parameter is passed to this function, the offset is applied as defined in the config file. If parameters are passed, they are used to generate a new offset dictionary and the offset is applied using the
dfops.apply_offset_from_columns()function.# TODO: This funcion can still be improved and needs testsing
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – Dataframe to use.
constant (float, optional) – The constant to shift the energy axis by.
columns (Union[str, Sequence[str]]) – Name of the column(s) to apply the shift from.
signs (Union[int, Sequence[int]]) – Sign of the shift to apply. (+1 or -1) A positive sign shifts the energy axis to higher kinetic energies. Defaults to +1.
preserve_mean (bool) – Whether to subtract the mean of the column before applying the shift. Defaults to False.
reductions (str) – The reduction to apply to the column. Should be an available method of dask.dataframe.Series. For example “mean”. In this case the function is applied to the column to generate a single value for the whole dataset. If None, the shift is applied per-dataframe-row. Defaults to None. Currently only “mean” is supported.
energy_column (str, optional) – Name of the column containing the energy values.
- Returns:
Dataframe with the new columns. dict: Metadata dictionary.
- Return type:
dask.dataframe.DataFrame
- sed.calibrator.energy.extract_bias(files, bias_key)
Read bias values from hdf5 files
- Parameters:
files (List[str]) – List of filenames
bias_key (str) – hdf5 path to the bias value
- Returns:
Array of bias values.
- Return type:
np.ndarray
- sed.calibrator.energy.correction_function(x, y, correction_type, center, amplitude, **kwds)
Calculate the TOF correction based on the given X/Y coordinates and a model.
- Parameters:
x (float) – x coordinate
y (float) – y coordinate
correction_type (str) – type of correction. One of “spherical”, “Lorentzian”, “Gaussian”, or “Lorentzian_asymmetric”
center (Tuple[int, int]) – center position of the distribution (x,y)
amplitude (float) – Amplitude of the correction
**kwds –
Keyword arguments:
diameter (float): Field-free drift distance.
gamma (float): Linewidth value for correction using a 2D Lorentz profile.
sigma (float): Standard deviation for correction using a 2D Gaussian profile.
gamma2 (float): Linewidth value for correction using an asymmetric 2D Lorentz profile, X-direction.
amplitude2 (float): Amplitude value for correction using an asymmetric 2D Lorentz profile, X-direction.
- Returns:
calculated correction value
- Return type:
float
- sed.calibrator.energy.normspec(specs, smooth=False, span=7, order=1)
Normalize a series of 1D signals.
- Parameters:
specs (np.ndarray) – Collection of 1D signals.
smooth (bool, optional) – Option to smooth the signals before normalization. Defaults to False.
span (int, optional) – Smoothing span parameters of the LOESS method (see
scipy.signal.savgol_filter()). Defaults to 7.order (int, optional) – Smoothing order parameters of the LOESS method (see
scipy.signal.savgol_filter()).. Defaults to 1.
- Returns:
The matrix assembled from a list of maximum-normalized signals.
- Return type:
np.ndarray
- sed.calibrator.energy.find_correspondence(sig_still, sig_mov, **kwds)
Determine the correspondence between two 1D traces by alignment using a time-warp algorithm.
- Parameters:
sig_still (np.ndarray) – Reference 1D signals.
sig_mov (np.ndarray) – 1D signal to be aligned.
**kwds – keyword arguments for
fastdtw.fastdtw()
- Returns:
Pixel-wise path correspondences between two input 1D arrays (sig_still, sig_mov).
- Return type:
np.ndarray
- sed.calibrator.energy.range_convert(x, xrng, pathcorr)
Convert value range using a pairwise path correspondence (e.g. obtained from time warping algorithm).
- Parameters:
x (np.ndarray) – Values of the x axis (e.g. time-of-flight values).
xrng (Tuple) – Boundary value range on the x axis.
pathcorr (np.ndarray) – Path correspondence between two 1D arrays in the following form, [(id_1_trace_1, id_1_trace_2), (id_2_trace_1, id_2_trace_2), …]
- Returns:
Transformed range according to the path correspondence.
- Return type:
Tuple
- sed.calibrator.energy.find_nearest(val, narray)
Find the value closest to a given one in a 1D array.
- Parameters:
val (float) – Value of interest.
narray (np.ndarray) – The array to look for the nearest value.
- Returns:
Array index of the value nearest to the given one.
- Return type:
int
- sed.calibrator.energy.peaksearch(traces, tof, ranges=None, pkwindow=3, plot=False)
Detect a list of peaks in the corresponding regions of multiple spectra.
- Parameters:
traces (np.ndarray) – Collection of 1D spectra.
tof (np.ndarray) – Time-of-flight values.
ranges (List[Tuple], optional) – List of ranges for peak detection in the format
[ (LowerBound1, UpperBound1), (LowerBound2, UpperBound2) – Defaults to None.
pkwindow (int, optional) – Window width of a peak (amounts to lookahead in
peakdetect1d). Defaults to 3.plot (bool, optional) – Specify whether to display a custom plot of the peak search results. Defaults to False.
- Returns:
Collection of peak positions.
- Return type:
np.ndarray
- sed.calibrator.energy.peakdetect1d(y_axis, x_axis=None, lookahead=200, delta=0)
Function for detecting local maxima and minima in a signal. Discovers peaks by searching for values which are surrounded by lower or larger values for maxima and minima respectively
Converted from/based on a MATLAB script at: http://billauer.co.il/peakdet.html
- Parameters:
y_axis (np.ndarray) – A list containing the signal over which to find peaks.
x_axis (np.ndarray, optional) – A x-axis whose values correspond to the y_axis list and is used in the return to specify the position of the peaks. If omitted an index of the y_axis is used.
lookahead (int, optional) – distance to look ahead from a peak candidate to determine if it is the actual peak ‘(samples / period) / f’ where ‘4 >= f >= 1.25’ might be a good value. Defaults to 200.
delta (int, optional) – this specifies a minimum difference between a peak and the following points, before a peak may be considered a peak. Useful to hinder the function from picking up false peaks towards to end of the signal. To work well delta should be set to delta >= RMSnoise * 5. Defaults to 0.
- Raises:
ValueError – Raised if lookahead and delta are out of range.
- Returns:
Tuple of positions of the positive peaks, positions of the negative peaks
- Return type:
Tuple[np.ndarray, np.ndarray]
- sed.calibrator.energy.fit_energy_calibation(pos, vals, binwidth, binning, ref_id=0, ref_energy=None, t=None, energy_scale='kinetic', **kwds)
Energy calibration by nonlinear least squares fitting of spectral landmarks on a set of (energy dispersion curves (EDCs). This is done here by fitting to the function d/(t-t0)**2.
- Parameters:
pos (Union[List[float], np.ndarray]) – Positions of the spectral landmarks (e.g. peaks) in the EDCs.
vals (Union[List[float], np.ndarray]) – Bias voltage value associated with each EDC.
binwidth (float) – Time width of each original TOF bin in ns.
binning (int) – Binning factor of the TOF values.
ref_id (int, optional) – Reference dataset index. Defaults to 0.
ref_energy (float, optional) – Energy value of the feature in the refence trace (eV). required to output the calibration. Defaults to None.
t (Union[List[float], np.ndarray], optional) – Array of TOF values. Required to calculate calibration trace. Defaults to None.
energy_scale (str, optional) –
Direction of increasing energy scale.
’kinetic’: increasing energy with decreasing TOF.
’binding’: increasing energy with increasing TOF.
t0 (float, optional) – constrains and initial values for the fit parameter t0, corresponding to the time of flight offset. Defaults to 1e-6.
E0 (float, optional) – constrains and initial values for the fit parameter E0, corresponding to the energy offset. Defaults to min(vals).
d (float, optional) – constrains and initial values for the fit parameter d, corresponding to the drift distance. Defaults to 1.
- Returns:
A dictionary of fitting parameters including the following,
”coeffs”: Fitted function coefficents.
”axis”: Fitted energy axis.
- Return type:
dict
- sed.calibrator.energy.poly_energy_calibration(pos, vals, order=3, ref_id=0, ref_energy=None, t=None, aug=1, method='lstsq', energy_scale='kinetic', **kwds)
Energy calibration by nonlinear least squares fitting of spectral landmarks on a set of (energy dispersion curves (EDCs). This amounts to solving for the coefficient vector, a, in the system of equations T.a = b. Here T is the differential drift time matrix and b the differential bias vector, and assuming that the energy-drift-time relationship can be written in the form, E = sum_n (a_n * t**n) + E0
- Parameters:
pos (Union[List[float], np.ndarray]) – Positions of the spectral landmarks (e.g. peaks) in the EDCs.
vals (Union[List[float], np.ndarray]) – Bias voltage value associated with each EDC.
order (int, optional) – Polynomial order of the fitting function. Defaults to 3.
ref_id (int, optional) – Reference dataset index. Defaults to 0.
ref_energy (float, optional) – Energy value of the feature in the refence trace (eV). required to output the calibration. Defaults to None.
t (Union[List[float], np.ndarray], optional) – Array of TOF values. Required to calculate calibration trace. Defaults to None.
aug (int, optional) – Fitting dimension augmentation (1=no change, 2=double, etc). Defaults to 1.
method (str, optional) –
Method for determining the energy calibration.
’lmfit’: Energy calibration using lmfit and 1/t^2 form.
’lstsq’, ‘lsqr’: Energy calibration using polynomial form..
Defaults to “lstsq”.
energy_scale (str, optional) –
Direction of increasing energy scale.
’kinetic’: increasing energy with decreasing TOF.
’binding’: increasing energy with increasing TOF.
- Returns:
A dictionary of fitting parameters including the following,
”coeffs”: Fitted polynomial coefficients (the a’s).
”offset”: Minimum time-of-flight corresponding to a peak.
”Tmat”: the T matrix (differential time-of-flight) in the equation Ta=b.
”bvec”: the b vector (differential bias) in the fitting Ta=b.
”axis”: Fitted energy axis.
- Return type:
dict
- sed.calibrator.energy.tof2ev(tof_distance, time_offset, binwidth, binning, energy_scale, energy_offset, t)
(d/(t-t0))**2 expression of the time-of-flight to electron volt conversion formula.
- Parameters:
tof_distance (float) – Drift distance in meter.
time_offset (float) – time offset in ns.
binwidth (float) – Time width of each original TOF bin in ns.
binning (int) – Binning factor of the TOF values.
energy_scale (str, optional) –
Direction of increasing energy scale.
’kinetic’: increasing energy with decreasing TOF.
’binding’: increasing energy with increasing TOF.
energy_offset (float) – Energy offset in eV.
t (float) – TOF value in bin number.
- Returns:
Converted energy in eV
- Return type:
float
- sed.calibrator.energy.tof2evpoly(poly_a, energy_offset, t)
Polynomial approximation of the time-of-flight to electron volt conversion formula.
- Parameters:
poly_a (Union[List[float], np.ndarray]) – Polynomial coefficients.
energy_offset (float) – Energy offset in eV.
t (float) – TOF value in bin number.
- Returns:
Converted energy.
- Return type:
float
- sed.calibrator.energy.tof2ns(binwidth, binning, t)
Converts the time-of-flight steps to time-of-flight in nanoseconds.
designed for use with dask.dataframe.DataFrame.map_partitions.
- Parameters:
binwidth (float) – Time step size in seconds.
binning (int) – Binning of the time-of-flight steps.
t (float) – TOF value in bin number.
- Returns:
Converted time in nanoseconds.
- Return type:
float
5.3. Delay calibration and correction
sed.calibrator.delay module. Code for delay calibration.
- class sed.calibrator.delay.DelayCalibrator(config=None)
Bases:
objectPump-Probe delay calibration methods. Initialization of the DelayCalibrator class passes the config.
- Parameters:
config (dict, optional) – Config dictionary. Defaults to None.
- append_delay_axis(df, adc_column=None, delay_column=None, calibration=None, adc_range=None, delay_range=None, time0=None, delay_range_mm=None, datafile=None, p1_key=None, p2_key=None, t0_key=None)
Calculate and append the delay axis to the events dataframe, by converting values from an analog-digital-converter (ADC).
- Parameters:
df (Union[pd.DataFrame, dask.dataframe.DataFrame]) – The dataframe where to apply the delay calibration to.
adc_column (str, optional) – Source column for delay calibration. Defaults to config[“dataframe”][“adc_column”].
delay_column (str, optional) – Destination column for delay calibration. Defaults to config[“dataframe”][“delay_column”].
calibration (dict, optional) – Calibration dictionary with parameters for delay calibration.
adc_range (Union[Tuple, List, np.ndarray], optional) – The range of used ADC values. Defaults to config[“delay”][“adc_range”].
delay_range (Union[Tuple, List, np.ndarray], optional) – Range of scanned delay values in ps. If omitted, the range is calculated from the delay_range_mm and t0 values.
time0 (float, optional) – Pump-Probe overlap value of the delay coordinate. If omitted, it is searched for in the data files.
delay_range_mm (Union[Tuple, List, np.ndarray], optional) – Range of scanned delay stage in mm. If omitted, it is searched for in the data files.
datafile (str, optional) – Datafile in which delay parameters are searched for. Defaults to None.
p1_key (str, optional) – hdf5 key for delay_range_mm start value. Defaults to config[“delay”][“p1_key”]
p2_key (str, optional) – hdf5 key for delay_range_mm end value. Defaults to config[“delay”][“p2_key”]
t0_key (str, optional) – hdf5 key for t0 value (mm). Defaults to config[“delay”][“t0_key”]
- Raises:
ValueError – Raised if delay parameters are not found in the file.
NotImplementedError – Raised if no sufficient information passed.
- Returns:
dataframe with added column and delay calibration metdata dictionary.
- Return type:
Union[pd.DataFrame, dask.dataframe.DataFrame]
- sed.calibrator.delay.extract_delay_stage_parameters(file, p1_key, p2_key, t0_key)
Read delay stage ranges from hdf5 file
- Parameters:
file (
str) – filenamep1_key (
str) – hdf5 path to the start of the scan rangep2_key (
str) – hdf5 path to the end of the scan ranget0_key (
str) – hdf5 path to the t0 value
- Returns:
typing.Tuple– (p1_value, p2_value, t0_value)
- sed.calibrator.delay.mm_to_ps(delay_mm, time0_mm)
Converts a delaystage position in mm into a relative delay in picoseconds (double pass).
- Parameters:
delay_mm (Union[float, Sequence[float]]) – Delay stage position in mm
time0_mm (_type_) – Delay stage position of pump-probe overlap in mm
- Returns:
Relative delay in picoseconds
- Return type:
Union[float, Sequence[float]]