U
    f»{j‚Ý  ã                   @   sª  d dl mZ d dlZddlmZmZmZ ddlm	Z	m
Z
mZ ddlmZmZ ddlmZmZmZ ddlmZmZmZ dd	lmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z* dd
l+m,Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7 ddl8m9Z9 ddl:m;Z; ddl<m=Z= ddl>m?Z?m@Z@mAZA ddlBmCZCmDZDmEZEmFZFmGZGmHZH ddlImJZJ ddlKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZT ddlUmVZVmWZW ddlXmYZY e7jZe7j[e7j\e7j]e7j^e7j_e7j`e7jae7jbe7jce7jddœZedd„ ee f¡ D ƒZge G dd„ deJeCe	e
eee*eƒ
ƒZhe G dd„ dehƒƒZid9dd „Zjd!d"„ Zkd#d$„ Zld%d&„ Zmd'd(„ Zned:d+d,„ƒZod;d-d.„Zped/ddd0œd1d2„ƒZqd<d/dd3œd4d5„Zrd=d7d8„ZsdS )>é    ©ÚdeepcopyNé   )ÚrescaleÚ_log_rescaleÚ_check_baseline)ÚUpdateChannelsMixinÚSetChannelsMixinÚInterpolationMixin)Ú_merge_ch_dataÚ_pair_grad_sensors)Ú_INTERPOLATION_DEFAULTÚ_EXTRAPOLATE_DEFAULTÚ_BORDER_DEFAULT)ÚdetrendÚFilterMixinÚ
_check_fun)Úcheck_fnameÚloggerÚverboseÚwarnÚ
sizeof_fmtÚ	SizeMixinÚcopy_function_doc_to_method_docÚ_validate_typeÚfill_docÚ_check_optionÚ_build_data_frameÚ_check_pandas_installedÚ_check_pandas_index_argumentsÚ_convert_timesÚ_scale_dataframe_dataÚ_check_time_formatÚ_check_preloadÚ_check_fnameÚ	TimeMixin)Úplot_evokedÚplot_evoked_topomapÚplot_evoked_fieldÚplot_evoked_imageÚplot_evoked_topo)Úplot_evoked_whiteÚplot_evoked_joint©Ú_topomap_animation)ÚFIFF)Ú	fiff_open)Úread_tag)Údir_tree_find)Ú
pick_typesÚ_picks_to_idxÚ_FNIRS_CH_TYPES_SPLIT)ÚContainsMixinÚread_meas_infoÚwrite_meas_infoÚ_read_extended_ch_infoÚ_rename_listÚ_ensure_infos_match)Ú	ProjMixin)	Ústart_and_end_fileÚstart_blockÚ	end_blockÚ	write_intÚwrite_stringÚwrite_float_matrixÚwrite_idÚwrite_floatÚwrite_complex_float_matrix)Ú_check_maxshieldÚ_get_ch_factors)Úparallel_func)ÚaverageZstandard_errorZsingle_epochZpartial_averageZalternating_subaverageZsample_cut_out_by_graphZpower_density_spectrumZdipole_amplitude_cuvreZsquid_modulation_lower_boundZsquid_modulation_upper_boundZsquid_gate_settingc                 C   s   i | ]\}}||“qS © rJ   )Ú.0ÚkeyÚvalrJ   rJ   úI/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/evoked.pyÚ
<dictcomp><   s      rO   c                   @   s  e Zd ZdZedWddœdd„ƒZed	d
„ ƒZejdd
„ ƒZedd„ ƒZ	e	jdd„ ƒZ	e
dXdd„ƒZedYdd„ƒZedZddœdd„ƒZedddœdd„ƒZed[dddœdd„ƒZdd„ Zedd„ ƒZeeƒd\ddd$œd%d&„ƒZeeƒd]d*d+„ƒZeeƒdd,dd-ddddd.gddddd/dd dfd0d1„ƒZeeƒdddddddddd2d3d4d#dddddddd5d6eddeded3dfd7d8„ƒZeeƒd^d;dd<œd=d>„ƒZee ƒd_d?d@„ƒZ!ee"ƒd`dCdD„ƒZ#e
daeeddEœdFdG„ƒZ$dbdJdK„Z%e
dcdLdM„ƒZ&dNdO„ Z'dPdQ„ Z(dddSdT„Z)ededdœdUdV„ƒZ*dS )fÚEvokedaÃ  Evoked data.

    Parameters
    ----------
    fname : str
        Name of evoked/average FIF file to load.
        If None no data is loaded.
    condition : int, or str
        Dataset ID number (int) or comment/name (str). Optional if there is
        only one data set in file.
    proj : bool, optional
        Apply SSP projection vectors.
    kind : str
        Either 'average' or 'standard_error'. The type of data to read.
        Only used if 'condition' is a str.
    allow_maxshield : bool | str (default False)
        If True, allow loading of data that has been recorded with internal
        active compensation (MaxShield). Data recorded with MaxShield should
        generally not be loaded directly, but should first be processed using
        SSS/tSSS to remove the compensation signals that may also affect brain
        activity. Can also be "yes" to load without eliciting a warning.
    %(verbose)s

    Attributes
    ----------
    %(info_not_none)s
    ch_names : list of str
        List of channels' names.
    nave : int
        Number of averaged epochs.
    kind : str
        Type of data, either average or standard_error.
    comment : str
        Comment on dataset. Can be the condition.
    data : array of shape (n_channels, n_times)
        Evoked response.
    first : int
        First time sample.
    last : int
        Last time sample.
    tmin : float
        The first time point in seconds.
    tmax : float
        The last time point in seconds.
    times :  array
        Time vector in seconds. Goes from ``tmin`` to ``tmax``. Time interval
        between consecutive time samples is equal to the inverse of the
        sampling frequency.
    baseline : None | tuple of length 2
         This attribute reflects whether the data has been baseline-corrected
         (it will be a ``tuple`` then) or not (it will be ``None``).

    Notes
    -----
    Evoked objects can only contain the average of a single set of conditions.
    NTrI   F©r   c                C   s‚   t |tdƒ t|ddd�}t||||ƒ\| _| _| _| _}| _| _	|  
