U
    f»{j²  ã                   @   sl   d dl Z d dlmZ ddlmZmZ ddlmZmZm	Z	 e 
e¡Zedddœdd„ƒZd	d
„ Zddd„ZdS )é    Né   )Ú_manifest_check_downloadÚ	_get_pathé   )ÚverboseÚget_subjects_dirÚ
set_config)r   c                C   st   t | ƒ} t t | ¡¡} t | d¡}tj|dd� tt td¡t | ¡ddd� tt td¡t | d¡d	d
d� |S )aô  Fetch and update fsaverage.

    Parameters
    ----------
    subjects_dir : str | None
        The path to use as the subjects directory in the MNE-Python
        config file. None will use the existing config variable (i.e.,
        will not change anything), and if it does not exist, will use
        ``~/mne_data/MNE-fsaverage-data``.
    %(verbose)s

    Returns
    -------
    fs_dir : str
        The fsaverage directory.
        (essentially ``subjects_dir + '/fsaverage'``).

    Notes
    -----
    This function is designed to provide

    1. All modern (Freesurfer 6) fsaverage subject files
    2. All MNE fsaverage parcellations
    3. fsaverage head surface, fiducials, head<->MRI trans, 1- and 3-layer
       BEMs (and surfaces)

    This function will compare the contents of ``subjects_dir/fsaverage``
    to the ones provided in the remote zip file. If any are missing,
    the zip file is downloaded and files are updated. No files will
    be overwritten.

    .. versionadded:: 0.18
    Z	fsaverageT©Úexist_okzroot.txtz'https://osf.io/3bxqt/download?version=2Z 5133fe92b7b8f03ae19219d5f46e4177)Zmanifest_pathZdestinationÚurlÚhash_zbem.txtz'https://osf.io/7ve8g/download?version=4Z b31509cdcf7908af6a83dc5ee8f49fb1)	Ú_set_montage_coreg_pathÚopÚabspathÚ
expanduserÚjoinÚosÚmakedirsr   ÚFSAVERAGE_MANIFEST_PATH)Úsubjects_dirr   Zfs_dir© r   ú[/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/datasets/_fsaverage/base.pyÚfetch_fsaverage   s"    5
ü

ür   c                 C   s>   t | dd�} | d kr:td ddƒ} t | d¡} tj| dd� | S )NF©Zraise_errorZMNE_DATAzmontage coregistrationzMNE-fsaverage-dataTr	   )r   r   r   r   r   r   )r   r   r   r   Ú_get_create_subjects_dirV   s    r   c                 C   s*   t | ƒ} tddd�}|dkr&td| ƒ | S )aÁ  Set a subject directory suitable for montage(-only) coregistration.

    Parameters
    ----------
    subjects_dir : str | None
        The path to use as the subjects directory in the MNE-Python
        config file. None will use the existing config variable (i.e.,
        will not change anything), and if it does not exist, will use
        ``~/mne_data/MNE-fsaverage-data``.

    Returns
    -------
    subjects_dir : str
        The subjects directory that was used.

    See Also
    --------
    mne.datasets.fetch_fsaverage
    mne.get_config
    mne.set_config

    Notes
    -----
    If you plan to only do EEG-montage based coregistrations with fsaverage
    without any MRI warping, this function can facilitate the process.
    Essentially it sets the default value for ``subjects_dir`` in MNE
    functions to be ``~/mne_data/MNE-fsaverage-data`` (assuming it has
    not already been set to some other value).

    .. versionadded:: 0.18
    NFr   ZSUBJECTS_DIR)r   r   r   )r   Zold_subjects_dirr   r   r   r   _   s
     
r   )N)N)r   Úos.pathÚpathr   Úutilsr   r   r   r   r   ÚdirnameÚ__file__r   r   r   r   r   r   r   r   Ú<module>   s   
G	