U
    f»{j˜  ã                   @   s6   d Z ddlZddlZddlmZ dd„ Zej ¡  dS )a  Set up bilateral hemisphere surface-based source space with subsampling.

Examples
--------
.. code-block:: console

    $ mne setup_source_space --subject sample


 .. note : Only one of --ico, --oct or --spacing options can be set at the same
           time. Default to oct6.

é    N)Ú_check_optionc               	   C   sÞ  ddl m} m} | tƒ}|jdddddd� |jd	d
dddd� |jddddd� |jdddddd� |jdddddd� |jdddddd� |jddd ddd� |jd!d"d#d$dd� |jd%d&d'd(d)dd� |jd*d+d,d-d� |jd.d/d0d1dd2d3� ||ƒ | ¡ \}}|jdk�r&| ¡  t 	d)¡ |j}|j
}|j}|j}|j}	|j}
|j}|j}|j}|j}td+|d4ƒ d5d6d7d4œ| }|jdk	�rŽd5nd6}|jdk	�r¢d5nd6}|
||	g}td8d9„ |D ƒƒ}|d)k�rÖtd:ƒ‚nX|dk�ræd;}nH|d)k�r.|
dk	�rdt|
ƒ }n&|dk	�r dt|ƒ }n|	dk	�r.|	}|dk�rv|dk�rX|d< t|ƒ d= }n|d< | d< t|ƒ d= }n | d>¡�s–| d=¡�s–|d= }tj|||||||d?�}|dk	�rÌtj|||||d@�}|j||dA� dS )BzRun command.r   )Úget_optparserÚ_add_verbose_flagz-sz	--subjectÚsubjectzSubject name (required)N)ÚdestÚhelpÚdefaultz--srcÚfnamez1Output file name. Use a name <dir>/<name>-src.fifÚFILE)r   r   Úmetavarr   z--morphÚ
subject_toz&morph the source space to this subjectz--surfÚsurfacez&The surface to use. (default to white)ÚwhiteÚstring)r   r   r   Útypez	--spacingÚspacingzRSpecifies the approximate grid spacing of the source space in mm. (default to 7mm)Úintz--icoÚicozFuse the recursively subdivided icosahedron to create the source space.z--octÚoctzEuse the recursively subdivided octahedron to create the source space.z-dz--subjects-dirÚsubjects_dirzSubjects directoryz-nz--n-jobsÚn_jobsz‚The number of jobs to run in parallel (default 1). Requires the joblib package. Will use at most 2 jobs (one for each hemisphere).é   z
--add-distÚadd_distz“Add distances. Can be "True", "False", or "patch" to only compute cortical patch statistics (like the --cps option in MNE-C; requires SciPy >= 1.3)ÚTruez-oz--overwriteÚ	overwritezto write over existing filesÚ
store_true)r   r   r   Úaction)r   ÚFalseÚpatchTFr   c                 S   s   g | ]}|d k	r|‘qS )N© )Ú.0Úxr   r   úb/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/commands/mne_setup_source_space.pyÚ
<listcomp>l   s      zrun.<locals>.<listcomp>z3Only one spacing option can be set at the same timeZoct6ú-z-src.fifz_src.fif)r   r   r   r   r   r   Úverbose)r   r   Zsurfr%   )r	   r   )Zmne.commands.utilsr   r   Ú__file__Ú
add_optionÚ
parse_argsr   Ú
print_helpÚsysÚexitr   r	   r   r   r   r   r   r   r   r   r%   r   ÚlenÚ
ValueErrorÚstrÚendswithÚmneZsetup_source_spaceZmorph_source_spacesÚsave)r   r   ÚparserÚoptionsÚargsr   r   r	   r   r   r   r   r   r   r   r%   r   Zspacing_optionsZ	n_optionsZuse_spacingÚsrcr   r   r"   Úrun   sî    ý þýüûûûýùû ý










ÿÿ  ý
 þr6   )Ú__doc__r*   r0   Z	mne.utilsr   r6   ÚutilsZrun_command_if_mainr   r   r   r"   Ú<module>   s
   |