|¡ | j ¡ | _d| _|  ¡  d| _|rx|  ¡  || _d S )Nz'proj'TÚread)ÚfnameÚ
must_existÚ	overwriter   )r   Úboolr$   Ú_read_evokedÚinfoÚnaveÚ_aspect_kindÚcommentÚdataÚbaselineÚ
_set_timesÚtimesÚcopyÚ
_raw_timesÚ_decimZ_update_first_lastÚpreloadZ
apply_projÚfilename)ÚselfrS   Ú	conditionÚprojÚkindÚallow_maxshieldr   r_   rJ   rJ   rN   Ú__init__{   s     ÿÿ 
zEvoked.__init__c                 C   s
   t | j S )zThe data kind.)Ú_aspect_revrZ   ©re   rJ   rJ   rN   rh   �   s    zEvoked.kindc                 C   s"   t d|tt ¡ ƒƒ t| | _d S )Nrh   )r   ÚlistÚ_aspect_dictÚkeysrZ   )re   rh   rJ   rJ   rN   rh   •   s    c                 C   s   | j S )zThe data matrix.©Ú_datarl   rJ   rJ   rN   r\   š   s    zEvoked.datac                 C   s
   || _ dS )zSet the data matrix.Nrp   )re   r\   rJ   rJ   rN   r\   Ÿ   s    c           	      C   sb   t | j|ddd�}|  ||¡\}}| j|||…f }|dk	r^t| ||ƒ}||dd…tjf 9 }|S )aÂ  Get evoked data as 2D array.

        Parameters
        ----------
        %(picks_all)s
        %(units)s
        tmin : float | None
            Start time of data to get in seconds.
        tmax : float | None
            End time of data to get in seconds.

        Returns
        -------
        data : ndarray, shape (n_channels, n_times)
            A view on evoked data.

        Notes
        -----
        .. versionadded:: 0.24
        ÚallrJ   ©ÚexcludeN)r4   rX   Z_handle_tmin_tmaxr\   rG   ÚnpÚnewaxis)	re   ÚpicksÚunitsÚtminÚtmaxÚstartÚstopr\   Z
ch_factorsrJ   rJ   rN   Úget_data¤   s    zEvoked.get_datac                    sú   t | dƒ t| j|ddd�}tˆƒs,tdƒ‚| j‰ |dk	rT|| jjkrT| j |¡| _td| jj	dgƒ t
t|ƒ\}‰}|d	kr²|D ],}tˆˆ |dd…f fˆŽ| j|dd…f< q‚nD|‡ ‡‡‡fd
d„|D ƒƒ}	t|ƒD ]\}
}|	|
 | j|dd…f< qÖ| S )a�  Apply a function to a subset of channels.

        %(applyfun_summary_evoked)s

        Parameters
        ----------
        %(fun_applyfun_evoked)s
        %(picks_all_data_noref)s
        %(dtype_applyfun)s
        %(n_jobs)s
        %(verbose)s
        %(kwargs_fun)s

        Returns
        -------
        self : instance of Evoked
            The evoked object with transformed data.
        zevoked.apply_functionrJ   F)rt   Zwith_ref_megzfun needs to be a functionNzevoked.ndimé   r   c                 3   s(   | ] }ˆˆˆ |d d …f fˆŽV  qd S ©NrJ   )rK   Úp©Zdata_inÚfunÚkwargsZp_funrJ   rN   Ú	<genexpr>ï   s   ÿ ÿÿz(Evoked.apply_function.<locals>.<genexpr>)r#   r4   rX   ÚcallableÚ
ValueErrorrq   ÚdtypeÚastyper   ÚndimrH   r   Ú	enumerate)re   r‚   rw   r‡   Ún_jobsr   rƒ   ÚparallelÚidxZdata_picks_newÚppr€   rJ   r�   rN   Úapply_functionÆ   s$    
,ÿzEvoked.apply_function©Nr   c                C   sj   t || j| jd d�}| jdk	r2|dkr2tdƒ‚n4|dkrJt tdƒ¡ nt| j| j|dd�| _|| _| S )aÔ  Baseline correct evoked data.

        Parameters
        ----------
        %(baseline_evoked)s
            Defaults to ``(None, 0)``, i.e. beginning of the the data until
            time point zero.
        %(verbose)s

        Returns
        -------
        evoked : instance of Evoked
            The baseline-corrected Evoked object.

        Notes
        -----
        Baseline correction can be done multiple times.

        .. versionadded:: 0.13.0
        Úsfreq)r_   r‘   NzYThe data has already been baseline-corrected. Cannot remove existing baseline correction.F)r`   )	r   r_   rX   r]   r†   r   r   r   r\   )re   r]   r   rJ   rJ   rN   Úapply_baselineö   s    ÿ
zEvoked.apply_baseline©rU   r   c                C   s   t || |d� dS )a'  Save evoked data to a file.

        Parameters
        ----------
        fname : str
            The name of the file, which should end with ``-ave.fif(.gz)`` or
            ``_ave.fif(.gz)``.
        %(overwrite)s
        %(verbose)s

        Notes
        -----
        To write multiple conditions into a single file, use
        `mne.write_evokeds`.

        .. versionchanged:: 0.23
            Information on baseline correction will be stored with the data,
            and will be restored when reading again via `mne.read_evokeds`.
        )rU   N)Úwrite_evokeds)re   rS   rU   r   rJ   rJ   rN   Úsave  s    zEvoked.saveÚautoc                C   s"   ddl m} ||| |||d� dS )ag  Export Evoked to external formats.

        %(export_fmt_support_evoked)s

        %(export_warning)s

        Parameters
        ----------
        %(fname_export_params)s
        %(export_fmt_params_evoked)s
        %(overwrite)s
        %(verbose)s

        Notes
        -----
        .. versionadded:: 1.1

        %(export_warning_note_evoked)s
        r   )Úexport_evokedsr“   N)Úexportr—   )re   rS   ÚfmtrU   r   r—   rJ   rJ   rN   r˜   2  s    zEvoked.exportc                 C   sö   d}t | jƒ|kr*| jd |… }|d7 }n| j}d|| j| jf }|d| jd | jd f 7 }|d7 }| jd krz|d7 }nL|| jd d	›d
| jd d	›d�7 }| jt| j| j| jd dd�krÆ|d7 }|d| jj	d  7 }|dt
| jƒf 7 }d| S )Néè  z...z'%s' (%s, N=%s)u   , %0.5g â€“ %0.5g secr   éÿÿÿÿz, baseline ÚoffÚgu    â€“ r   z secr‘   Úadjust)r_   r‘   Zon_baseline_outside_dataz8 (baseline period was cropped after baseline correction)z, %s chz, ~%sz<Evoked | %s>)Úlenr[   rh   rY   r_   r]   r   rX   r\   Úshaper   Ú_size)re   Zmax_comment_lengthr[   ÚsrJ   rJ   rN   Ú__repr__J  s*    


$  þzEvoked.__repr__c                 C   s
   | j d S )zChannel names.Úch_names©rX   rl   rJ   rJ   rN   r¤   `  s    zEvoked.ch_namesÚbadsÚtightÚunsortedr¢   )Ú	highlightr   c                C   s6   t | |||||||||	|
