nilearn / nistats

Modeling and statistical inference on fMRI data in Python
BSD 3-Clause "New" or "Revised" License
95 stars 55 forks source link

Convert non-tsv files to tsv during dataset fetch #234

Closed kchawla-pi closed 6 years ago

kchawla-pi commented 6 years ago

See https://github.com/nistats/nistats/issues/223#issuecomment-423317417

WE need to write a function called by the dataset fetchers whenever a dataset is accessed where the events are written not as csv r tsv but with a different delimiter character, such as spaces. Presumably this will be added to NiLearn as well.

kchawla-pi commented 6 years ago

No I have not.Thanks, I will check this out.

kchawla-pi commented 6 years ago

@bthirion Starting on fetch_localizer_first_level() and will look at examples to find out the rest, and then the already downloaded csv files from other datasets. If you already have the list of fetchers I should attend to, post it here.

bthirion commented 6 years ago

'fetch_spm_multimodal_fmri'

timing = loadmat(getattr(subject_data, "trials_ses%i" % (idx + 1)),
                     squeeze_me=True, struct_as_record=False)
    faces_onsets = timing['onsets'][0].ravel()
    scrambled_onsets = timing['onsets'][1].ravel()
    onsets = np.hstack((faces_onsets, scrambled_onsets))
    onsets *= tr  # because onsets were reporting in 'scans' units
    conditions = (['faces'] * len(faces_onsets) +
                  ['scrambled'] * len(scrambled_onsets))
    paradigm = pd.DataFrame({'trial_type': conditions, 'onset': onsets})

(see e.g. https://nistats.github.io/auto_examples/02_first_level_models/plot_spm_multimodal_faces.html#sphx-glr-auto-examples-02-first-level-models-plot-spm-multimodal-faces-py)

In 'fetch_spm_auditory'

import numpy as np
tr = 7.
epoch_duration = 6 * tr 
conditions = ['rest', 'active'] * 8
n_blocks = len(conditions)
duration = epoch_duration * np.ones(n_blocks)
onset = np.linspace(0, (n_blocks - 1) * epoch_duration, n_blocks)

import pandas as pd
events = pd.DataFrame(
    {'onset': onset, 'duration': duration, 'trial_type': conditions})

(see e.g. https://nistats.github.io/auto_examples/01_tutorials/plot_spm_auditory.html#sphx-glr-auto-examples-01-tutorials-plot-spm-auditory-py)

kchawla-pi commented 6 years ago

I am getting the error connection refused when I try to use nistats.datasets.fetch_localizer_first_level(<new location>) to a new location. Anyone else seeing this? Ideas why this is happening?