U
    f»{j  ã                   @   s2   d Z ddlZddlZddlZdd„ Zej ¡  dS )zªCreate a BEM solution using the linear collocation approach.

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

    $ mne prepare_bem_model --bem sample-5120-5120-5120-bem.fif

é    Nc                  C   sØ   ddl m} m} | tƒ}|jddddd� |jdd	d
ddd� ||ƒ | ¡ \}}|j}|j}|jdk	rldnd}|dkrŠ| 	¡  t
 d¡ |dkrªtj |¡\}}	|d }tj|d|d�}
tj|
|d�}t ||¡ dS )zRun command.r   )Úget_optparserÚ_add_verbose_flagz--bemÚ	bem_fnamez¡The name of the file containing the triangulations of the BEM surfaces and the conductivities of the compartments. The standard ending for this file is -bem.fif.ÚFILE)ÚdestÚhelpÚmetavarz--solÚbem_sol_fnamez™The name of the resulting file containing BEM solution (geometry matrix). It uses the linear collocation approach. The file should end with -bem-sof.fif.N)r   r   r   ÚdefaultTFé   z-sol.fif)Zpatch_statsÚverbose)r   )Zmne.commands.utilsr   r   Ú__file__Ú
add_optionÚ
parse_argsr   r	   r   Ú
print_helpÚsysÚexitÚosÚpathÚsplitextÚmneZread_bem_surfacesZmake_bem_solutionZwrite_bem_solution)r   r   ÚparserÚoptionsÚargsr   r	   r   ÚbaseÚ_Z	bem_modelZbem_solution© r   úa/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/commands/mne_prepare_bem_model.pyÚrun   s6    û û
ÿr   )Ú__doc__r   r   r   r   ÚutilsZrun_command_if_mainr   r   r   r   Ú<module>   s
   
'