||||||||||||d�S )N)rw   rt   ÚunitÚshowÚylimrg   ÚxlimÚhlinerx   ÚscalingsÚtitlesÚaxesÚgfpÚwindow_titleÚspatial_colorsÚzorderÚ
selectableÚ	noise_covÚ	time_unitÚspherer©   r   )r&   )re   rw   rt   rª   r«   r¬   r­   rg   r®   rx   r¯   r°   r±   r²   r³   r´   rµ   r¶   r·   r¸   r¹   r©   r   rJ   rJ   rN   Úplote  s2                    ùzEvoked.plotÚRdBu_rÚGreysç      Ð?c                 C   s4   t | |||||||||	|
|||||||||||d�S )N)rw   rt   rª   r«   Úclimr­   rg   rx   r¯   r°   r±   ÚcmapÚcolorbarÚmaskÚ
mask_styleÚ	mask_cmapÚ
mask_alphar¸   Ú
show_namesÚgroup_byr¹   )r)   )re   rw   rt   rª   r«   r¾   r­   rg   rx   r¯   r°   r±   r¿   rÀ   rÁ   rÂ   rÃ   rÄ   r¸   rÅ   rÆ   r¹   rJ   rJ   rN   Ú
plot_imageu  s0                    úzEvoked.plot_imageg=
×£p=î?Únoneç        Úwc                 C   s,   t | |||||||||	|
|||||||d�S )zF
        Notes
        -----
        .. versionadded:: 0.10.0
        )ÚlayoutÚlayout_scaleÚcolorÚborderr¬   r¯   Útitlerg   ÚvlineÚfig_backgroundÚmerge_gradsÚlegendr±   Úbackground_colorr·   rt   r«   )r*   )re   rË   rÌ   rÍ   rÎ   r¬   r¯   rÏ   rg   rÐ   rÑ   rÒ   rÓ   r±   rÔ   r·   rt   r«   rJ   rJ   rN   Ú	plot_topo„  s(                úzEvoked.plot_topoé@   r   z%3.1fÚheadé   c              !   C   sF   t | |||||||||	|
||||||||||||||||||||d�S )N)r_   Úch_typeÚvminÚvmaxr¿   ÚsensorsrÀ   r¯   rx   ÚresÚsizeÚcbar_fmtr¸   Útime_formatrg   r«   rÅ   rÏ   rÁ   Úmask_paramsÚoutlinesÚcontoursÚimage_interprI   r±   Úextrapolater¹   rÎ   ÚnrowsÚncols)r'   )re   r_   rÙ   rÚ   rÛ   r¿   rÜ   rÀ   r¯   rx   rÝ   rÞ   rß   r¸   rà   rg   r«   rÅ   rÏ   rÁ   rá   râ   rã   rä   rI   r±   rå   r¹   rÎ   ræ   rç   rJ   rJ   rN   Úplot_topomap˜  sB                         özEvoked.plot_topomapút = %0.0f msé   Zterrain)Úinteractionr   c          
      C   s   t | |||||||||	d�
S )N)ÚtimeÚ
time_labelr‹   ÚfigrÛ   Ú
n_contoursrë   r   )r(   )
re   Z	surf_mapsrì   rí   r‹   rî   rÛ   rï   rë   r   rJ   rJ   rN   Ú
plot_field°  s        ýzEvoked.plot_fieldc              
   C   s   t | |||||||d�S )N)r·   Úrankr«   r¸   r¹   r±   r   )r+   )re   r·   r«   rñ   r¸   r¹   r±   r   rJ   rJ   rN   Ú
plot_white¹  s          þzEvoked.plot_whiteÚpeaksÚ c              
   C   s   t | |||||||d�S )N)r_   rÏ   rw   rt   r«   Úts_argsÚtopomap_args)r,   )re   r_   rÏ   rw   rt   r«   rõ   rö   rJ   rJ   rN   Ú
plot_jointÀ  s    
  þzEvoked.plot_joint)rä   rå   r   c	                C   s    t | |||||||||	|
|d�S )aÚ  Make animation of evoked data as topomap timeseries.

        The animation can be paused/resumed with left mouse button.
        Left and right arrow keys can be used to move backward or forward
        in time.

        Parameters
        ----------
        ch_type : str | None
            Channel type to plot. Accepted data types: 'mag', 'grad', 'eeg',
            'hbo', 'hbr', 'fnirs_cw_amplitude',
            'fnirs_fd_ac_amplitude', 'fnirs_fd_phase', and 'fnirs_od'.
            If None, first available channel type from the above list is used.
            Defaults to None.
        times : array of float | None
            The time points to plot. If None, 10 evenly spaced samples are
            calculated over the evoked time series. Defaults to None.
        frame_rate : int | None
            Frame rate for the animation in Hz. If None,
            frame rate = sfreq / 10. Defaults to None.
        butterfly : bool
            Whether to plot the data as butterfly plot under the topomap.
            Defaults to False.
        blit : bool
            Whether to use blit to optimize drawing. In general, it is
            recommended to use blit in combination with ``show=True``. If you
            intend to save the animation it is better to disable blit.
            Defaults to True.
        show : bool
            Whether to show the animation. Defaults to True.
        time_unit : str
            The units for the time axis, can be "ms" (default in 0.16)
            or "s" (will become the default in 0.17).

            .. versionadded:: 0.16
        %(sphere_topomap_auto)s
        %(image_interp_topomap)s
        %(extrapolate_topomap)s

            .. versionadded:: 0.22
        %(verbose)s

        Returns
        -------
        fig : instance of matplotlib.figure.Figure
            The figure.
        anim : instance of matplotlib.animation.FuncAnimation
            Animation of the topomap.

        Notes
        -----
        .. versionadded:: 0.12.0
        )rÙ   r_   Ú
