Signals
arora.signals.fourier
arora.signals.fourier(epochized_data, sampling_frequency)
Apply fourier fast transform method to a list of signals using fft()
from SciPy.fftpack
.
- Parameters:
- signalslist of list of int or float
The segmented data in a list
- sampling_frequencyint or float
The sampling frequency of the data
- Returns:
List of transformed data where each epoch is a
NumPy array
.
For example:
>>> some_data = [[1, 2], [2, 3], [3, 4]]
>>> arora.signals.fourier(some_data, 200)
[array([ 3.-0.j, -1.-0.j]), array([ 5.-0.j, -1.-0.j]), array([ 7.-0.j, -1.-0.j])]
arora.signals.resample
arora.signals.resample(signals, old_fs, new_fs)
Resamples the signals given both the new frequency and the old frequency.
- Parameters:
- signalslist of int or float
List of signals.
- old_fsint
The old frequency of the signal
- new_fsint
The new frequency of the signal
- Returns :
NumPy array of resampled data.
For example:
>>> signals = [1, 2, 3, 4, 5, 6, 7, 8]
>>> arora.signals.resample(signals, 4, 1)
array([1. , 0.32651433, 0.47266051, 1.16309138, 2. ,
2.64941807, 2.96926627, 3.02470348, 3. , 3.06911053,
3.30108763, 3.64674704, 4. , 4.28360902, 4.5 ,
4.71639098, 5. , 5.35325296, 5.69891237, 5.93088947,
6. , 5.97529652, 6.03073373, 6.35058193, 7. ,
7.83690862, 8.52733949, 8.67348567, 8. , 6.50588996,
4.5 , 2.49411004])
arora.signals.lower_frequency
arora.signals.lower_frequency(signals, method, new_fs)
Lowers the frequency of the signals with given method. Uses arora.signals.segment.fs()
to segment the signals with given frequency.
- Parameters:
- signals: list of int or float
List of time series signals.
- method: {‘min’ or ‘max’ or ‘mean’ or ‘median’}, default ‘mean’
The method how the frequency should be lowered.
- new_fs: int
The new frequency of the signals.
- Returns:
List of new values corresponding to the method given. Length of returned list =
len(signals) / new_fs
.
For example:
>>> signals = [1,2,3,4,5,6,7,8]
>>> arora.signals.lower_frequency(signals, 2, min)
[1, 3, 5, 7]
>>> arora.signals.lower_frequency(signals, 2, max)
[2, 4, 6, 8]
>>> arora.signals.lower_frequency(signals, 2, mean)
[1.5, 3.5, 5.5, 7.5]
>>> arora.signals.lower_frequency(signals, 4, median)
[2.5, 6.5]
arora.math.welch_psd
arora.math.welch_psd(signals, fs, filter_order)
Estimate power spectral density using Welch’s method Smoothing
- Parameters:
- signalspd.DataFrame
An array of a signal
- sampling_frequencyint or float
The frequency of the epoch
- filter_orderint
Order of the filter
- Returns:
Arrays of sample frequency as
numpy.ndarray
.