piel.analysis.signals.time.core.threshold#

Attributes#

Functions#

extract_signal_above_threshold(...)

Extracts all pulses from the input signal that exceed the specified threshold.

extract_pulses_from_signal(...)

Detects and extracts pulses from a DataTimeSignalData instance, including segments

is_pulse_above_threshold(→ bool)

Determines if the pulse's amplitude exceeds the specified threshold.

Module Contents#

logger#
extract_signal_above_threshold(signal_data: piel.types.TimeSignalData, threshold: float, min_pulse_width_s: float = 0.0, noise_floor: float = 0.0) piel.types.MultiTimeSignalData[source]#

Extracts all pulses from the input signal that exceed the specified threshold.

Parameters:
  • signal_data (TimeSignalData) – The original signal data containing time and data arrays.

  • threshold (float) – The data value threshold to identify pulses.

  • min_pulse_width_s (float, optional) – The minimum duration (in seconds) for a pulse to be considered valid. Pulses shorter than this duration will be ignored. Defaults to 0.0.

  • noise_floor (float, optional) – The value to assign to non-pulse regions in the extracted pulses. Defaults to 0.0.

Returns:

A list of DataTimeSignalData instances, each representing a detected pulse.

Return type:

MultiTimeSignalData

extract_pulses_from_signal(full_data: piel.types.TimeSignalData, pre_pulse_time_s: float = 0.01, post_pulse_time_s: float = 0.01, noise_std_multiplier: float = 3.0, min_pulse_height: float | None = None, min_pulse_distance_s: float | None = None, data_time_signal_kwargs: dict | None = None) List[piel.types.TimeSignalData][source]#

Detects and extracts pulses from a DataTimeSignalData instance, including segments before and after each pulse up to the noise floor.

Parameters:
  • full_data (TimeSignalData) – The input signal data containing multiple pulses.

  • pre_pulse_time_s (float) – Time (in seconds) to include before each detected pulse.

  • post_pulse_time_s (float) – Time (in seconds) to include after each detected pulse.

  • noise_std_multiplier (float) – Multiplier for noise standard deviation to set detection threshold.

  • min_pulse_height (float, optional) – Minimum height of a pulse to be detected. If not provided, it is set to noise_std_multiplier * noise_std.

  • min_pulse_distance_s (float, optional) – Minimum distance (in seconds) between consecutive pulses. If not provided, it is set based on the pre_pulse_time and post_pulse_time.

  • data_time_signal_kwargs (dict, optional) – Additional keyword arguments for DataTimeSignalData.

Returns:

A list of DataTimeSignalData instances, each representing an extracted pulse.

Return type:

List[TimeSignalData]

is_pulse_above_threshold(pulse: piel.types.TimeSignalData, threshold: float) bool[source]#

Determines if the pulse’s amplitude exceeds the specified threshold.

Parameters:
  • pulse (TimeSignalData) – The pulse data to evaluate.

  • threshold (float) – The amplitude threshold.

Returns:

True if the pulse’s maximum amplitude is greater than or equal to the threshold, False otherwise.

Return type:

bool