pylablib package

Subpackages

Submodules

pylablib.deploy module

Module contents

pylablib.reload_all(from_load_path=True, keep_parameters=True)[source]

Reload all loaded modules.

If keep_parameters==True, keep the current library parameters (pylablib.par); otherwise, reset them to default.

pylablib.unload_all()[source]

Reload all loaded modules.

pylablib.cut_out_regions(wf, regions, x_column=None, ordered=False, multi_pass=True)

Cut the regions out of the wf based on x_column.

x_column is used to determine which colmn’s values to use to check if the point is in range (see waveforms.get_x_column()). If ordered_x==True, then the function assumes that x_column in ascending order. If multi_pass==False, combine all indices before deleting the data in a single operation (works faster, but only for non-intersecting regions).

pylablib.cut_to_range(wf, xs_range, x_column=None, ordered=False)

Cut the waveform to the given range based on x_column.

The range is defined as xs_range[0]:xs_range[1], or infinite if xs_range=None. x_column is used to determine which colmn’s values to use to check if the point is in range (see waveforms.get_x_column()). If ordered_x==True, then the function assumes that x_column in ascending order.

pylablib.decimate(wf, n=1, dec_mode='skip', axis=0, mode='drop')

Decimate the data.

Parameters:
  • wf – Data.
  • n (int) – Decimation factor.
  • dec_mode (str) – Decimation mode. Can be - 'skip' - just leave every n’th point while completely omitting everything else; - 'bin' or 'mean' - do a binning average; - 'sum' - sum points; - 'min' - leave min point; - 'max' - leave max point; - 'median' - leave median point (works as a median filter).
  • axis (int) – Axis along which to perform the decimation.
  • mode (str) – Determines what to do with the last bin if it’s incomplete. Can be either 'drop' (omit the last bin) or 'leave' (keep it).
pylablib.get_x_column(wf, x_column=None, idx_default=False)

Get x column of the waveform.

x_column can be
  • an array: return as is;
  • '#': return index array;
  • None: equivalent to ‘#’ for 1D data if idx_default==False, or to 0 otherwise;
  • integer: return the column with this index.
pylablib.is_ascending(wf)

Check the if waveform is ascending.

If it has more than 1 dimension, check all lines along 0’th axis.

pylablib.is_descending(wf)

Check if the waveform is descending.

If it has more than 1 dimension, check all lines along 0’th axis.

pylablib.is_linear(wf)

Check if the waveform is linear (values go with a constant step).

If it has more than 1 dimension, check all lines along 0’th axis (with the same step for all).

pylablib.setbp()
pylablib.sliding_filter(wf, n=1, dec_mode='bin', mode='reflect', cval=0.0)

Perform sliding filtering on the data.

Parameters:
  • wf – 1D array-like object.
  • n (int) – bin width.
  • dec_mode (str) –
    Decimation mode. Can be
    • 'bin' or 'mean' - do a binning average;
    • 'sum' - sum points;
    • 'min' - leave min point;
    • 'max' - leave max point;
    • 'median' - leave median point (works as a median filter).
  • mode (str) – Expansion mode. Can be 'constant' (added values are determined by cval), 'nearest' (added values are endvalues of the waveform), 'reflect' (reflect waveform wrt its endpoint) or 'wrap' (wrap the values from the other size).
  • cval (float) – If mode=='constant', determines the expanded values.