<commit_before>from __future__ import division, print_function, absolute_import

import os
import sys

if sys.version_info[0] < 3:
    from urllib2 import urlopen
else:
    from urllib.request import urlopen

from os.path import join as pjoin
from hashlib import md5

import numpy as np
import nibabel as nib

from dipy.core.gradients import gradient_table
from dipy.io.gradients import read_bvals_bvecs

def fetch_scil_b0():
    """ Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and
        different magnetic fields (1.5T and 3T)
    """
    url = 'http://scil.dinf.usherbrooke.ca/wp-content/data/'
    uraw = url+'datasets_multi-site_all_companies.zip'
    dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
    folder = pjoin(dipy_home, 'datasets_multi-site_all_companies')

    if not os.path.exists(folder):
        print('Downloading SCIL b=0 datasets from multiple sites and multiple companies (9.2MB)...')
        opener = urlopen(uraw)
        open(folder+'.zip', 'wb').write(opener.read())<commit_msg>Add dipy home directory creation in fetch_scil_b0<commit_after>from __future__ import division, print_function, absolute_import

import os
import sys

if sys.version_info[0] < 3:
    from urllib2 import urlopen
else:
    from urllib.request import urlopen

from os.path import join as pjoin
from hashlib import md5

import numpy as np
import nibabel as nib

from dipy.core.gradients import gradient_table
from dipy.io.gradients import read_bvals_bvecs

def fetch_scil_b0():
    """ Download b=0 datasets from multiple MR systems (GE, Philips, Siemens) and
        different magnetic fields (1.5T and 3T)
    """
    url = 'http://scil.dinf.usherbrooke.ca/wp-content/data/'
    uraw = url+'datasets_multi-site_all_companies.zip'
    dipy_home = pjoin(os.path.expanduser('~'), '.dipy')
    folder = pjoin(dipy_home, 'datasets_multi-site_all_companies')

    if not os.path.exists(folder):
        print('Creating new directory %s' % folder)
        os.makedirs(folder)
        print('Downloading SCIL b=0 datasets from multiple sites and multiple companies (9.2MB)...')
        opener = urlopen(uraw)
        open(folder+'.zip', 'wb').write(opener.read())
{'fraction_non_alphanumeric': 0.10273972602739725, 'fraction_numerical': 0.01141552511415525, 'mean_word_length': 3.8797327394209353, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5069637', 'n_tokens_mistral': 740, 'n_tokens_neox': 720, 'n_words': 201}