elasticai.preprocessor.framing.frame_generator#

Module Contents#

Classes#

FrameWaveform

SettingsFrame

Class with settings for the FrameGenerator to configure his properties Attributes: mode_thr: String with used method for thresholding [‘const’: constant given value, ‘abs_mean’: absolute mean value, ‘mad’: median absolute derivation, ‘mavg’, moving average, ‘mavg_abs’: absolute mean absolute value, ‘rms_norm’: Root-Mean-Squared, ‘rms_move’: Moving RMS, ‘rms_black’: RMS method used in Blackrock Neurotechnology Systems, ‘welford’: Welford Online Algorithm for STD Calculation] mode_align: Aligning mode of the detected spike frames [none, max, min, ptp (Positive turning point), ntp (Negative turning point), abs-max (Absolute maximum)] sampling_rate: Sampling rate of the transient signal [Hz] window_sec: Time length of the frame waveform [s] offset_sec: Time length for looking on the aligned position before and after the window_sec on the transient signal [s] align_sec: Starting position for aligning the frame waveform [s] thr_gain: Float with additional scaling value applied on the threshold value [hyperparameter]

FrameGenerator

Data#

API#

class elasticai.preprocessor.framing.frame_generator.FrameWaveform[source]#
waveform: numpy.ndarray#

None

xpos: numpy.ndarray#

None

label: numpy.ndarray#

None

sampling_rate: float#

None

property length: int#
property num_samples: int#
property is_data_labeled: bool#
class elasticai.preprocessor.framing.frame_generator.SettingsFrame[source]#

Class with settings for the FrameGenerator to configure his properties Attributes: mode_thr: String with used method for thresholding [‘const’: constant given value, ‘abs_mean’: absolute mean value, ‘mad’: median absolute derivation, ‘mavg’, moving average, ‘mavg_abs’: absolute mean absolute value, ‘rms_norm’: Root-Mean-Squared, ‘rms_move’: Moving RMS, ‘rms_black’: RMS method used in Blackrock Neurotechnology Systems, ‘welford’: Welford Online Algorithm for STD Calculation] mode_align: Aligning mode of the detected spike frames [none, max, min, ptp (Positive turning point), ntp (Negative turning point), abs-max (Absolute maximum)] sampling_rate: Sampling rate of the transient signal [Hz] window_sec: Time length of the frame waveform [s] offset_sec: Time length for looking on the aligned position before and after the window_sec on the transient signal [s] align_sec: Starting position for aligning the frame waveform [s] thr_gain: Float with additional scaling value applied on the threshold value [hyperparameter]

mode_align: str#

None

mode_thr: str#

None

sampling_rate: float#

None

window_sec: float#

None

offset_sec: float#

None

align_sec: float#

None

thr_gain: float#

None

property length_frame_int: int#
property length_align_position: int#
property length_offset_int: int#
property length_total_frame: int#
elasticai.preprocessor.framing.frame_generator.DefaultSettingsFrame#

‘SettingsFrame(…)’

class elasticai.preprocessor.framing.frame_generator.FrameGenerator(settings: elasticai.preprocessor.framing.frame_generator.SettingsFrame)[source]#

Initialization

Class for generating and aligning frame woveform from a transient signal

Parameters:

settings – Class SettingsSDA for defining the properties

get_methods_frame_aligning() list[source]#

Function for getting a list with all methods for frame aligning

get_aligning_position(frame_in: numpy.ndarray) int[source]#

Extracting aligning position of spike frames

Parameters:

frame_in – Numpy array with detected spike frames

Returns:

Integer with starting position

get_threshold(xin: numpy.ndarray, do_abs: bool = False, **kwargs) numpy.ndarray[source]#

Function for returning the threshold array in dependency of the transient input

Parameters:
  • xin – Numpy array with the transient raw input

  • do_abs – Boolean flag to apply absolute input for thresholding

Returns:

Numpy array with threshold value

get_threshold_position(xin: numpy.ndarray, do_abs: bool = False, **kwargs) numpy.ndarray[source]#

Function for returning the positions of the crossing-points between input and threshold

Parameters:
  • xin – Numpy array with the transient raw input

  • do_abs – Boolean flag to apply absolute input for thresholding

Returns:

Numpy array with threshold value

frame_generation(xraw: numpy.ndarray, xsda: numpy.ndarray, do_abs: bool = False, **kwargs) elasticai.preprocessor.framing.frame_generator.FrameWaveform[source]#

Frame generation of SDA output and threshold

Parameters:
  • xraw – Numpy array with transient raw data

  • xsda – Numpy array with transient signal from spike detection algorithm

  • do_abs – Boolean for applying absolute input for thresholding

Returns:

Class FrameWaveform with waveforms, positions and labels

frame_generation_with_position(xraw: numpy.ndarray, xpos: numpy.ndarray, xoffset: int) elasticai.preprocessor.framing.frame_generator.FrameWaveform[source]#

Frame generation from already detected positions (in datasets with groundtruth)

Parameters:
  • xraw – Numpy array with transient raw data

  • xpos – Numpy array with position where a spike frame is available

  • xoffset – Integer value with offset to generate larger spike windows

Returns:

Tuple with [0] original (large) spike frame, [1] algined spike frame and [2] positions