CoolFace
Apppublic

Aluode/PerceptionLabPortable

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

2'�Yi@
�@sdddlZddlmZmZddlmZddlmZddl	m3Z4mZe		dd5dd�dd
��Zdd�Z
dS)�N�)�
_picks_to_idx�	pick_info)�6Projection)�verbose�)�_prep_mf_coils�7_sss_basis�meg�badsZaccurate)�accuracyrcsDt�|d|dd�}t�|��~tdd|d�}t�d|d�}t|d�}|�d	kr6td8|�d�d	�d���t||�}	~�fd
d�t�t�	|	�j9dd��dD�}10|11r\td|12�d���|	tjj|	dd�}	t
|�}t|�|	jdksuJ�g}t||	j�D]"\}
}t�dd|tjdd�f�d	dd�}|�td||
d��q}|S)a�Generate projectors to perform homogeneous/harmonic correction to data.13 14    Remove environmental fields from magnetometer data by assuming it is15    explained as a homogeneous :footcite:`TierneyEtAl2021` or harmonic field16    :footcite:`TierneyEtAl2022`. Useful for arrays of OPMs.17 18    Parameters19    ----------20    %(info)s21    order : int22        The order of the spherical harmonic basis set to use. Set to 1 to use23        only the homogeneous field component (default), 2 to add gradients, 324        to add quadrature terms, etc.25    picks : str | array_like | slice | None26        Channels to include. Default of ``'meg'`` (same as None) will select27        all non-reference MEG channels. Use ``('meg', 'ref_meg')`` to include28        reference sensors as well.29    exclude : list | 'bads'30        List of channels to exclude from HFC, only used when picking31        based on types (e.g., exclude="bads" when picks="meg").32        Specify ``'bads'`` (the default) to exclude all channels marked as bad.33    accuracy : str34        Can be ``"point"``, ``"normal"`` or ``"accurate"`` (default), defines35        which level of coil definition accuracy is used to generate model.36    %(verbose)s37 38    Returns39    -------40    %(projs)s41 42    See Also43    --------44    mne.io.Raw.add_proj45    mne.io.Raw.apply_proj46 47    Notes48    -----49    To apply the projectors to a dataset, use50    ``inst.add_proj(projs).apply_proj()``.51 52    .. versionadded:: 1.453 54    References55    ----------56    .. footbibliography::57    r58F)�none�excludeZwith_ref_meg)�rrr)�originZ	int_orderZ	ext_order)Z59ignore_refr�ZnchanzOnly �/z, picks could be interpreted as MEG channels.csg|]}�d|�qS)�ch_names�)�.0�pick��infor�E:\DocsHouse\542 percep lab latest\PerceptionLab\PerceptionLab_Portable\python_embed\Lib\site-packages\mne/preprocessing/hfc.py�60<listcomp>Ks�z$compute_proj_hfc.<locals>.<listcomp>r)Zaxisz=The following channel(s) generate non-finite projectors:61    z62Please exclude from picks!rN)Z	col_namesZ	row_names�dataZncolZnrow)Zactiver�desc)rr�dictr�len�63ValueErrorr	�np�where�isfinite�anyZlinalgZnorm�_label_basis�shape�zip�TZnewaxis�appendr)r�orderZpicksrrr�expZcoilsZn_chs�SZ	bad_chans�labelsZprojs�labelZvecZ	proj_datarrr�compute_proj_hfc
sF264�6566����r.cCsdd�t�d|d�D�S)z0Give basis vectors names for Projection() class.cSs6g|]}t�d||d�D]67}d|�d|���qqS)�����rzHFC: l=z m=�r Zarange)r�L�mrrrres���z _label_basis.<locals>.<listcomp>rr0)r)rrrr$cs�r$)rr68r)�numpyr Z69_fiff.pickrrZ70_fiff.projr�utilsrZmaxwellrr	r.r$rrrr�<module>s��U