frame_rateÚ	butterflyÚblitr«   r¸   r¹   rä   rå   r   r-   )re   rÙ   r_   rø   rù   rú   r«   r¸   r¹   rä   rå   r   rJ   rJ   rN   Úanimate_topomapÈ  s    :        üzEvoked.animate_topomapÚgradÚfastc                 C   s   ddl m} || ||d�S )aè  Compute virtual evoked using interpolated fields.

        .. Warning:: Using virtual evoked to compute inverse can yield
            unexpected results. The virtual channels have ``'_v'`` appended
            at the end of the names to emphasize that the data contained in
            them are interpolated.

        Parameters
        ----------
        ch_type : str
            The destination channel type. It can be 'mag' or 'grad'.
        mode : str
            Either ``'accurate'`` or ``'fast'``, determines the quality of the
            Legendre polynomial expansion used. ``'fast'`` should be sufficient
            for most applications.

        Returns
        -------
        evoked : instance of mne.Evoked
            The transformed evoked object containing only virtual channels.

        Notes
        -----
        This method returns a copy and does not modify the data it
        operates on. It also returns an EvokedArray instance.

        .. versionadded:: 0.9.0
        r   )Ú_as_meg_type_inst)rÙ   Úmode)Úforwardrþ   )re   rÙ   rÿ   rþ   rJ   rJ   rN   Úas_type  s    zEvoked.as_typec                 C   s*   t | j|ƒ}t| j| |dd�| j|< | S )a~  Detrend data.

        This function operates in-place.

        Parameters
        ----------
        order : int
            Either 0 or 1, the order of the detrending. 0 is a constant
            (DC) detrend, 1 is a linear detrend.
        %(picks_good_data)s

        Returns
        -------
        evoked : instance of Evoked
            The detrended evoked object.
        r›   ©Zaxis)r4   rX   r   r\   )re   Úorderrw   rJ   rJ   rN   r   (  s    zEvoked.detrendc                 C   s   t | ƒ}|S )zŒCopy the instance of evoked.

        Returns
        -------
        evoked : instance of Evoked
            A copy of the object.
        r   )re   ÚevokedrJ   rJ   rN   r`   >  s    zEvoked.copyc                 C   sP   |   ¡ }| jd9  _|jdk	r:d|jkr:d|j› d�|_d|jpDd› �|_|S )zÓNegate channel responses.

        Returns
        -------
        evoked_neg : instance of Evoked
            The Evoked instance with channel data negated and '-'
            prepended to the comment.
        r›   Nú + ú(ú)z- Úunknown)r`   r\   r[   )re   ÚoutrJ   rJ   rN   Ú__neg__I  s    	zEvoked.__neg__Úabsc                    sî  dt  }| jddd�}	tdt|ƒ|ƒ |dk	rH||	krHtd|› d�ƒ‚nt|	ƒdkrd|dkrdtd	ƒ‚|rŠ|d
krztdƒ‚n|dkrŠtdƒ‚d }
 } } } } }}d}|dkr¸|}
nT|dkrÆd}nF|dkrÔd}n8|dkrâd}n*|dkrðd}n|dkrþd}n|t k�r|}|dk	�rH|�r,t| jdd�}nt	| j|
||||d||d�	}| j
}| j‰ |dk	�rx|| }‡ fdd„|D ƒ‰ |�r¦t||g ƒ\}}dd„ ˆ ddd… D ƒ‰ t|| j|||ƒ\}}}ˆ | |�rÎ|n| j| f}|�rê||f7 }|S )ah  Get location and latency of peak amplitude.

        Parameters
        ----------
        ch_type : str | None
            The channel type to use. Defaults to None. If more than one channel
            type is present in the data, this value **must** be provided.
        tmin : float | None
            The minimum point in time to be considered for peak getting.
            If None (default), the beginning of the data is used.
        tmax : float | None
            The maximum point in time to be considered for peak getting.
            If None (default), the end of the data is used.
        mode : 'pos' | 'neg' | 'abs'
            How to deal with the sign of the data. If 'pos' only positive
            values will be considered. If 'neg' only negative values will
            be considered. If 'abs' absolute values will be considered.
            Defaults to 'abs'.
        time_as_index : bool
            Whether to return the time index instead of the latency in seconds.
        merge_grads : bool
            If True, compute peak from merged gradiometer data.
        return_amplitude : bool
            If True, return also the amplitude at the maximum response.

            .. versionadded:: 0.16

        Returns
        -------
        ch_name : str
            The channel exhibiting the maximum response.
        latency : float | int
            The time point of the maximum response, either latency in seconds
            or index.
        amplitude : float
            The amplitude of the maximum response. Only returned if
            return_amplitude is True.

            .. versionadded:: 0.16
        )Úmagrü   ÚeegÚseegÚdbsÚecogÚmiscÚNoneT)ÚuniqueZonly_data_chsrÙ   NzChannel type "z"" not found in this evoked object.r   zGMultiple data channel types found. Please pass the "ch_type" parameter.rü   z+Channel type must be "grad" for merge_gradsÚnegzBNegative mode (mode=neg) does not make sense with merge_grads=TrueF)r  rü   r  r  r  r  r  )Ztopomap_coords)Úmegr  r  r  r  Zref_megÚfnirsr  c                    s   g | ]}ˆ | ‘qS rJ   rJ   ©rK   Úk©r¤   rJ   rN   Ú
<listcomp>º  s     z#Evoked.get_peak.<locals>.<listcomp>c                 S   s   g | ]}|d d… d ‘qS )Nr›   ÚXrJ   )rK   Zch_namerJ   rJ   rN   r  ¾  s     r~   )r5   Zget_channel_typesr   Ústrr†   rŸ   ÚRuntimeErrorr   rX   r3   r\   r¤   r   Ú	_get_peakr_   )re   rÙ   ry   rz   rÿ   Ztime_as_indexrÒ   Zreturn_amplitudeÚ	supportedZ
types_usedr  r  r  r  r  r  r  rw   r\   Ú_Zch_idxZtime_idxZmax_ampr	  rJ   r  rN   Úget_peakZ  s|    +ÿ
ÿÿ


   þ

 ÿ
ÿ
zEvoked.get_peakc             	   C   s®   t ƒ }dg}	ddg}
t||	ƒ}t||
ƒ}t| j|ddd�}| j|dd…f }| j}|j}|rd| ¡ }t	| |||ƒ}t
ƒ }t| ||ƒ}| d|f¡ t| |||||dgd�}|S )	a\  Export data in tabular structure as a pandas DataFrame.

        Channels are converted to columns in the DataFrame. By default,
        an additional column "time" is added, unless ``index='time'``
        (in which case time values form the DataFrame's index).

        Parameters
        ----------
        %(picks_all)s
        %(index_df_evk)s
            Defaults to ``None``.
        %(scalings_df)s
        %(copy_df)s
        %(long_format_df_raw)s
        %(time_format_df)s

            .. versionadded:: 0.20
        %(verbose)s

        Returns
        -------
        %(df_return)s
        rì   ÚmsÚ	timedeltarr   rJ   rs   N)Zdefault_index)r   r   r"   r4   rX   r\   r_   ÚTr`   r!   rm   r    Úappendr   )re   rw   Úindexr¯   r`   Zlong_formatrà   r   ÚpdZvalid_index_argsZvalid_time_formatsr\   r_   ZmindexZdfrJ   rJ   rN   Úto_data_frameË  s&    

