This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
codeFile = mfilename('fullpath'); | |
[codeDir, ~] = fileparts(codeFile); | |
codeDir = [codeDir '/']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fixedPath = cleanPath(inPath) | |
% FORMAT fixedPath = cleanPath(inPath) | |
% Removes extra slashed from inPath. | |
[filePath, fileName, fileSuffix] = fileparts(inPath); | |
if isempty(fileSuffix) | |
splitFile = regexp(filePath, '/', 'split'); | |
else | |
splitFile = regexp(inPath, '/', 'split'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Get directory of script. Also, get parent directory. | |
""" | |
import os.path | |
code_dir = os.path.dirname(__file__) | |
par_dir = os.path.abspath(os.path.join(code_dir, os.path.pardir)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function log = allFilesExist(cellArray) | |
log = all(cellfun(@(X) logical(exist(X, 'file')), cellArray)); | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Dir results to cell array of file names | |
AllTextFiles = dir('/home/tsalo/*.txt'); | |
cellArray = struct2cell(AllTextFiles); | |
cellArray = cellArray(1, :); | |
[allFilepaths, allFilenames, allSuffixes] = cellfun(@(X) fileparts(X), cellArray, 'UniformOutput', false); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import bisect | |
from glob import glob | |
from os.path import join, splitext | |
from bids.grabbids import BIDSLayout | |
from dateutil.parser import parse | |
# subj_dir *must* have trailing / | |
subj_dir = '/scratch/tsalo006/dset/sub-01/' | |
sess = '01' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nipype.interfaces.base import Bunch | |
from nipype.algorithms import modelgen | |
from copy import deepcopy | |
def lss(bunch_list): | |
"""Takes input Bunch list and returns list of Bunch lists with LSS regressors. | |
""" | |
all_infos = [] | |
other_items = ['durations', 'amplitudes', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from textwrap import dedent | |
import logging | |
LGR = logging.getLogger(__name__) | |
def list_to_str(lst, joiner='and'): | |
if len(lst) == 1: | |
return lst[0] | |
elif len(lst) == 2: |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Collect native-space preprocessed data from fMRIPrep working directory and | |
copy into fMRIPrep derivatives directory, in BIDS format. | |
This script has only been tested on fMRIPrep v20.2.1. | |
It may not work with other versions. | |
Written by Julio Peraza (@JulioAPeraza) | |
""" | |
import argparse |
OlderNewer