pactools.ExtractDriver

class pactools.ExtractDriver(fs, low_fq, max_low_fq, low_fq_width=1.0, fill=2, whitening='after', ordar=10, normalize=False, extract_complex=True, random_state=None, enf=50.0)[source]

Returns bandpass filtered and a highpass filtered signals

Parameters
fsfloat

Sampling frequency

low_fqfloat

Center frequency of bandpass filters.

max_low_fqfloat

Maximum low_fq over a potential cross-validation scheme.

low_fq_widthfloat

Bandwidth of the bandpass filters.

fillin {0, 1, 2}

Filling strategy for the modeled signal sigin: 0 : keep the signal unchanged: sigin = high_sig 1 : remove the bandpass filtered signal: sigin = high_sig - sigdriv 2 : remove and replace by bandpass filtered Gaussian white noise

whiteningin {‘before’, ‘after’, None}

Define when the whitening is done compared to the filtering.

ordarint >= 0

Order of the AR model used for whitening

normalizeboolean

Whether to scale the signals to have unit norm sigin. Both drivers sigdriv and sigdriv_imag are scaled with the same scales.

extract_complexboolean

Whether to extract a complex driver (sigdriv and sigdriv_imag)

random_stateNone, int or np.random.RandomState instance

Seed or random number generator for the white noise filling strategy.

enffloat

Electric Network Frequency

Examples

>>> from sklearn.model_selection import GridSearchCV
>>> from sklearn.pipeline import pipeline
>>> from pactools.grid_search import DARSklearn, ExtractDriver
>>> from pactools.grid_search import MultipleArray
>>> param_grid = {
...     'dar__ordar': [10, 20, 30],
...     'dar__ordriv': [0, 1, 2],
...     'driver__low_fq': [4.0, 4.5, 5.0]
... }
>>> model = Pipeline(steps=[
...     ('driver', ExtractDriver(fs=fs, max_low_fq=5.0)),
...     ('dar', DARSklearn(fs=fs, max_ordar=30)),
... ])
>>> X = MultipleArray(low_sig, None)
>>> gscv.fit(X)
>>> print(gscv.cv_results_)
__init__(self, fs, low_fq, max_low_fq, low_fq_width=1.0, fill=2, whitening='after', ordar=10, normalize=False, extract_complex=True, random_state=None, enf=50.0)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, fs, low_fq, max_low_fq[, …])

Initialize self.

fit(self, X[, y])

No fit is needed

fit_transform(self, X[, y])

Fit to data, then transform it.

get_params(self[, deep])

Get parameters for this estimator.

set_params(self, \*\*params)

Set the parameters of this estimator.

transform(self, X[, y])

Parameters

Examples using pactools.ExtractDriver