helper module

Define utility functions related to thresholds.

threshold_df_column_header(instrument, threshold)[source]

Create consistent column header for threshold dataframes.

Parameters:
  • instrument (Instrument) – Object that measured data in currently labelled column.

  • threshold (Threshold) – Threshold for which you want a header.

Returns:

Threshold dataframe column header, looking like: "NI9205_E4 @ upper threshold (according to NI9205_MP4l)".

Return type:

str

extract_measured_name(label)[source]

Get instrument name from a thresholds df column header.

Parameters:

label (str) – Threshold dataframe column header, looking like: "NI9205_E4 @ upper threshold (according to NI9205_MP4l)".

Returns:

Measure instrument name, like "NI9205_E4".

Return type:

str

extract_detecting_name(label)[source]

Get detecting instrument name from a thresholds df column header.

Parameters:

label (str) – Threshold dataframe column header, looking like: "NI9205_E4 @ upper threshold (according to NI9205_MP4l)".

Returns:

Detecting instrument name, like "NI9205_MP4l".

Return type:

str

reached_last_upper(thresholds)[source]

Determine if all lower thresholds have a matching upper.

Parameters:

thresholds (list[Threshold])

Return type:

bool

sorter_index_then_way(threshold)[source]

Give sample_index and way of threshold.

Used to sort thresholds: - first, by sample index - in case of equality, "enter" < "exit".

Parameters:

threshold (Threshold)

Return type:

tuple[int, int]