pymodalib.algorithms.signals module¶
Basic signal operations, such as pre-processing and down-sampling.
-
exception
ResamplingException
¶ Bases:
Exception
-
generate_times
(signal: numpy.ndarray, fs: float) → numpy.ndarray¶ Generates the time values associated with a signal, starting from t=0.
Parameters: - signal (ndarray) – The signal to generate time values for.
- fs (float) – The sampling frequency of the signal.
Returns: times – The times associated with the signal.
Return type: ndarray
-
preprocess
(signal: numpy.ndarray, fs: float, fmin: Optional[float] = None, fmax: Optional[float] = None) → numpy.ndarray¶ Pre-processes a signal, performing filtering and de-trending.
Parameters: - signal (ndarray) – [1D array] The signal to pre-process.
- fs (float) – The sampling frequency of the signal.
- fmin (float, optional) – The minimum frequency for filtering.
- fmax (float, optional) – The maximum frequency for filtering.
Returns: [1D array] The pre-processed signal.
Return type: ndarray
-
resampl_flow
(signal: numpy.ndarray, original_freq: float, resample_freq: float) → numpy.ndarray¶ Down-samples a signal, using a moving-average.
Parameters: - signal (ndarray) – [1D array] The signal to down-sample.
- original_freq (float) – The original sampling frequency of the signal.
- resample_freq (float) – The sampling frequency of the down-sampled signal.
Returns: [1D array] The down-sampled signal.
Return type: ndarray