ÿzEvoked.to_data_frame)NTrI   F)NNNN)NNNN)r�   )r–   )Nr¦   TTNr§   FNNNNNFNFr¨   TNr¢   N)Nr¦   TTNr§   FNNNNr»   TNNr¼   r½   r¢   NNN)Nré   NNNrê   )TNr¢   NNN)ró   rô   Nr¦   TNN)NNNFTTr¢   N)rü   rý   )r   N)NNNr  FFF)NNNTFN)+Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   rj   Úpropertyrh   Úsetterr\   r   r}   r�   r’   r•   r˜   r£   r¤   r   r&   rº   r)   rÇ   r*   rÕ   r'   r   r   r   rè   r(   rð   r+   rò   r,   r÷   rû   r  r   r`   r
  r!  r(  rJ   rJ   rJ   rN   rP   ?   s\  9    ÿþ



!  ÿ/$
                           üû                              û         û                 ö        ÿ þ      ÿ       þ         þ ý?
        þ
q       þþrP   c                   @   s$   e Zd ZdZed
ddœdd	„ƒZdS )ÚEvokedArrayaÑ  Evoked object from numpy array.

    Parameters
    ----------
    data : array of shape (n_channels, n_times)
        The channels' evoked response. See notes for proper units of measure.
    %(info_not_none)s Consider using :func:`mne.create_info` to populate this
        structure.
    tmin : float
        Start time before event. Defaults to 0.
    comment : str
        Comment on dataset. Can be the condition. Defaults to ''.
    nave : int
        Number of averaged epochs. Defaults to 1.
    kind : str
        Type of data, either average or standard_error. Defaults to 'average'.
    %(baseline_evoked)s
        Defaults to ``None``, i.e. no baseline correction.

        .. versionadded:: 0.23
    %(verbose)s

    See Also
    --------
    EpochsArray, io.RawArray, create_info

    Notes
    -----
    Proper units of measure:
    * V: eeg, eog, seeg, dbs, emg, ecg, bio, ecog
    * T: mag
    * T/m: grad
    * M: hbo, hbr
    * Am: dipole
    * AU: misc
    rÉ   rô   r   rI   NrQ   c          
      C   sp  t  |¡rt jnt j}	t j||	d�}|jdkr>td|jf ƒ‚t|d ƒt  |¡d krztdt|d ƒt  |¡d f ƒ‚|| _	t
t||d  ƒƒ| _| jt  |¡d  d	 | _|  t j| j| jd	 t jd�|d  ¡ | j ¡ | _d	| _| ¡ | _|| _|| _|| _d | _d
| _d | _t| jddƒ | jtk�rBtd| jf ƒ‚t| j | _|| _| jd k	�rl|  | j¡ d S )N)r‡   r~   zFData must be a 2D array of shape (n_channels, n_samples), got shape %sr¤   r   z:Info (%s) and data (%s) must have same number of channels.r‘   r›   r   Tr  rh   z:unknown kind "%s", should be "average" or "standard_error") ru   ÚiscomplexobjÚ
complex128Úfloat64Z
asanyarrayr‰   r†   r    rŸ   r\   ÚintÚroundÚfirstÚlastr^   Úaranger_   r`   ra   rb   rX   rY   rh   r[   rw   rc   Z
_projectorr   rn   rZ   r]   r’   )
re   r\   rX   ry   r[   rY   rh   r]   r   r‡   rJ   rJ   rN   rj   &  sL    
ÿ
ÿÿÿÿ
ÿzEvokedArray.__init__)rÉ   rô   r   rI   N)r)  r*  r+  r,  r   rj   rJ   rJ   rJ   rN   r/  ÿ  s   %  ÿÿr/  Fc                 C   s<  t ƒ }t ƒ }|D ]²}t|d ƒD ]@}|d | j}|d | j}|tjkr t| |ƒ}	| |	j¡ q t	||ƒd }
t|
d ƒD ]D}|
d | j}|
d | j}|tj
kr|t| |ƒ}	| t|	jƒ¡ q|qt |¡}t |¡}t|ƒt|ƒksöt|ƒdk�r|  ¡  tdƒ‚dd„ |D ƒ}dd„ t||ƒD ƒ}d |¡}|||fS )	zGet all evoked entries.ÚnentÚ	directoryr   z-Dataset names in FIF file could not be found.c                 S   s   g | ]}t | ‘qS rJ   )rk   )rK   ÚarJ   rJ   rN   r  g  s     z _get_entries.<locals>.<listcomp>c                 S   s$   g | ]\}}d | d | d ‘qS )ú"z" (r  rJ   )rK   ÚttÚcrJ   rJ   rN   r  h  s     Ú
)rm   Úrangerh   Úposr/   ÚFIFF_COMMENTr1   r%  r\   Ú_get_aspectÚFIFF_ASPECT_KINDr3  ru   Z
atleast_1drŸ   Úcloser†   ÚzipÚjoin)ÚfidÚevoked_noderi   ÚcommentsÚaspect_kindsÚevr  Úmy_kindr@  ÚtagÚ	my_aspectÚtrJ   rJ   rN   Ú_get_entriesO  s2    






rP  c                 C   sV   d}t | tjƒ}t|ƒdkr4t|ƒ t | tjƒ}d}t|ƒdkrJt d¡ |d |fS )zGet Evoked data aspect.Fr   Tr   z.Multiple data aspects found. Taking first one.)r2   r/   ÚFIFFB_ASPECTrŸ   rF   ÚFIFFB_IAS_ASPECTr   rX   )r  ri   Zis_maxshieldÚaspectrJ   rJ   rN   rB  m  s    
rB  c              	   C   s@   t | ƒ\}}}|�$}t||dd�\}}t|tjƒ}W 5 Q R X |S )zGet info in evoked file.FrQ   )r0   r7   r2   r/   ÚFIFFB_EVOKED)rS   ÚfÚtreer   rG  ÚmeasrH  rJ   rJ   rN   Ú_get_evoked_nodez  s
    rX  c                 C   s¬   | d }|j }t| dd … ƒD ]ˆ\}}|j |krzt|j ƒt|ƒkrTtd||f ƒ‚n&tdƒ | ¡ }| |¡ || |d < t t 	|j
|j
 ¡¡dk std||f ƒ‚q| S )Nr   r   z+%s and %s do not contain the same channels.z2Order of channels differs, reordering channels ...gH¯¼šò×z>z/%s and %s do not contain the same time instants)r¤   rŠ   Úsetr†   r   r`   Zreorder_channelsru   Úmaxr  r_   )Ú
