CoolFace
Apppublic

Aluode/PerceptionLabPortable

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
transformer.cpython-310.pyc575 linesDownload Raw Back to __pycache__
1o

2'�Yi{�@sZddlZddlmZmZmZmZddlmZm	Z	ddl3mZddlm
Z
ddlmZmZmZmZddlmZdd	lmZdd4lmZddlmZddlmZmZmZmZd
dl m!Z!Gdd�de�Z"Gdd�d�Z#dd�Z$eGdd�de"e��Z%Gdd�de"e�Z&eGdd�de"e��Z'eGdd�de"e��Z(Gdd�de"e�Z)eGdd �d e"e��Z*dS)!�N)�
BaseEstimator�TransformerMixin�check_array�clone)�RobustScaler�StandardScaler)�	check_X_y)�check_is_fitted�)�_pick_data_channels�_picks_by_type�
_picks_to_idx�	pick_info)�_check_scalings_user)�5BaseEpochs)�filter_data)�psd_array_multitaper)�
_check_option�_validate_type�
check_version�fill_doc�)�
validate_datac@s(eZdZdZddddddd�dd�ZdS)�MNETransformerMixinz#TransformerMixin plus some helpers.NTF)�y�6atleast_3d�fit�return_y�multi_output�check_n_featuresc	Cs�t|t�r|jdd�}ttjddd�}tdd�rd|d<t|d	�rF|rF|dur5t||fi|�d7|i��}n+t|||fi|�d8|i��\}}n|durSt	|fi|��}n
t9d
|||d�|��\}}|rh|jd|_|rot�
|�}|ru||fS|S)NF)�copyT�C)ZdtypeZallow_nd�orderZsklearnz1.4Zforce_writeable�n_features_in_�reset)�Xrrr�)�10isinstancer�get_data�dict�npZfloat64r�hasattrrrr�shaper#r)	�self�epochs_datarrrrrr�kwargsr&r&��E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\mne/decoding/transformer.py�_check_datasH1112��13�����14�15zMNETransformerMixin._check_data)�__name__�16__module__�__qualname__�__doc__r1r&r&r&r0rs�rc@s@eZdZdZddd�Zddd�Zdd	�Zdd17d�Zddd
�ZdS)�_ConstantScalerz*Scale channel types using constant values.TcCs||_||_||_dS�N)�	_scalings�_info�_do_scaling)r-�info�scalingsZ18do_scalingr&r&r0�__init__Ps19z_ConstantScaler.__init__NcCs�t|j�}tt|jt|jdd���}t�tdd�|D���}|j	dt20|�kr6tdt21|��dt22|��d���|jrH|D]\}}d	||||<q;||_
t�|�|_|S)23Nr&)�excludecss�|]	}t|d�VqdS)rN)�len)�.0�pr&r&r0�	<genexpr>Zs�z&_ConstantScaler.fit.<locals>.<genexpr>rz	info had z data channels but X has z	 channels��?)rr8rrr9rr*Zones�sumr,r?�24ValueErrorr:�std_Z25zeros_likeZmean_)r-r%rr<Z
picks_by_typeZstd�kind�picksr&r&r0rUs26��z_ConstantScaler.fitcCs27||jSr7�rF�r-r%r&r&r0�	transformf�28z_ConstantScaler.transformcCs29||jSr7rI�r-r%rr&r&r0�inverse_transformirLz!_ConstantScaler.inverse_transformcC�|�||��|�Sr7�rrKrMr&r&r0�
fit_transformlsz_ConstantScaler.fit_transform)Tr7)	r2r3r4r5r=rrKrNrQr&r&r&r0r6Ms303132r6cOs�t|tjd�|jdkr|r|��SdS|j}t�|�ddd�d|df�}||g|�Ri|��}|rH|d|d|df|_|�ddd�}|SdS)z"Reshape epochs and apply function.r%rNr33r�����)rr*Zndarray�sizer r,�reshape�	transpose)�funcZ
return_resultr%�argsr/Z34orig_shaper&r&r0�_sklearn_reshape_applyps35�rXc@s>eZdZdZddd�Zddd�Zdd	�Zdd36d�Zdd
�ZdS)�Scaleru�Standardize channel data.37 38    This class scales data for each channel. It differs from scikit-learn39    classes (e.g., :class:`sklearn.preprocessing.StandardScaler`) in that40    it scales each *channel* by estimating μ and σ using data from all41    time points and epochs, as opposed to standardizing each *feature*42    (i.e., each time point for each channel) by estimating using μ and σ43    using data from all epochs.44 45    Parameters46    ----------47    %(info)s Only necessary if ``scalings`` is a dict or None.48    scalings : dict, str, default None49        Scaling method to be applied to data channel wise.50 51        * if scalings is None (default), scales mag by 1e15, grad by 1e13,52          and eeg by 1e6.53        * if scalings is :class:`dict`, keys are channel types and values54          are scale factors.55        * if ``scalings=='median'``,56          :class:`sklearn.preprocessing.RobustScaler`57          is used (requires sklearn version 0.17+).58        * if ``scalings=='mean'``,59          :class:`sklearn.preprocessing.StandardScaler`60          is used.61 62    with_mean : bool, default True63        If True, center the data using mean (or median) before scaling.64        Ignored for channel-type scaling.65    with_std : bool, default True66        If True, scale the data to unit variance (``scalings='mean'``),67        quantile range (``scalings='median``), or using channel type68        if ``scalings`` is a dict or None).69    NTcCs||_||_||_||_dSr7)r;�	with_mean�with_stdr<)r-r;r<rZr[r&r&r0r=�s70zScaler.__init__cCs�|j||ddd�}|jdksJ|j��t|jtttd�fd�t|jt�r0t	d|jddgdd	�|jdus;t|jt�rU|j71durJtd72t|j�����t|j73|j|j
�|_n|jdkrdt|j|j
d�|_n	t|j|j
d�|_t|jjd
||d�|S)asStandardize data across channels.74 75        Parameters76        ----------77        epochs_data : array, shape (n_epochs, n_channels, n_times)78            The data to concatenate channels.79        y : array, shape (n_epochs,)80            The label for each epoch.81 82        Returns83        -------84        self : instance of Scaler85            The modified instance.86        T)rrr�Nr<�meanZmedianzwhen str)�extraz&Need to specify "info" if scalings is )rZr[)Zwith_centeringZwith_scalingF)r)r1�ndimr,rr<r)�str�typer'rr;rEr6r[�scaler_rrZrrXr�r-r.rr&r&r0r�s,�87�8889��z90Scaler.fitcCszt|d�|j|dd�}|jdkr+|jdur$t|jd�|jdks$J�|dtjf}|jd	ks5J|j��t|j	j91d92|�S)a�Standardize data across channels.93 94        Parameters95        ----------96        epochs_data : array, shape (n_epochs, n_channels[, n_times])97            The data.98 99        Returns100        -------101        X : array, shape (n_epochs, n_channels, n_times)102            The data concatenated over channels.103 104        Notes105        -----106        This function makes a copy of the data before the operations and the107        memory usage may be large with big data.108        rbF�rr109NZch_namesr.r\T)r	r1r_r;r?r,r*�newaxisrXrbrK�r-r.r&r&r0rK�s110111112zScaler.transformcCrO)a�Fit to data, then transform it.113 114        Fits transformer to epochs_data and y and returns a transformed version115        of epochs_data.116 117        Parameters118        ----------119        epochs_data : array, shape (n_epochs, n_channels, n_times)120            The data.121        y : None | array, shape (n_epochs,)122            The label for each epoch.123            Defaults to None.124 125        Returns126        -------127        X : array, shape (n_epochs, n_channels, n_times)128            The data concatenated over channels.129 130        Notes131        -----132        This function makes a copy of the data before the operations and the133        memory usage may be large with big data.134        rPrcr&r&r0rQ�szScaler.fit_transformcCsb|j|dd�}d}|jdkrd}|dtjf}|jdks!J|j��t|jjd|�}|r/|d}|S)a�Invert standardization of data across channels.135 136        Parameters137        ----------138        epochs_data : array, shape ([n_epochs, ]n_channels, n_times)139            The data.140 141        Returns142        -------143        X : array, shape (n_epochs, n_channels, n_times)144            The data concatenated over channels.145 146        Notes147        -----148        This function makes a copy of the data before the operations and the149        memory usage may be large with big data.150        Frdr151T.r\).r)r1r_r*rer,rXrbrN)r-r.Zsqueeze�outr&r&r0rNs152zScaler.inverse_transform)NNTTr7)	r2r3r4r5r=rrKrQrNr&r&r&r0rY~s153#154)155rYc@s4eZdZdZddd�Zdd�Zddd�Zd	d156�ZdS)�157Vectorizera]Transform n-dimensional array into 2D array of n_samples by n_features.158 159    This class reshapes an n-dimensional array into an n_samples * n_features160    array, usable by the estimators and transformers of scikit-learn.161 162    Attributes163    ----------164    features_shape_ : tuple165         Stores the original shape of data.166 167    Examples168    --------169    >>> from sklearn.linear_model import LogisticRegression170    >>> from sklearn.pipeline import make_pipeline171    >>> from sklearn.preprocessing import StandardScaler172    >>> clf = make_pipeline(Vectorizer(), StandardScaler(), LogisticRegression())173    NcCs(|j||dddd�}|jdd�|_|S)aGStore the shape of the features of X.174 175        Parameters176        ----------177        X : array-like178            The data to fit. Can be, for example a list, or an array of at179            least 2d. The first dimension must be of length n_samples, where180            samples are the independent samples used by the estimator181            (e.g. n_epochs for epoched data).182        y : None | array, shape (n_samples,)183            Used for scikit-learn compatibility.184 185        Returns186        -------187        self : instance of Vectorizer188            Return the modified instance.189        FT)rrrrrN)r1r,�features_shape_rMr&r&r0r9szVectorizer.fitcCs:|j|dd�}|jdd�|jkrtd��|�t|�d�S)a�Convert given array into two dimensions.190 191        Parameters192        ----------193        X : array-like194            The data to fit. Can be, for example a list, or an array of at195            least 2d. The first dimension must be of length n_samples, where196            samples are the independent samples used by the estimator197            (e.g. n_epochs for epoched data).198 199        Returns200        -------201        X : array, shape (n_samples, n_features)202            The transformed data.203        FrdrNz1Shape of X used in fit and transform must be samerR)r1r,rirErTr?rJr&r&r0rKOszVectorizer.transformcC�|�|��|�S)aFFit the data, then transform in one step.204 205        Parameters206        ----------207        X : array-like208            The data to fit. Can be, for example a list, or an array of at209            least 2d. The first dimension must be of length n_samples, where210            samples are the independent samples used by the estimator211            (e.g. n_epochs for epoched data).212        y : None | array, shape (n_samples,)213            Used for scikit-learn compatibility.214 215        Returns216        -------217        X : array, shape (n_samples, -1)218            The transformed data.219        rPrMr&r&r0rQdszVectorizer.fit_transformcCsD|j|ddd�}|jdvrtd|j����|�|jdd�|j�S)a~Transform 2D data back to its original feature shape.220 221        Parameters222        ----------223        X : array-like, shape (n_samples,  n_features)224            Data to be transformed back to original shape.225 226        Returns227        -------228        X : array229            The data transformed into shape as used in fit. The first230            dimension is of length n_samples.231        F)rr)r232r\z/X should be of 2 or 3 dimensions but has shape NrR)r1r_rEr,rTrirJr&r&r0rNxs233234�zVectorizer.inverse_transformr7)r2r3r4r5rrKrQrNr&r&r&r0rh&s235236rhcsTeZdZdZdejdejdddddfdd	�Z�fd237d�Zddd
�Z	dd�Z238�ZS)�PSDEstimatorajCompute power spectral density (PSD) using a multi-taper method.239 240    Parameters241    ----------242    sfreq : float243        The sampling frequency.244    fmin : float245        The lower frequency of interest.246    fmax : float247        The upper frequency of interest.248    bandwidth : float249        The bandwidth of the multi taper windowing function in Hz.250    adaptive : bool251        Use adaptive weights to combine the tapered spectra into PSD252        (slow, use n_jobs >> 1 to speed up computation).253    low_bias : bool254        Only use tapers with more than 90%% spectral concentration within255        bandwidth.256    n_jobs : int257        Number of parallel jobs to use (only used if adaptive=True).258    %(normalization)s259 260    See Also261    --------262    mne.time_frequency.psd_array_multitaper263    mne.io.Raw.compute_psd264    mne.Epochs.compute_psd265    mne.Evoked.compute_psd266    r267rNFT�lengthc		Cs4||_||_||_||_||_||_||_||_dSr7)�sfreq�fmin�fmax�	bandwidth�adaptive�low_bias�n_jobs�
normalization)	r-rmrnrorprqrrrsrtr&r&r0r=�s268zPSDEstimator.__init__c�t���}d|j_d|_|S�z...F��super�__sklearn_tags__Ztarget_tags�requiredZrequires_fit�r-�tags��	__class__r&r0ry��269zPSDEstimator.__sklearn_tags__cCs|j||dd�d|_|S)a�Compute power spectral density (PSD) using a multi-taper method.270 271        Parameters272        ----------273        epochs_data : array, shape (n_epochs, n_channels, n_times)274            The data.275        y : array, shape (n_epochs,)276            The label for each epoch.277 278        Returns279        -------280        self : instance of PSDEstimator281            The modified instance.282        T�rr)r1�fitted_rcr&r&r0r�szPSDEstimator.fitcCs<|�|�}t||j|j|j|j|j|j|j|j	d�	\}}|S)aFCompute power spectral density (PSD) using a multi-taper method.283 284        Parameters285        ----------286        epochs_data : array, shape (n_epochs, n_channels, n_times)287            The data.288 289        Returns290        -------291        psd : array, shape (n_signals, n_freqs) or (n_freqs,)292            The computed PSD.293        )rmrnrorprqrrrtrs)294r1rrmrnrorprqrrrtrs)r-r.Zpsd�_r&r&r0rK�s295
296�zPSDEstimator.transformr7)r2r3r4r5r*�pi�infr=ryrrK�
__classcell__r&r&r}r0rk�s 297�298rkc@s:eZdZdZ								ddd�Zdd	�Zd299d�ZdS)
�FilterEstimatoraEstimator to filter RtEpochs.300 301    Applies a zero-phase low-pass, high-pass, band-pass, or band-stop302    filter to the channels selected by "picks".303 304    l_freq and h_freq are the frequencies below which and above which,305    respectively, to filter out of the data. Thus the uses are:306 307        - l_freq < h_freq: band-pass filter308        - l_freq > h_freq: band-stop filter309        - l_freq is not None, h_freq is None: low-pass filter310        - l_freq is None, h_freq is not None: high-pass filter311 312    If n_jobs > 1, more memory is required as "len(picks) * n_times"313    additional time points need to be temporarily stored in memory.314 315    Parameters316    ----------317    %(info_not_none)s318    %(l_freq)s319    %(h_freq)s320    %(picks_good_data)s321    %(filter_length)s322    %(l_trans_bandwidth)s323    %(h_trans_bandwidth)s324    n_jobs : int | str325        Number of jobs to run in parallel.326        Can be 'cuda' if ``cupy`` is installed properly and method='fir'.327    method : str328        'fir' will use overlap-add FIR filtering, 'iir' will use IIR filtering.329    iir_params : dict | None330        Dictionary of parameters to use for IIR filtering.331        See mne.filter.construct_iir_filter for details. If iir_params332        is None and method="iir", 4th order Butterworth will be used.333    %(fir_design)s334 335    See Also336    --------337    TemporalFilter338 339    Notes340    -----341    This is primarily meant for use in realtime applications.342    In general it is not recommended in a normal processing pipeline as it may result343    in edge artifacts. Use with caution.344    N�auto�fir�firwincC�F||_||_||_||_||_||_||_||_|	|_|345|_	||_346dSr7)r;�l_freq�h_freqrH�
filter_length�l_trans_bandwidth�h_trans_bandwidthrs�method�347iir_params�348fir_design)r-r;r�r�rHr�r�r�rsr�r�r�r&r&r0r=)�349zFilterEstimator.__init__cCst|j|j�|_|j||dd�|jdkrd|_|jddus7|jdurR|jdus/|j|jkrR|j|jdkrR|j���|j|jd<Wd�n1sMwY|jddusq|jdur�|jdusi|j|jkr�|j|jdkr�|j���|j|jd<Wd�|S1s�wY|S)aOFilter data.350 351        Parameters352        ----------353        epochs_data : array, shape (n_epochs, n_channels, n_times)354            The data.355        y : array, shape (n_epochs,)356            The label for each epoch.357 358        Returns359        -------360        self : instance of FilterEstimator361            The modified instance.362        Tr�rNZlowpassZhighpass)r
r;rH�picks_r1r�r�Z_unlockrcr&r&r0rCs*363364�365366��zFilterEstimator.fitcCsDt|�|�|jd|j|j|j|j|j|j|j	|j367|jd|jdd�S)aFilter data.368 369        Parameters370        ----------371        epochs_data : array, shape (n_epochs, n_channels, n_times)372            The data.373 374        Returns375        -------376        X : array, shape (n_epochs, n_channels, n_times)377            The data after filtering.378        rmF)r�r�rsr r��verbose)
rr1r;r�r�r�r�r�r�r�r�rsr�rfr&r&r0rKjs 
�zFilterEstimator.transform)Nr�r�r�Nr�Nr�)r2r3r4r5r=rrKr&r&r&r0r��s4379�'r�c@sFeZdZdZddd�Zddd�Zddd	�Zd380d�Zdd
�Zdd�Z	dS)�UnsupervisedSpatialFilteraLUse unsupervised spatial filtering across time and samples.381 382    Parameters383    ----------384    estimator : instance of sklearn.base.BaseEstimator385        Estimator using some decomposition algorithm.386    average : bool, default False387        If True, the estimator is fitted on the average across samples388        (e.g. epochs).389    FcCs||_||_dSr7)�	estimator�average)r-r�r�r&r&r0r=�s390z"UnsupervisedSpatialFilter.__init__NcCs�dD]}t|j|�std|�d���qt|jtd�|j||dd�}|jr.tj|dd�j	}n|j391\}}}t�|d	��|||f�j	}t
|j�|_|j�|�|S)392a�Fit the spatial filters.393 394        Parameters395        ----------396        X : array, shape (n_epochs, n_channels, n_times)397            The data to be filtered.398        y : None | array, shape (n_samples,)399            Used for scikit-learn compatibility.400 401        Returns402        -------403        self : instance of UnsupervisedSpatialFilter404            Return the modified instance.405        )rrKrQz6estimator must be a scikit-learn transformer, missing z methodr�Tr�r)Zaxis�rrr406)r+r�rErr��boolr1r*r]�Tr,rUrTr�407estimator_r)r-r%r�attr�n_epochs�408n_channels�n_timesr&r&r0r�s"���zUnsupervisedSpatialFilter.fitcCrj)a�Transform the data to its filtered components after fitting.409 410        Parameters411        ----------412        X : array, shape (n_epochs, n_channels, n_times)413            The data to be filtered.414        y : None | array, shape (n_samples,)415            Used for scikit-learn compatibility.416 417        Returns418        -------419        X : array, shape (n_epochs, n_channels, n_times)420            The transformed data.421        rPrMr&r&r0rQ�sz'UnsupervisedSpatialFilter.fit_transformcCs t|j�|�|�}|�|d�S)a4Transform the data to its spatial filters.422 423        Parameters424        ----------425        X : array, shape (n_epochs, n_channels, n_times)426            The data to be filtered.427 428        Returns429        -------430        X : array, shape (n_epochs, n_channels, n_times)431            The transformed data.432        rK)r	r�r1�
_apply_methodrJr&r&r0rK�s433
434z#UnsupervisedSpatialFilter.transformcCs|�|d�S)a=Inverse transform the data to its original space.435 436        Parameters437        ----------438        X : array, shape (n_epochs, n_components, n_times)439            The data to be inverted.440 441        Returns442        -------443        X : array, shape (n_epochs, n_channels, n_times)444            The transformed data.445        rN)r�rJr&r&r0rN�s
z+UnsupervisedSpatialFilter.inverse_transformcCsh|j\}}}t�|gd��}t�||||g�j}t|j|�}||�}t�|jd||g��gd��}|S)aBVectorize time samples as trials, apply method and reshape back.446 447        Parameters448        ----------449        X : array, shape (n_epochs, n_dims, n_times)450            The data to be inverted.451 452        Returns453        -------454        X : array, shape (n_epochs, n_dims, n_times)455            The transformed data.456        r�rR)r,r*rUrTr��getattrr�)r-r%r�r�r�r�r&r&r0r��s
z'UnsupervisedSpatialFilter._apply_method)Fr7)457r2r3r4r5r=rrQrKrNr�r&r&r&r0r��s458459460$r�csReZdZdZ											ddd	�Z�fd461d�Zddd
�Zdd�Z�ZS)�TemporalFiltera�Estimator to filter data array along the last dimension.462 463    Applies a zero-phase low-pass, high-pass, band-pass, or band-stop464    filter to the channels.465 466    l_freq and h_freq are the frequencies below which and above which,467    respectively, to filter out of the data. Thus the uses are:468 469        - l_freq < h_freq: band-pass filter470        - l_freq > h_freq: band-stop filter471        - l_freq is not None, h_freq is None: low-pass filter472        - l_freq is None, h_freq is not None: high-pass filter473 474    See :func:`mne.filter.filter_data`.475 476    Parameters477    ----------478    l_freq : float | None479        Low cut-off frequency in Hz. If None the data are only low-passed.480    h_freq : float | None481        High cut-off frequency in Hz. If None the data are only482        high-passed.483    sfreq : float, default 1.0484        Sampling frequency in Hz.485    filter_length : str | int, default 'auto'486        Length of the FIR filter to use (if applicable):487 488            * int: specified length in samples.489            * 'auto' (default in 0.14): the filter length is chosen based490              on the size of the transition regions (7 times the reciprocal491              of the shortest transition band).492            * str: (default in 0.13 is "10s") a human-readable time in493              units of "s" or "ms" (e.g., "10s" or "5500ms") will be494              converted to that number of samples if ``phase="zero"``, or495              the shortest power-of-two length at least that duration for496              ``phase="zero-double"``.497 498    l_trans_bandwidth : float | str499        Width of the transition band at the low cut-off frequency in Hz500        (high pass or cutoff 1 in bandpass). Can be "auto"501        (default in 0.14) to use a multiple of ``l_freq``::502 503            min(max(l_freq * 0.25, 2), l_freq)504 505        Only used for ``method='fir'``.506    h_trans_bandwidth : float | str507        Width of the transition band at the high cut-off frequency in Hz508        (low pass or cutoff 2 in bandpass). Can be "auto"509        (default in 0.14) to use a multiple of ``h_freq``::510 511            min(max(h_freq * 0.25, 2.), info['sfreq'] / 2. - h_freq)512 513        Only used for ``method='fir'``.514    n_jobs : int | str, default 1515        Number of jobs to run in parallel.516        Can be 'cuda' if ``cupy`` is installed properly and method='fir'.517    method : str, default 'fir'518        'fir' will use overlap-add FIR filtering, 'iir' will use IIR519        forward-backward filtering (via filtfilt).520    iir_params : dict | None, default None521        Dictionary of parameters to use for IIR filtering.522        See mne.filter.construct_iir_filter for details. If iir_params523        is None and method="iir", 4th order Butterworth will be used.524    fir_window : str, default 'hamming'525        The window to use in FIR design, can be "hamming", "hann",526        or "blackman".527    fir_design : str528        Can be "firwin" (default) to use :func:`scipy.signal.firwin`,529        or "firwin2" to use :func:`scipy.signal.firwin2`. "firwin" uses530        a time-domain design technique that generally gives improved531        attenuation using fewer samples than "firwin2".532 533        .. versionadded:: 0.15534 535    See Also536    --------537    FilterEstimator538    Vectorizer539    mne.filter.filter_data540    NrCr�r��hammingr�cCr�r7)r�r�rmr�r�r�rsr�r��541fir_windowr�)r-r�r�rmr�r�r�rsr�r�r�r�r&r&r0r=Zr�zTemporalFilter.__init__crurvrwr{r}r&r0rytrzTemporalFilter.__sklearn_tags__cCsd|_|j||ddd�|S)a�Do nothing (for scikit-learn compatibility purposes).542 543        Parameters544        ----------545        X : array, shape ([n_epochs, ]n_channels, n_times)546            The data to be filtered over the last dimension. The channels547            dimension can be zero when passing a 2D array.548        y : None549            Not used, for scikit-learn compatibility issues.550 551        Returns552        -------553        self : instance of TemporalFilter554            The modified instance.555        TF)rrr)r�r1rMr&r&r0r{szTemporalFilter.fitcCs�|j|dd�}t�|�}|jdkrtd|j�d���|j}|�d|d�}t||j|j	|j556|j|j|j
|j|j|jd|j|jd�
}|�|�S)anFilter data along the last dimension.557 558        Parameters559        ----------560        X : array, shape ([n_epochs, ]n_channels, n_times)561            The data to be filtered over the last dimension. The channels562            dimension can be zero when passing a 2D array.563 564        Returns565        -------566        X : array567            The data after filtering.568        Frdr\z1Array must be of at max 3 dimensions instead got z dimensional matrixrR)	r�r�r�rsr�r�r r�r�)r1r*Z569atleast_2dr_rEr,rTrrmr�r�r�r�r�rsr�r�r�r�)r-r%r,r&r&r0rK�s4570571���572zTemporalFilter.transform)NNrCr�r�r�Nr�Nr�r�r7)	r2r3r4r5r=ryrrKr�r&r&r}r0r�s"S573�574r�)+�numpyr*Zsklearn.baserrrrZsklearn.preprocessingrrZ
sklearn.utilsrZsklearn.utils.validationr	Z575_fiff.pickrrr
rZcovrZepochsr�filterrZtime_frequencyr�utilsrrrrZ_fixesrrr6rXrYrhrkr�r�r�r&r&r&r0�<module>s64#(hi~
Aluode/PerceptionLabPortable · CoolFace