pietools

pycorr.pietools.arr_slice(nii_file, _slice)[source]

slices indx from first dim from matrix, for parallelization

pycorr.pietools.copy_nii_hdr(nii, data, save='')[source]

Returns a nifti object using another nifti’s header

Dimensions are changed to correspond with data shape

pycorr.pietools.is_numeric(obj)[source]

Checks for numeric-like objects.

pycorr.pietools.load_nii_or_npy(fname)[source]

convenience function to load nib or np filetypes

pycorr.pietools.loadwith(subdir, path, func, **kwargs)[source]

For all subs in basedir, apply func to path, return list.

Parameteres: subdir – base directory to iterate through. If none, just glob path. path – path to search for in each dir in subdir func – function to apply to each path found

pycorr.pietools.print_Blocks(dirname)[source]

Given subject dir, print number of TRs for each block

pycorr.pietools.query_to_re_groups(query)[source]

For a string with with glob syntax, allow for named groups for wildcards

E.g. “*/{sub_id}/file.txt” is converted to a regular expression where {sub_id} is a wildcard,
and it’s match is a group named sub_id.

Supports multiple {bracketed_args}

pycorr.pietools.searchr(dirname, matchme, verbose=True)[source]

Walk dir, return list of all matches. Use glob to match.

pycorr.pietools.sort_int_folder(files)[source]

Sort a folder with files of form {INT}.ext into ascending, numeric order

pycorr.pietools.subs_getfile(dirname, matchme, verbose=False)[source]

Recursively find all matching files, return as dictionary with entry for each subdir

Parameters: dirname – directory to search matchme – string to match. May use wildcards (glob used)