all_evokedr  r¤   ÚiirK  rJ   rJ   rN   Ú_check_evokeds_ch_names_timesƒ  s&    
ÿÿ
ÿr]  c                 C   sâ  t  dd„ | D ƒt¡}t|tƒrZtd|ddgƒ |dkrF|| ¡  }qft  |¡t|ƒ }nt  |t¡}|j	dks~|j
t| ƒkr†tdƒ‚dt  |d	 | ¡ }t| ƒ} | d
  ¡ }ttdd„ | D ƒƒƒ}||jd< tdd„ t|| ƒD ƒƒ|_||_d}tt|| ƒƒD ]Ì\}\}}	|d
k�rdnd}
t  t|ƒd¡�r6dn
t|ƒd›}|�rLdnd}|	jdk	�rxd|	jk�rxd|	j› d�}n|	j�p‚d› }|d
k�rª||
› |› |› |› �7 }n"|d|
�p¶d› d|› |› |› �7 }�q| dd¡|_|S )a¦  Merge evoked data by weighted addition or subtraction.

    Each `~mne.Evoked` in ``all_evoked`` should have the same channels and the
    same time instants. Subtraction can be performed by passing
    ``weights=[1, -1]``.

    .. Warning::
        Other than cases like simple subtraction mentioned above (where all
        weights are -1 or 1), if you provide numeric weights instead of using
        ``'equal'`` or ``'nave'``, the resulting `~mne.Evoked` object's
        ``.nave`` attribute (which is used to scale noise covariance when
        applying the inverse operator) may not be suitable for inverse imaging.

    Parameters
    ----------
    all_evoked : list of Evoked
        The evoked datasets.
    weights : list of float | 'equal' | 'nave'
        The weights to apply to the data of each evoked instance, or a string
        describing the weighting strategy to apply: ``'nave'`` computes
        sum-to-one weights proportional to each object's ``nave`` attribute;
        ``'equal'`` weights each `~mne.Evoked` by ``1 / len(all_evoked)``.

    Returns
    -------
    evoked : Evoked
        The new evoked data.

    Notes
    -----
    .. versionadded:: 0.9.0
    c                 S   s   g | ]
}|j ‘qS rJ   )rY   )rK   ZevkrJ   rJ   rN   r  ¸  s     z"combine_evoked.<locals>.<listcomp>ÚweightsrY   Úequalr   z+weights must be the same size as all_evokedç      ð?r~   r   c                 s   s"   | ]}|j d  D ]
}|V  qqdS )r¦   Nr¥   )rK   ÚeÚbrJ   rJ   rN   r„   Ù  s       z!combine_evoked.<locals>.<genexpr>r¦   c                 s   s   | ]\}}||j  V  qd S r   ©r\   )rK   rÊ   ra  rJ   rJ   rN   r„   Û  s     rô   ú-z0.3fu    Ã— Nr  r  r  r  ú ú+z - - )ru   ÚarrayÚfloatÚ
isinstancer  r   ÚsumÚ	ones_likerŸ   r‰   rÞ   r†   r]  r`   rm   rY  rX   rE  r\   rY   rŠ   Úiscloser  r[   Úreplace)r[  r^  ZnavesZnew_naver  r¦   r[   r�   rÊ   ra  ÚsignÚweightZ
multiplierZthis_commentrJ   rJ   rN   Úcombine_evoked—  s:    !

"
&rp  rI   Tc              	   C   s   t | ddd�} t| ddƒ t d|  ¡ d}|dkrJt| ƒ}tt|ƒƒ}nt|tƒs^|g}d}g }	|D ]ˆ}
t	| |
||||d	�}|dkr |j
dkr t tdƒ¡ nD|dkrÚ|j
dk	rÚ|j
\}}t d
|d›d|d›d�¡ n
| |¡ |	 |¡ qf|rø|	S |	d S )a
	  Read evoked dataset(s).

    Parameters
    ----------
    fname : path-like
        The filename, which should end with ``-ave.fif`` or ``-ave.fif.gz``.
    condition : int or str | list of int or str | None
        The index or list of indices of the evoked dataset to read. FIF files
        can contain multiple datasets. If None, all datasets are returned as a
        list.
    %(baseline_evoked)s
        If ``None`` (default), do not apply baseline correction.

        .. note:: Note that if the read  `~mne.Evoked` objects have already
                  been baseline-corrected, the data retrieved from disk will
                  **always** be baseline-corrected (in fact, only the
                  baseline-corrected version of the data will be saved, so
                  there is no way to undo this procedure). Only **after** the
                  data has been loaded, a custom (additional) baseline
                  correction **may** be optionally applied by passing a tuple
                  here. Passing ``None`` will **not** remove an existing
                  baseline correction, but merely omit the optional, additional
                  baseline correction.
    kind : str
        Either 'average' or 'standard_error', the type of data to read.
    proj : bool
        If False, available projectors won't be applied to the data.
    allow_maxshield : bool | str (default False)
        If True, allow loading of data that has been recorded with internal
        active compensation (MaxShield). Data recorded with MaxShield should
        generally not be loaded directly, but should first be processed using
        SSS/tSSS to remove the compensation signals that may also affect brain
        activity. Can also be "yes" to load without eliciting a warning.
    %(verbose)s

    Returns
    -------
    evoked : Evoked or list of Evoked
        The evoked dataset(s); one `~mne.Evoked` if ``condition`` is an
        integer or string; or a list of `~mne.Evoked` if ``condition`` is
        ``None`` or a list.

    See Also
    --------
    write_evokeds

    Notes
    -----
    .. versionchanged:: 0.23
        If the read `~mne.Evoked` objects had been baseline-corrected before
        saving, this will be reflected in their ``baseline`` attribute after
        reading.
    rR   T)rU   rT   r  ©z-ave.fifz-ave.fif.gzz_ave.fifz_ave.fif.gzzReading %s ...NF)rh   rg   ri   r   z5Loaded Evoked data is baseline-corrected (baseline: [r�   z, z] sec)r   )r$   r   r   rX   rX  r?  rŸ   ri  rm   rP   r]   r   r’   r%  )rS   rf   r]   rh   rg   ri   r   Zreturn_listrH  r	  r=  r  ÚbminÚbmaxrJ   rJ   rN   Úread_evokedsõ  s0    8

þ

rt  c           *   
      s°  | dkrt dƒ‚t| ƒ\}}}|��>}t||dd�\‰ }t|tjƒ}	t|	ƒdkrXt dƒ‚t|tjƒ}
t|
ƒdkrxt dƒ‚t|t	ƒrþ|t
 ¡ kr–t dƒ‚t||
|ƒ\}}}t ||g¡t |t
| g¡@ }t |¡d }t|ƒd	krôt d
|||f ƒ‚|d }n<|dk�r:t|
ƒd	k�r6t||
|ƒ\}}}td| ƒ‚nd}|t|
ƒk�sR|dk �rZt dƒ‚|
| }ˆ  ¡ � t||ƒ\}ˆ d< W 5 Q R X d}d}g }d } }}d } } } }}t|d ƒD �]v}|d | j}|d | j} |tjk�rt|| ƒ}!|!j}�qÀ|tjk�r&t|| ƒ}!t|!jƒ}�qÀ|tjk�rHt|| ƒ}!t|!jƒ}nî|tjk�rjt|| ƒ}!t|!jƒ}nÌ|tjk�rŒt|| ƒ}!t|!jƒ}nª|tjk�r°t|| ƒ}!|  |!j¡ n†|tj!k�rÒt|| ƒ}!t|!jƒ}nd|tj"k�rôt|| ƒ}!t|!jƒ}nB|tj#k�rt|| ƒ}!t|!jƒ}n |tj$k�rÀt|| ƒ}!t|!jƒ}�qÀ|dk�rHd}|dk	�s\|dk	�r||dk	�rp|dk	�stt%‚||f}|dk�rü|dk�r˜t dƒ‚t|ƒ|k�r®t dƒ‚t&|||ƒ}"|ˆ d< t'ˆ d |"ƒˆ d dd…< t( )d| ¡ |dk�rü|ˆ d< d	}#g }$t|d ƒD ]¤}|d | j}|d | j} |tjk�rNt|| ƒ}!|!j}nd|tj*k�rpt|| ƒ}!t|!jƒ}%nB|tj+k�r’t|| ƒ}!t|!jƒ}#n |tj,k�rt|| ƒ}!|$  |!¡ �qt|$ƒ}&|&d	k�rê|&ˆ d k�rêt d|&ˆ d f ƒ‚|&d	k�r$|$d j}'|'j-d	 d	k�r<ˆ d d	k�r<|'j.}'ntj/dd„ |$D ƒdd�}'t 0|'¡�rV|' 1tj2¡}'n|' 1tj3¡}'|dk	�rŽ|dk	�rŽ|t 4|¡ˆ d   }(n8|dk	�r¾|| d	 }t 4||d	 ¡ˆ d  }(nt5dƒ‚~~|dk	�rú|'j-d	 |k�rút d|'j-d	 |f ƒ‚t( )d¡ t( )d d!|(d  d!|(d  |f ¡ ˆ d" dk	�rLt( )d#tˆ d" ƒ ¡ t( )d$|#|%f ¡ W 5 Q R X t 6‡ fd%d„tˆ d ƒD ƒ¡})|'|)dd…tj7f 9 }'ˆ |#|%||(|'|fS )&z!Read evoked data from a FIF file.NzNo evoked filename specifiedT)Z
clean_badsr   zCould not find processed datazCould not find evoked dataz*kind must be "average" or "standard_error"r   z8condition "%s" (%s) not found, out of found datasets:
%sz\Evoked file has more than one condition, the condition parameters must be specified from:
%szData set selector out of rangeÚ	maxshieldr›   r8  r9  z
No commentz=Local channel information was not found when it was expected.zBNumber of channels and number of channel definitions are differentÚchsr¦   z8    Found channel information in evoked data. nchan = %dr‘   Únchanz=Number of epoch tags is unreasonable (nepoch = %d nchan = %d)c                 S   s   g | ]}|j d d d …f ‘qS r   rc  )rK   ra  rJ   rJ   rN   r  æ  s     z _read_evoked.<locals>.<listcomp>r  zCould not read time parametersz/Incorrect number of samples (%d instead of  %d)z    Found the data of interest:z%        t = %10.2f ... %10.2f ms (%s)rš   Úcompsz.        %d CTF compensation matrices availablez$        nave = %d - aspect type = %dc                    s0   g | ](}ˆ d  | d ˆ d  |   dd¡ ‘qS )rv  ÚcalÚscaler`  )Úgetr  r¥   rJ   rN   r    s   þÿ)8r†   r0   r7   r2   r/   ÚFIFFB_PROCESSED_DATArŸ   rT  ri  r  rn   ro   rP  ru   Zin1dÚwhereÚ	TypeErrorZ_unlockrB  r?  rh   r@  rA  r1   r\   ÚFIFF_FIRST_SAMPLEr3  ÚFIFF_LAST_SAMPLEZ
FIFF_NCHANZ
FIFF_SFREQrh  ZFIFF_CH_INFOr%  ÚFIFF_FIRST_TIMEÚFIFF_NO_SAMPLESÚFIFF_MNE_BASELINE_MINÚFIFF_MNE_BASELINE_MAXÚAssertionErrorr9   r:   r   rX   rC  Ú	FIFF_NAVEÚ
FIFF_EPOCHr    r$  ZconcatenateZ	isrealobjrˆ   r2  r1  r7  r  rg  rv   )*rS   rf   rh   ri   rU  rV  r   rG  rW  Ú	processedrH  rI  rJ  rO  ZgoodsZ
found_condÚ
conditionsZ	my_evokedrN  rw  r‘   rv  r]   rr  rs  r[   r6  r5  Z
first_timeZnsampr  rL  r@  rM  Zch_names_mappingrY   ÚepochZaspect_kindZnepochr\   r_   ZcalsrJ   r¥   rN   rW   L  s6   
ÿ
ÿþ

ÿ
þ
ÿ













ÿ





þ


ÿ
ÿ
ÿÿ
þrW   Úraise)Úon_mismatchrU   r   c                C   s   t | |||d� dS )a5  Write an evoked dataset to a file.

    Parameters
    ----------
    fname : str
        The file name, which should end with -ave.fif or -ave.fif.gz.
    evoked : Evoked instance, or list of Evoked instances
        The evoked dataset, or list of evoked datasets, to save in one file.
        Note that the measurement info from the first evoked instance is used,
        so be sure that information matches.
    %(on_mismatch_info)s
    %(overwrite)s

        .. versionadded:: 1.0
    %(verbose)s

        .. versionadded:: 0.24

    See Also
    --------
    read_evokeds

    Notes
    -----
    .. versionchanged:: 0.23
        Information on baseline correction will be stored with each individual
        `~mne.Evoked` object, and will be restored when reading the data again
        via `mne.read_evokeds`.
    ©rŒ  rU   N)Ú_write_evokeds)rS   r  rŒ  rU   r   rJ   rJ   rN   r”   	  s     r”   r�  c             	   C   sÔ  ddl m} t| |d�} |r(t| ddƒ t|ttfƒs<|g}d}t| ƒ��€}t|t	j
