-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclean_bold_jsons_jp.py
42 lines (37 loc) · 1.69 KB
/
clean_bold_jsons_jp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /Users/CN/Documents/Projects/Joystick_Cereb_MRS/bin/mrsi_code/env python
# ------------------------------------------------------------------------------
# Script name: clean_bold_jsons.py
#
# Description: Clean json files from BOLD study of potentially identifiable info, add task name and echo times.
#
# Author: Caroline Nettekoven, 2020
#
# ------------------------------------------------------------------------------
# ------------------------------------------------------------------------------
# This next line needs to come after sys.path.insert, but autoformatting keeps moving it up. Run it after line 19.
from clean_jsons import clean_json_file
#
import os.path as op
import os
import glob
import sys
# Path in the next line needs to point to wherever you have put your clean_jsons.py file
sys.path.insert(1, '/vols/Data/devcog/projects/BOLD/bin')
# Change this directory to your folder that contains all the subject folders
os.chdir('/vols/Data/devcog/projects/BOLD/')
# ------- Try example subject and check changes: -------
jsons = glob.glob('testsubject/*/*.json')
for j in jsons:
# print(j)
clean_json_file(j)
# ------- Loop across all json files of all subjects: -------
jsons = glob.glob('sub-*/*/*.json')
for j in jsons:
# print(j)
clean_json_file(j)
# ------- Loop through all json files of subjects that have another layer in fmap folder: -------
# special_fmap_folders = "/vols/Data/devcog/projects/BOLD/sub-501BT/fmap, /vols/Data/devcog/projects/BOLD/sub-541BT/fmap, /vols/Data/devcog/projects/BOLD/sub-661BT/fmap, /vols/Data/devcog/projects/BOLD/sub-564BL/fmap"
special_jsons = glob.glob('sub-*/*/*/*.json')
for j in special_jsons:
# print(j)
clean_json_file(j)