-
Notifications
You must be signed in to change notification settings - Fork 5
Input Referred Models (Python)
Using the IRM tool it is possible to estimate parameters of custom-defined input referred models. This requires specification of a parametric function describing the phenomenon one would like to map. This function should take a stimulus timecourse and a vector of parameter values as input. Additionally, a parameter space xdata
needs to specified which the tool can explore. Specifically,xdata
needs to be a dictionary with one key per parameter. Each key can then contain a vector with the parameter values one would like to explore for that parameter. The tool will explore every possible combination of parameter values.
The tool needs to be instantiated with a number of parameters:
- f_sampling - sampling frequency of data acquisition (1 / TR)
- n_samples - number of samples (functional volumes)
- n_rows - number of rows (1st volumetric dimension of 4D data tensor)
- n_cols - number of columns (2nd volumetric dimension of 4D data tensor)
- n_slices - number of rows (3rd volumetric dimension of 4D data tensor)
n_samples, n_rows, n_cols, n_slices = data.shape
parameters = {'f_sampling': sampling_frequency,
'n_samples': n_samples,
'n_rows': n_rows,
'n_cols': n_cols,
'n_slices': n_slices}
irm = IRM(parameters);
The tool works in three steps. First a stimulus needs to be passed to the function. Then, timecourses based on that stimulus, a function handle and the parameter space need to be generated. Finally, the parameters need to be estimated.
irm.set_stimulus(stimulus)
irm.create_timecourse(f,xdata)
results = irm.mapping(data)
The mapping
function takes two optional arguments:
- threshold - a mean signal intensity threshold below which a voxel is skipped (default = 100)
- mask - a binary mask specifying for which voxels the analysis shouldbe carried out
The function returns a dictionary (results
) with the key corr_fit
(correlation between observed and best fitting predicted BOLD signal) as well as the same keys as xdata
with estimated values per parameter.
Values corresponding to each key retain the volumetric dimensions of the data.