ƒ t|t	jƒ |d jd d	k	rŽt|t	j|d jd ƒ t||d jƒ t|t	jƒ t|ƒD �]ø\}}	|ràt|d j|	jd
|› d�|d� t|t	jƒ |	jd	k	�rt|	jƒdk�rt|t	j|	jƒ t|t	j|	jd ƒ t|t	jt|	jƒƒ t|t	j|	jƒ t|t	j|	j ƒ t|	|ƒ�sž|	j!d	k	�rž|	j!\}
}t|t	j"|
ƒ t|t	j#|ƒ |	j $d¡�r´t	j%}nt	j&}t||ƒ t|t	j'|	j(ƒ t)t*|	j+ƒƒ}||	j+k�r |�s t,dƒ d}t|t	j-|ƒ ~t. /|	jd df¡}t0|	jd ƒD ]6}d|	jd | d |	jd |  $dd¡  ||< �q2t. 1|	j2¡�r~t3}nt4}||t	j5||	j2 ƒ t6||ƒ t6|t	jƒ q²t6|t	jƒ t6|t	j
ƒ W 5 Q R X d	S )zWrite evoked data.r   )ÚDipoleFixed)rS   rU   r  rq  Fr   Zmeas_idNzevoked[ú])Zinfo1Zinfo2ÚnamerŒ  ru  z�converting "nave" to integer before saving evoked; this can have a minor effect on the scale of source estimates that are computed using "nave".Trw  r`  rv  ry  rz  )7Zdipoler�  r$   r   ri  rm   Útupler=   r>   r/   Z
FIFFB_MEASrC   ZFIFF_BLOCK_IDrX   ZFIFF_PARENT_BLOCK_IDr8   r|  rŠ   r;   rT  r[   rŸ   rA   rA  rD   r�  r_   r@   r‚  r  r5  r€  r6  r]   rƒ  r„  r{  rR  rQ  rC  rZ   r3  r4  rY   r   r†  ru   Zzerosr?  r0  r\   rE   rB   r‡  r?   )rS   r  ÚcheckrŒ  rU   r�  ZwarnedrG  Úeira  rr  rs  rS  Znave_intZdecalr  Zwrite_functionrJ   rJ   rN   rŽ  ,  sn    
þ

ÿ
rŽ  r  c              	   C   sˆ  t d|dddgƒ |dkr"|d }|dkr2|d }|| ¡ k sJ|| ¡ kr�|| ¡ k r`d}|}nd	}|}t|› d
|› d| ¡ › d| ¡ › �ƒ‚n||kr®td|› d|› d�ƒ‚||k||k@ }t | ¡ t¡}d|dd…|f< tj}	|dk�rt 	| |  dk¡�s<tdƒ‚n.|dk�r<t 	| |  dk ¡�s6tdƒ‚tj
}	tjj|dk�rVt | ¡n| |d�}
t |	|
ƒ| j¡\}}||| ||f fS )ah  Get feature-index and time of maximum signal from 2D array.

    Note. This is a 'getter', not a 'finder'. For non-evoked type
    data and continuous signals, please use proper peak detection algorithms.

    Parameters
    ----------
    data : instance of numpy.ndarray (n_locations, n_times)
        The data, either evoked in sensor or source space.
    times : instance of numpy.ndarray (n_times)
        The times in seconds.
    tmin : float | None
        The minimum point in time to be considered for peak getting.
    tmax : float | None
        The maximum point in time to be considered for peak getting.
    mode : {'pos', 'neg', 'abs'}
        How to deal with the sign of the data. If 'pos' only positive
        values will be considered. If 'neg' only negative values will
        be considered. If 'abs' absolute values will be considered.
        Defaults to 'abs'.

    Returns
    -------
    max_loc : int
        The index of the feature with the maximum value.
    max_time : int
        The time point of the maximum response, index.
    max_amp : float
        Amplitude of the maximum response.
    rÿ   r  r  r@  Nr   r›   ry   rz   z (z') is out of bounds. It must be between z and ztmin (z) must be <= tmax (r  Fz;No positive values encountered. Cannot operate in pos mode.z;No negative values encountered. Cannot operate in neg mode.)rÁ   )r   ÚminrZ  r†   ru   rk  rˆ   rV   ZargmaxÚanyZargminÚmarg  r  Zunravel_indexr    )r\   r_   ry   rz   rÿ   Ú
param_nameZ	param_valZtime_winrÁ   ZmaxfunZmasked_indexZmax_locZmax_timerJ   rJ   rN   r  ‚  s@     ÿ


ÿr  )F)NNrI   TFN)NrI   F)T)NNr  )tr`   r   Únumpyru   r]   r   r   r   Zchannels.channelsr   r	   r
   Zchannels.layoutr   r   Údefaultsr   r   r   Úfilterr   r   r   Úutilsr   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   Zvizr&   r'   r(   r)   r*   Z
viz.evokedr+   r,   Zviz.topomapr.   Zio.constantsr/   Zio.openr0   Zio.tagr1   Zio.treer2   Zio.pickr3   r4   r5   Zio.meas_infor6   r7   r8   r9   r:   r;   Zio.projr<   Zio.writer=   r>   r?   r@   rA   rB   rC   rD   rE   Zio.baserF   rG   rŒ   rH   ZFIFFV_ASPECT_AVERAGEZFIFFV_ASPECT_STD_ERRZFIFFV_ASPECT_SINGLEZFIFFV_ASPECT_SUBAVERAGEZFIFFV_ASPECT_ALTAVERAGEZFIFFV_ASPECT_SAMPLEZFIFFV_ASPECT_POWER_DENSITYZFIFFV_ASPECT_DIPOLE_WAVEZFIFFV_ASPECT_IFII_LOWZFIFFV_ASPECT_IFII_HIGHZFIFFV_ASPECT_GATErn   Úitemsrk   rP   r/  rP  rB  rX  r]  rp  rt  rW   r”   rŽ  r  rJ   rJ   rJ   rN   Ú<module>   sˆ   T ,õ   ÿ     DO
	^      ÿV
 >ÿ"ÿV