예제 #1
0
def find_files(**kwargs):
    task = kwargs["task"]
    tpt = kwargs["template"]
    files = glob.glob(
        out_of(f"megs-hcp-{task}.acw.rois-{tpt.name}.scan-{ANYTHING}.npy",
               False))
    files.sort()
    return files
예제 #2
0
def run_script(tpt: TemplateMap):
    from config import RAW_DATA_ROOT_DIR
    for task in task_order():
        storage = MEGLocalStorage(RAW_DATA_ROOT_DIR, tpt.name, task, ANYTHING)
        files_dict = storage.get_all_by_scan()
        for scan_id, file_infos in files_dict.items():
            output_file = out_of(f"megs-hcp-alpha-{task}.acz.rois-{tpt.name}.scan-{scan_id}.npy", False)
            subj_ids, files = list(zip(*file_infos))
            output = np.asarray(Parallel(n_jobs=30)(delayed(do_a_file)(file) for file in files))
            np.save(output_file, (task, scan_id, subj_ids, output))