resistics.time.filter module¶
-
resistics.time.filter.
bandPass
(timeData: resistics.time.data.TimeData, cutoffLow: float, cutoffHigh: float, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Bandpass butterworth filter for time data
- Parameters
- timeDataTimeData
timeData to filter
- cutofffloat
Cutoff frequency in Hz
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Filtered time data
-
resistics.time.filter.
bandPassData
(data: Dict[str, numpy.ndarray], sampleFreq: float, cutoffLow: float, cutoffHigh: float, order: int = 5)[source]¶ Bandpass butterworth filter for array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- cutofffloat
Cutoff frequency in Hz
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
downsampleData
(data: Dict[str, numpy.ndarray], downsampleFactor: int) → Dict[str, numpy.ndarray][source]¶ Decimate array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- downsampleFactorint
The factor to downsample the data by
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
factorise
(number: int)[source]¶ Factorise a number to avoid too large a downsample factor
- Parameters
- numberint
The number to factorise
- Returns
- List[int]
The downsampling factors to use
Notes
There’s a few pathological cases here that are being ignored. For example, what if the downsample factor is the product of two primes greater than 13.
-
resistics.time.filter.
filterData
(data: Dict[str, numpy.ndarray], b, a) → Dict[str, numpy.ndarray][source]¶ Butterworth filter for array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- barray_like
The numerator coefficient vector of the filter
- aarray_like
The denominator coefficient vector of the filter. If a[0] is not 1, then both a and b are normalized by a[0]
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
highPass
(timeData: resistics.time.data.TimeData, cutoff: float, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Highpass butterworth filter for time data
- Parameters
- timeDataTimeData
timeData to filter
- cutofffloat
Cutoff frequency in Hz
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Filtered time data
-
resistics.time.filter.
highPassData
(data: Dict[str, numpy.ndarray], sampleFreq: float, cutoff: float, order: int = 5)[source]¶ Highpass butterworth filter for array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- cutofffloat
Cutoff frequency in Hz
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
lowPass
(timeData: resistics.time.data.TimeData, cutoff: float, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Lowpass butterworth filter for time data
- Parameters
- timeDataTimeData
timeData to filter
- cutofffloat
Cutoff frequency in Hz
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Filtered time data
-
resistics.time.filter.
lowPassData
(data: Dict[str, numpy.ndarray], sampleFreq: float, cutoff: float, order: int = 5) → Dict[str, numpy.ndarray][source]¶ Lowpass butterworth filter for array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- cutofffloat
Cutoff frequency in Hz
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
normalise
(timeData: resistics.time.data.TimeData, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Normalise time data
- Parameters
- timeDataTimeData
timeData to normalise
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Normalised time data
-
resistics.time.filter.
normaliseData
(data: Dict[str, numpy.ndarray]) → Dict[str, numpy.ndarray][source]¶ Normalise array data
Normalisation is done by dividing by the result of numpy.norm of the data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- Returns
- Dict
Dictionary with channel as keys and normalised data as values
-
resistics.time.filter.
notchFilter
(timeData: resistics.time.data.TimeData, notch: float, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Bandpass butterworth filter for time data
- Parameters
- timeDataTimeData
timeData to filter
- notchfloat
Frequency to notch filter in Hz
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Filtered time data
-
resistics.time.filter.
notchFilterData
(data: Dict[str, numpy.ndarray], sampleFreq: float, notch: float, band: float) → Dict[str, numpy.ndarray][source]¶ Notch filter array data
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- sampleFreqfloat
Sampling frequency in Hz
- notchfloat
Frequency to notch in Hz
- bandfloat
The bandwidth around the centerline freqency that you wish to filter
- Returns
- dataDict
Dictionary with channel as keys and data as values
-
resistics.time.filter.
resample
(timeData: resistics.time.data.TimeData, resampFreq: float, inplace: bool = True) → resistics.time.data.TimeData[source]¶ Resample time data
- Parameters
- timeDataTimeData
timeData to filter
- resampFreqfloat
The frequency to resample to
- inplacebool, optional
Whether to manipulate the data inplace
- Returns
- TimeData
Filtered time data
-
resistics.time.filter.
resampleData
(data: Dict[str, numpy.ndarray], sampleFreq: float, sampleFreqNew: float) → Dict[str, numpy.ndarray][source]¶ Resample array data
Resample the data using the polyphase method which does not assume periodicity Calculate the upsample and then the downsampling rate and using polyphase filtering, the final sample rate is: (up / down) * original sample rate Therefore, to get a sampling frequency of sampleFreqNew, want: (sampleFreqNew / sampleFreq) * sampleFreq Use the fractions library to get up and down as integers which they are required to be.
- Parameters
- dataDict
Dictionary with channel as keys and data as values
- sampleFreqfloat
The current sampling frequency in Hz
- sampleFreqNewfloat
The sampling frequency in Hz to resample to
- Returns
- dataDict
Dictionary with channel as keys and data as values