gjheij/linescanning

One class to rule them all; let ParseFuncFile inherit from ParseExpToolsFile

Closed this issue · 2 comments

Now I have separate classes for formatting the functional data (ParseFuncFile), experimental data (ParseExpToolsFile), eyetracker data (ParseEyetrackerFile), and physio files (ParsePhysioFile). Might be good to have ParseFuncFile as base class, and have it inherit the other classes.

Right now, ParseExpToolsFile already inherits ParseEyetrackerFile, so we'd only have to include the former into ParseFuncFile. I envision the inputs to be solely list of files corresponding to fMRI, exptools, eyetracker, and physio (maybe even just BIDS-like directory).

And maybe split these classes into a separate dataset.py-module rather than clogging up utils.py

Added dataset module that inherits eyetracking data, exptools data, and func-data hierarchically (eyetracker > exptools > functional).

Eg:

from linescanning import dataset, utils
func_dir = "/some/dir"
exp     = utils.get_file_from_substring("tsv", func_dir)
funcs   = utils.get_file_from_substring("bold.mat", func_dir)
#
# only cut from SR-runs
delete_first = 100
delete_last = 0
#
window = 19
order = 3
data = dataset.Dataset(funcs,
                       deleted_first_timepoints=delete_first,
                       deleted_last_timepoints=delete_last,
                       window_size=window,
                       high_pass=True,
                       low_pass=True,
                       poly_order=order,
                       tsv_file=exp,
                       verbose=True)
#
# retrieve data
fmri = data.fetch_fmri()
onsets = data.fetch_onsets()

Can deal with multi-subject/session input; reads in the subject/session ID from BIDS-file and structures a dataframe compatible with nideconv.

With utils.select_from_df, we can fetch portions of the dataframe. For instance, if we want the third run of sub-001, we can do:

subset = utils.select_from_df(fmri, expression=("subject = 001", "and", "run = 3") # note the spaces, this is required!

This will return an indexed dataframe containing just this run of this particular subject.

I can easily incorporate nifti-files in this too, but I don't really see the point of that at this moment, unless you want to use nideconv on this type of data.

Next step would be to save all relevant data to an hdf5-file