DataUtils.ForwardCompat#

DataUtils.ForwardCompat.py

This module is used to convert old data objects to new ones.

class CurveProxy(x, y, peak_info)#

Bases: object

A proxy class for Curve to hold x, y, spline, and peak_info.

x#

The x-values of the curve.

Type:

array-like

y#

The y-values of the curve.

Type:

array-like

spline#

A spline representation of the curve.

Type:

UnivariateSpline

peak_info#

List of peak information, where each peak is represented by a list of indices.

Type:

list of lists

class PreRecogProxy(flowchange, cs)#

Bases: object

A proxy class for PreRecog to hold flowchange and cs.

flowchange#

The flow change object.

Type:

NullFlowChange

cs#

The calibration slope and intercept proxy.

Type:

CsProxy

get_start_index(slice_)#

Get the start index from a slice object.

Parameters:

slice (slice) – The slice object.

Returns:

The start index of the slice.

Return type:

int

get_trimmed_curve(curve, slice_, renumber=True, convert_peak_info=True)#

Get a trimmed version of the curve based on the given slice.

Parameters:
  • curve (CurveProxy) – The original curve to be trimmed.

  • slice (slice) – The slice object defining the portion to keep.

  • renumber (bool, optional) – If True, renumber the x-values to start from 0, by default True.

  • convert_peak_info (bool, optional) – If True, adjust the peak_info indices according to the slice, by default True.

Returns:

The trimmed curve.

Return type:

CurveProxy

convert_to_trimmed_prerecog(pre_recog, uv_restrict_list, xr_restrict_list, renumber=True, debug=False)#

Convert an old PreRecog object to a trimmed PreRecogProxy object.

Parameters:
  • pre_recog (PreRecog) – The original PreRecog object to be converted.

  • uv_restrict_list (list of Restrict) – List of Restrict objects for UV data.

  • xr_restrict_list (list of Restrict) – List of Restrict objects for XR data.

  • renumber (bool, optional) – If True, renumber the x-values to start from 0, by default True.

  • debug (bool, optional) – If True, enable debug mode, by default False.

Returns:

The converted and trimmed PreRecogProxy object.

Return type:

PreRecogProxy