Scan

class escape.Scan(parameter={}, step_lengths=None, array=None, data=None, grid_specs=None)[source]

Bases: object

Scan grouping of an Array across defined steps and optional grid metadata.

Scan partitions an Array into sequential steps defined by step_lengths and exposes step-level metadata through parameter. When grid_specs is provided, Scan also constructs a Grid that maps scan steps onto an N-D grid layout.

Args:

parameter: Metadata describing step parameters and values. step_lengths: List of integer lengths for each scan step. array: Underlying Array instance for this scan. data: Optional raw data used directly by the scan. grid_specs: Optional grid metadata forwarded to Grid.

__getitem__(sel, grid_specs=None)[source]

array getter for scan

__init__(parameter={}, step_lengths=None, array=None, data=None, grid_specs=None)[source]
__len__()[source]
all(*args, **kwargs)[source]
any(*args, **kwargs)[source]
append_parameter(parameter: {'par_name': {'values': <class 'list'>}})[source]
append_step(parameter, step_length)[source]
average(*args, **kwargs)[source]
corr_ana_plot(referece, scanpar_name=None, axis=None)[source]
correlation_analysis_to(ref, *args, **kwargs)[source]
count()[source]
get_parameter_array(key=None)[source]
get_parameter_selection(selection)[source]
get_step_array(n, grid_specs=None)[source]

array getter for scan

get_step_data(n)[source]

data getter for scan

get_step_indexes(ix_step)[source]

“array getter for multiple steps, more efficient than get_step_array

hist(cut_percentage=0, bins='auto', normalize_to=None, scanpar_name=None, plot_results=True, plot_axis=None, **kwargs)[source]
max(*args, **kwargs)[source]
mean(*args, **kwargs)[source]
median(*args, **kwargs)[source]
median_and_mad(axis=None, k_dist=1.4826, norm_samples=False)[source]

Calculate median and median absolute deviation for steps of a scan.

Args:

axis (int, sequence of int, None, optional): axis argument for median calls. k_dist (float, optional): distribution scale factor, should be

1 for real MAD. Defaults to 1.4826 for gaussian distribution.

merge_scans(*others, roundto_interval=None, par_name=None)[source]
min(*args, **kwargs)[source]
nancount()[source]
nanmax(*args, **kwargs)[source]
nanmean(*args, **kwargs)[source]
nanmedian(*args, **kwargs)[source]
nanmin(*args, **kwargs)[source]
nanpercentile(*args, **kwargs)[source]
nanquantile(*args, **kwargs)[source]
nanstd(*args, **kwargs)[source]
nansum(*args, **kwargs)[source]
property par_steps

pandas.DataFrame with one row per scan step.

Columns are the scan parameter names (one column per parameter) plus a step_length column containing the number of events in each step. The integer row index corresponds to the step number.

Return type:

pandas.DataFrame

plot(weights=None, scanpar_name=None, norm_samples=True, axis=None, use_quantiles=True, *args, **kwargs)[source]
std(*args, **kwargs)[source]
steps_where(data_condition=None)[source]

Get step indices where condition is true.

Args:

data_condition (function, optional): function which gets data array as input and returns boolean array.

sum(*args, **kwargs)[source]
property tools
weighted_avg_and_std(weights=None, norm_samples=False, axis=0)[source]
weighted_stat(weights=None)[source]

Grid

class escape.storage.storage.Grid(shape, positions, scan=None, grid_dimension_names=None, **kwargs)[source]

Bases: object

__getitem__(sel)[source]
__init__(shape, positions, scan=None, grid_dimension_names=None, **kwargs)[source]
average(*args, **kwargs)
correlation_analysis_to(*args, **kwargs)
count(*args, **kwargs)
fill_count()[source]

Return (filled_positions, total_positions, percent_filled).

filled_positions is the number of unique grid indices present in the associated Scan. total_positions is the product of self.shape.

get_grid_indices()[source]
get_grid_specs()[source]
max(*args, **kwargs)
mean(*args, **kwargs)
median(*args, **kwargs)
median_and_mad(*args, **kwargs)
min(*args, **kwargs)
nancount(*args, **kwargs)
nanmax(*args, **kwargs)
nanmean(*args, **kwargs)
nanmedian(*args, **kwargs)
nanmin(*args, **kwargs)
nanpercentile(*args, **kwargs)
nanquantile(*args, **kwargs)
nanstd(*args, **kwargs)
nansum(*args, **kwargs)
std(*args, **kwargs)
sum(*args, **kwargs)
to_grid(data)[source]
weighted_avg_and_std(*args, **kwargs)
weighted_stats(*args, **kwargs)