data

FetcherError

class MRS.data.FetcherError

Bases: exceptions.Exception

__init__()

x.__init__(...) initializes x; see help(type(x)) for signature

check_md5

MRS.data.check_md5(filename, stored_md5)

Computes the md5 of filename and check if it matches with the supplied string md5

copyfileobj

MRS.data.copyfileobj(fsrc, fdst, length=16384)

copy data from file-like object fsrc to file-like object fdst

fetch_data

MRS.data.fetch_data(files, folder)

Downloads files to folder and checks their md5 checksums

Parameters:

files : dictionary

For each file in files the value should be (url, md5). The file will be downloaded from url if the file does not already exist or if the file exists but the md5 checksum does not match.

folder : str

The directory where to save the file, the directory will be created if it does not already exist.

Raises:

FetcherError :

Raises if the md5 checksum of the file does not match the expected value. The downloaded file is not deleted when this error is raised.

fetch_from_sdr

MRS.data.fetch_from_sdr(folder='/Users/arokem/.mrs_data', data='test')

Download MRS data from SDR

Parameters:

folder : str

Full path to a location in which to place the data. Per default this

will be a directory under the user’s home `.mrs_data`. :

data : str

Which data to download. Either ‘test’, which is data required for testing, or ‘example’, which is data needed for the example notebooks.

md5

MRS.data.md5()

Returns a md5 hash object; optionally initialized with a string

pjoin

MRS.data.pjoin(a, *p)

Join two or more pathname components, inserting ‘/’ as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.

urlopen

MRS.data.urlopen(url, data=None, timeout=<object object at 0x1002c3150>, cafile=None, capath=None, cadefault=False, context=None)

Site Navigation

Stanford CNI

Table Of Contents

Previous topic

corr

Next topic

freesurfer

This Page