Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
raise ValueError(f"Invalid smoothing level {smoothing_level}")
elif smoothing_level.lower() not in (step['Level'].lower()
for step in model_dict['Steps']):
raise ValueError(f"Invalid smoothing level {smoothing_level}")
design_matrix = pe.MapNode(
DesignMatrix(drop_missing=drop_missing),
iterfield=['session_info', 'bold_file'],
name='design_matrix')
if estimator == 'afni':
from ..interfaces.afni import FirstLevelModel
else:
from ..interfaces.nistats import FirstLevelModel
l1_model = pe.MapNode(
FirstLevelModel(),
iterfield=['design_matrix', 'contrast_info', 'bold_file', 'mask_file'],
mem_gb=3,
name='l1_model')
def _deindex(tsv):
from pathlib import Path
import pandas as pd
out_tsv = str(Path.cwd() / Path(tsv).name)
pd.read_csv(tsv, sep='\t', index_col=0).to_csv(out_tsv, sep='\t', index=False)
return out_tsv
deindex_tsv = pe.MapNode(niu.Function(function=_deindex),
iterfield=['tsv'], name='deindex_tsv')
# Set up common patterns
image_pattern = 'reports/[sub-{subject}/][ses-{session}/]figures/[run-{run}/]' \
(15, "laplace", "Laplace"),
(16, "uniform", "Uniform"),
(17, "non central t test", "Ttest_nonc"),
(18, "weibull", "Weibull"),
(19, "chi", "Chi"),
(20, "inverse gaussian", "Invgauss"),
(21, "extreme value 1", "Extval"),
(22, "p value", "Pval"),
(23, "log p value", "LogPval"),
(24, "log10 p value", "Log10Pval"),
),
fields=("code", "label", "stat_code"),
)
class FirstLevelModel(FirstLevelModel):
def _run_interface(self, runtime):
"""
Fit a GLM using AFNI's 3dREMLfit
"""
from nipype import logging
import nibabel as nb
from nipype.interfaces import afni
logger = logging.getLogger("nipype.interface")
mat = pd.read_csv(self.inputs.design_matrix, delimiter="\t", index_col=0)
contrasts = prepare_contrasts(self.inputs.contrast_info, mat.columns.tolist())
tmpdir = op.join(runtime.cwd)
t_r = mat.index[1]
design_fname = op.join(tmpdir, "design.xmat.1D")
stim_labels = self.get_stim_labels()