subject

class pycorr.subject.Run(h5grp)[source]

Class to wrap /Subjects/sub_id/Cond group

create_dataset(data, overwrite=False, reference=False, compression='gzip', chunks=(1, ), **kwargs)[source]

Data can be np.ndarray, nifti, or file name. Remaining dimensions for chunks are inferred from data

Even if ref is True, still loads data (to ensure it exists)

fill_attributes(offset=0, max_len=None, exclude=False, notes='', reference=False, subset=False, **kwargs)[source]

Kwargs are unused (there to soak up uneccesary args)

load(use_subset=True, standardized=False, threshold=False, roi=False, _slice=None)[source]

Return data as a numpy array. Uses data attributes to shift, and (optionally) threshold. Final ROI timecourses are standardized.

Parameters: subset – boolean mask for subsetting timecourse standardized – demean and scale timecourse for each voxel threshold – set thresholded values to nan roi – roi mask to subset spatial dims _slice – slice along first dimension to take

threshold(threshold, data=None, save=False)[source]

Boolean mask of values below threshold or that are nan.

Parameters: threshold – value that mean timecourse must exceed data – if given, threshold this data set. Otherwise, load run data. save – save threshold to dataset “threshold” in addition to returning

class pycorr.subject.Exp(f)[source]
static cond_thresh(dlist, mustpassprop)[source]

For each voxel, determine whether enough subs have high enough mean activation.

create_cond(condname, run=None, group=None, offset=0, max_len=False, threshold=0, audio_env=None, base_dir='', nii_files=None, dry_run=False, reference=False, **kwargs)[source]

Create condition.

Generally used by passing cond params from setup, but can be called manually. All parameters set as default for each run in the condition.

Parameters:reference – should the data be copied in, or use a reference to data instead?
create_roi(roiname, fname)[source]

Add new roi to hdf5 in /rois group

create_subrun(sub_id, condname, fname_or_arr, reference=False, **kwargs)[source]

Creates subject group for storing individual runs.

gen_composite(condname, overwrite=False)[source]

Create linear composite for condition.

gen_cond_thresh(condname, overwrite=False)[source]

Create a group thresholding mask.

static get_subject_files(globpath)[source]

Iterator. Returns re match object for each matching path.

Full path accessed using m.group(); args from m.groupdict()

iter_runs(condname, group=None)[source]

Iterate through all subjects and all runs within subject. Yield run with same name as run attr in cond

Parameters: condname – string specifying condition or condition object group – group name that must also match in the group attr for each run

setup(config, create_conds=False)[source]

Create general structure and load in data.