U
    f»{j“
  ã                   @   s¶   d Z ddlZddlmZ ddlmZ ddlZddl	m
Z
 ddlZddlZddlmZ ddlmZ ddlmZ ejdd	�Ze ed
¡Ze eddd¡Ze eddd¡Zejdd„ ƒZdS )zeTest the compute_current_source_density function.

For each supported file format, implement a test.
é    N)Úcopyfile)Úassert_allclose)Úproject_sensors_onto_brain)Útesting)Ú
_get_transF)ÚdownloadZsubjectsZMEGÚsamplezsample_audvis_trunc-trans.fifzsample_audvis_trunc_raw.fifc           	   
   C   sÜ  t | ƒ}tj t¡}ttƒd }tjt	dd�� t
|j|d|d� W 5 Q R X t |ddd¡}t t |¡¡s|t t |¡¡ t |¡sœtt tddd¡|ƒ |jd	d
d� | ¡  | g ¡ | dd„ |jD ƒ¡ t d¡}t t t ddd¡t ddd¡¡¡ dd¡j |dd…dd…f< d|dd…df< | !|jdd… ¡ | "tj#j$t%t&|jdd… |ƒƒdd�¡ t
|j|d|d�|_dddgdddgddd gg}t&|jd! dd"… |ƒD ]$\}}t'|d# dd"… |d$d%� �q²dS )&z/Test projecting sensors onto the brain surface.r   zrequires generating a BEM)Úmatchr   )Úsubjects_dirZbemz
brain.surfzinner_skull.surfFT)ZmegZeegc                 S   s   i | ]
}|d “qS )Zecog© )Ú.0Úchr   r   úk/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/preprocessing/ieeg/tests/test_projection.pyÚ
<dictcomp>1   s      z3test_project_sensors_onto_brain.<locals>.<dictcomp>)é1   é   g{®Gáz”?é   é   éÿÿÿÿNg¸…ëQ¸¾?r   Úhead)Zch_posZcoord_frameg(¸XQƒiX?gd!:ŽZ¿gî´5"Á?gàëTùžq?gšÚR`?g=‚)[$Á?g�qåì��?g„dS?g‡‹ÜÓÕÁ?Zchsr   Úlocg{®Gáz„?)Zrtol)(ÚstrÚmneÚioZread_raw_fifÚ	fname_rawr   Úfname_transÚpytestZraisesÚRuntimeErrorr   ÚinfoÚopÚjoinÚisdirÚdirnameÚosÚmakedirsÚisfiler   r
   Z
pick_typesZ	load_dataZset_eeg_referenceZset_channel_typesZch_namesÚnpZzerosÚarrayZmeshgridZlinspaceZreshapeÚTZdrop_channelsZset_montageZchannelsZmake_dig_montageÚdictÚzipr   )	Ztmp_pathÚtempdirÚrawZtransZbrain_surf_fnameÚposZ	test_locsr   Ztest_locr   r   r   Útest_project_sensors_onto_brain   sZ    
ÿ
ÿ

ÿÿ þ
 ÿ   ÿþ r.   )Ú__doc__r#   Úos.pathÚpathr   Úshutilr   Únumpyr&   Znumpy.testingr   r   r   Zmne.preprocessing.ieegr   Zmne.datasetsr   Zmne.transformsr   Z	data_pathr    r
   r   r   Zrequires_testing_datar.   r   r   r   r   Ú<module>   s$   
ÿ