# Path: cogspaces/datasets/utils.py
# def get_data_dir(data_dir=None):
#     """ Returns the directories in which to look for data.
# 
#     Parameters
#     ----------
#     data_dir: string, optional
#         Path of the utils directory. Used to force utils storage in a specified
#         location. Default: None
# 
#     Returns
#     -------
#     path: string
#         Path of the data directory.
#     """
# 
#     # Check data_dir which force storage in a specific location
#     if data_dir is not None:
#         assert (isinstance(data_dir, str))
#         return data_dir
#     elif 'COGSPACES_DATA' in os.environ:
#         return os.environ['COGSPACES_DATA']
#     else:
#         return os.path.expanduser('~/cogspaces_data')


import os
import re
import warnings
import pandas as pd
from math import ceil
from os.path import join
from joblib import load
from sklearn.utils import Bunch
from cogspaces.datasets.utils import get_data_dir
from nilearn.datasets.utils import _fetch_files, _get_dataset_dir

    files = _fetch_files(data_dir, files, resume=resume,
                         verbose=verbose)

    params = {key: file for key, file in zip(keys, files)}

    fdescr = 'Components computed using the MODL package, at various scale,' \
             'from HCP900 data'

    params['description'] = fdescr
    params['data_dir'] = data_dir

    return Bunch(**params)


STUDY_LIST = ['knops2009recruitment', 'ds009', 'gauthier2010resonance',
              'ds017B', 'ds110', 'vagharchakian2012temporal', 'ds001',
              'devauchelle2009sentence', 'camcan', 'archi',
              'henson2010faces', 'ds052', 'ds006A', 'ds109', 'ds108', 'la5c',
              'gauthier2009resonance', 'ds011', 'ds107', 'ds116', 'ds101',
              'ds002', 'ds003', 'ds051', 'ds008', 'pinel2009twins', 'ds017A',
              'ds105', 'ds007', 'ds005', 'amalric2012mathematicians', 'ds114',
              'brainomics', 'cauvet2009muslang', 'hcp']


def fetch_reduced_loadings(data_dir=None, url=None, verbose=False,
                           resume=True):
    if url is None:
        url = 'http://cogspaces.github.io/assets/data/loadings/'


# Path: cogspaces/datasets/utils.py
# def get_data_dir(data_dir=None):
#     """ Returns the directories in which to look for data.
# 
#     Parameters
#     ----------
#     data_dir: string, optional
#         Path of the utils directory. Used to force utils storage in a specified
#         location. Default: None
# 
#     Returns
#     -------
#     path: string
#         Path of the data directory.
#     """
# 
#     # Check data_dir which force storage in a specific location
#     if data_dir is not None:
#         assert (isinstance(data_dir, str))
#         return data_dir
#     elif 'COGSPACES_DATA' in os.environ:
#         return os.environ['COGSPACES_DATA']
#     else:
#         return os.path.expanduser('~/cogspaces_data')


# Path: cogspaces/datasets/derivative.py
import os
import re
import warnings
import pandas as pd
from math import ceil
from os.path import join
from joblib import load
from sklearn.utils import Bunch
from cogspaces.datasets.utils import get_data_dir
from nilearn.datasets.utils import _fetch_files, _get_dataset_dir


    files = _fetch_files(data_dir, files, resume=resume,
                         verbose=verbose)

    params = {key: file for key, file in zip(keys, files)}

    fdescr = 'Components computed using the MODL package, at various scale,' \
             'from HCP900 data'

    params['description'] = fdescr
    params['data_dir'] = data_dir

    return Bunch(**params)


STUDY_LIST = ['knops2009recruitment', 'ds009', 'gauthier2010resonance',
              'ds017B', 'ds110', 'vagharchakian2012temporal', 'ds001',
              'devauchelle2009sentence', 'camcan', 'archi',
              'henson2010faces', 'ds052', 'ds006A', 'ds109', 'ds108', 'la5c',
              'gauthier2009resonance', 'ds011', 'ds107', 'ds116', 'ds101',
              'ds002', 'ds003', 'ds051', 'ds008', 'pinel2009twins', 'ds017A',
              'ds105', 'ds007', 'ds005', 'amalric2012mathematicians', 'ds114',
              'brainomics', 'cauvet2009muslang', 'hcp']


def fetch_reduced_loadings(data_dir=None, url=None, verbose=False,
                           resume=True):
    if url is None:
        url = 'http://cogspaces.github.io/assets/data/loadings/'


    data_dir = get_data_dir(data_dir)