-
Notifications
You must be signed in to change notification settings - Fork 4
/
1_individuals.py
executable file
·2815 lines (2636 loc) · 238 KB
/
1_individuals.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
# encoding: utf-8
"""
================================================
Created by Jan Willem de Gee on 2014-06-01.
Copyright (c) 2009 jwdegee. All rights reserved.
================================================
"""
import os, sys, datetime
import subprocess, logging
import scipy as sp
import scipy.stats as stats
import numpy as np
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
import matplotlib.pyplot as plt
from IPython import embed as shell
this_raw_folder = '/home/raw_data/UvA/Donner_lab/2017_eLife/1_fMRI_yesno_visual/'
this_project_folder = '/home/shared/UvA/Niels_UvA/Visual_UvA2/'
analysisFolder = os.path.join(this_project_folder, 'analysis')
sys.path.append( analysisFolder )
sys.path.append( os.environ['ANALYSIS_HOME'] )
from Tools.Sessions import *
from Tools.Subjects.Subject import *
from Tools.Run import *
from Tools.Projects.Project import *
import defs_pupil
from defs_fmri_individuals import defs_fmri_individuals
# -----------------
# Comments: -
# -----------------
# subjects = ['sub-01', 'sub-02', 'sub-03', 'sub-04', 'sub-05', 'sub-06', 'sub-07', 'sub-08', 'sub-09', 'sub-10', 'sub-11', 'sub-12', 'sub-13', 'sub-14']
subjects = ['sub-01']
for which_subject in subjects:
if which_subject == 'sub-04':
sessions = [0,1,2]
else:
sessions = [1,2]
edfs = []
for s in sessions:
def runWholeSession( rDA, session ):
# get some variables in place:
for r in rDA:
thisRun = Run( **r )
presentSession.addRun(thisRun)
session.parcelateConditions()
session.parallelize = True
# get some more variables in place:
global edfs
edfs.append( [rDA[i]['eyeLinkFilePath'] for i in range(len(rDA)) if rDA[i]['condition'] == 'task'] )
if s == 2:
edfs = list(np.concatenate(edfs))
session_nr = [int(f.split('ses-')[-1][:2]) for f in edfs]
aliases = []
for i in range(len(edfs)):
aliases.append('detection_{}_{}'.format(i+1, session_nr[i]))
# some convenience functions:
# ---------------------------
# session.rename(conditions = ['loc', 'task'], postFix_old = ['NB', 'mcf'], postFix_new = ['B0', 'mcf'])
# session.remove(conditions = ['loc', 'task'], postFix = ['mcf', 'phys'])
# session.copy_files()
# session.register_SPM_anatomy()
# session.copy_freesurfer_labels()
# nr_voxels.append( session.number_voxels(roi='LC_JW') )
# ----------------------------
# Pupil: -
# ----------------------------
if s == 2:
pupilPreprocessSession = defs_pupil.pupilPreprocessSession(subject=Subject(which_subject, '?', None, None, None), experiment_name='pupil_yes_no', experiment_nr=2, version=3, sample_rate_new=50, project_directory=this_project_folder)
pupilPreprocessSession.import_raw_data(edf_files=edfs, aliases=aliases)
pupilPreprocessSession.delete_hdf5()
pupilPreprocessSession.import_all_data(aliases)
for alias in aliases:
pupilPreprocessSession.process_runs(alias, artifact_rejection='not_strict', create_pupil_BOLD_regressor=False)
pass
pupilPreprocessSession.process_across_runs(aliases, create_pupil_BOLD_regressor=False)
# within subjects stats:
pupilAnalysisSession = defs_pupil.pupilAnalyses(subject=Subject(which_subject, '?', None, None, None), experiment_name='pupil_yes_no', experiment_nr=2, sample_rate_new=50, project_directory=this_project_folder, aliases=aliases)
pupilAnalysisSession.trial_wise_pupil()
# ----------------------------
# fMRI: -
# ----------------------------
# preprocessing first steps:
# --------------------------
# session.setupFiles(rawBase=presentSubject.initials, process_eyelink_file=False)
# session.registerSession(contrast='t2', deskull=False)
# session.B0_unwarping(conditions=['loc', 'task'], wfs=12.223, etl=35.0, acceleration=3.0)
# session.motionCorrectFunctionals(postFix=['B0'], further_args = ' -dof 7') # session.motionCorrectFunctionals(postFix=['NB'], further_args=' -dof 7')
# session.resample_epis2(conditions=['task',], postFix=['B0', 'mcf'])
# session.rescaleFunctionals(operations = ['sgtf'], filterFreqs={'highpass': 50.0, 'lowpass': -1.0}, funcPostFix = ['B0', 'mcf'], mask_file = None) # 0.01 Hz = 1 / (2.0 [TR] x 50 [samples])
# session.rename(conditions = ['loc', 'task'], postFix_old = ['B0', 'mcf', 'sgtf'], postFix_new = ['B0', 'mcf', 'sgtf', '0.01'])
# session.rescaleFunctionals(operations = ['percentsignalchange'], funcPostFix = ['B0', 'mcf', 'sgtf', '0.01'], mask_file = None)
# stimulus timings:
# -----------------
# session.all_timings()
# ROIs:
# -----
# session.createMasksFromFreeSurferLabels(annot=False, annotFile='aparc.a2009s', cortex=True)
# session.create_dilated_cortical_mask(dilation_sd=0.25, label='cortex')
# session.create_brain_masks()
# session.transform_standard_brainmasks(min_nr_voxels=12)
# session.register_TSE_epi()
# session.grab_LC_masks() # --> requires LCs and Ventricles to be drawn.
# session.transform_LC_mask_TSE2Func(min_nr_voxels=12)
# preprocessing first steps continued:
# ------------------------------------
# session.retroicorFSL(conditions=['task', 'loc'], postFix=['B0', 'mcf'], threshold=1.5, nr_dummies=8, sample_rate=496, gradient_direction='y', prepare=True, run=False)
# session.concatenate_data_runs()
# session.GLM_nuisance()
# session.clean_to_MNI()
# MASKS:
# ------
rois = np.array([
# RETINOPY:
# --------
'V1_center',
'V1_surround',
'V2_center',
'V2_surround',
'V3_center',
'V3_surround',
# BRAINSTEM:
# ----------
'LC_standard_2',
'LC_standard_1',
'mean_fullMB',
'mean_SN',
'mean_VTA',
'basal_forebrain_4',
'basal_forebrain_123',
'AAN_VTA',
'AAN_PAG',
'AAN_PBC',
'AAN_PO',
'AAN_PPN',
'AAN_LC',
'AAN_MR',
'AAN_MRF',
'AAN_DR',
'LC_JW',
'LC_JW_nn',
'inf_col_jw',
'sup_col_jw',
'4th_ventricle',
# CHOICE areas:
# ------------
'lr_aIPS',
'lr_PCeS',
'lr_M1',
'sl_IPL',
'sl_SPL1',
'sl_SPL2',
'sl_pIns',
# PARCELATION:
# ------------
# # visual:
'Pole_occipital',
'G_occipital_sup',
'S_oc_sup_and_transversal',
'G_occipital_middle',
'S_occipital_ant',
'S_oc_middle_and_Lunatus',
'G_and_S_occipital_inf',
'S_collat_transv_post',
'G_oc-temp_med-Lingual',
'S_calcarine',
'G_cuneus',
# temporal:
'Lat_Fis-post',
'G_temp_sup-Plan_tempo',
'S_temporal_transverse',
'G_temp_sup-G_T_transv',
'G_temp_sup-Lateral',
'S_temporal_sup',
'G_temporal_middle',
'S_temporal_inf',
'G_temporal_inf',
'S_oc-temp_lat',
'G_oc-temp_med-Parahip',
'S_collat_transv_ant',
'G_oc-temp_lat-fusifor',
'S_oc-temp_med_and_Lingual',
'G_temp_sup-Plan_polar',
'Pole_temporal',
# parietal:
'S_parieto_occipital',
'S_subparietal',
'G_precuneus',
'G_parietal_sup',
'S_intrapariet_and_P_trans',
'G_pariet_inf-Angular',
'S_interm_prim-Jensen',
'G_and_S_paracentral',
'S_postcentral',
'G_postcentral',
'S_central',
'G_pariet_inf-Supramar',
'G_and_S_subcentral',
# insular:
'S_circular_insula_sup',
'G_insular_short',
'S_circular_insula_inf',
'G_Ins_lg_and_S_cent_ins',
'S_circular_insula_ant',
# cingulate:
'G_cingul-Post-ventral',
'S_pericallosal',
'G_cingul-Post-dorsal',
'S_cingul-Marginalis',
'G_and_S_cingul-Mid-Post',
'G_and_S_cingul-Mid-Ant',
'G_and_S_cingul-Ant',
# frontal:
'G_precentral',
'S_precentral-sup-part',
'S_precentral-inf-part',
'G_front_sup',
'S_front_sup',
'G_front_middle',
'S_front_middle',
'S_front_inf',
'G_front_inf-Opercular',
'G_front_inf-Triangul',
'S_orbital_lateral',
'Lat_Fis-ant-Horizont',
'Lat_Fis-ant-Vertical',
'G_front_inf-Orbital',
'G_and_S_transv_frontopol',
'G_and_S_frontomargin',
'G_orbital',
'S_orbital-H_Shaped',
'S_orbital_med-olfact',
'G_rectus',
'S_suborbital',
'G_subcallosal',
# PARCELATION LEFT:
# -----------------
# # visual:
'lh.Pole_occipital',
'lh.G_occipital_sup',
'lh.S_oc_sup_and_transversal',
'lh.G_occipital_middle',
'lh.S_occipital_ant',
'lh.S_oc_middle_and_Lunatus',
'lh.G_and_S_occipital_inf',
'lh.S_collat_transv_post',
'lh.G_oc-temp_med-Lingual',
'lh.S_calcarine',
'lh.G_cuneus',
# temporal:
'lh.Lat_Fis-post',
'lh.G_temp_sup-Plan_tempo',
'lh.S_temporal_transverse',
'lh.G_temp_sup-G_T_transv',
'lh.G_temp_sup-Lateral',
'lh.S_temporal_sup',
'lh.G_temporal_middle',
'lh.S_temporal_inf',
'lh.G_temporal_inf',
'lh.S_oc-temp_lat',
'lh.G_oc-temp_med-Parahip',
'lh.S_collat_transv_ant',
'lh.G_oc-temp_lat-fusifor',
'lh.S_oc-temp_med_and_Lingual',
'lh.G_temp_sup-Plan_polar',
'lh.Pole_temporal',
# parietal:
'lh.S_parieto_occipital',
'lh.S_subparietal',
'lh.G_precuneus',
'lh.G_parietal_sup',
'lh.S_intrapariet_and_P_trans',
'lh.G_pariet_inf-Angular',
'lh.S_interm_prim-Jensen',
'lh.G_and_S_paracentral',
'lh.S_postcentral',
'lh.G_postcentral',
'lh.S_central',
'lh.G_pariet_inf-Supramar',
'lh.G_and_S_subcentral',
# insular:
'lh.S_circular_insula_sup',
'lh.G_insular_short',
'lh.S_circular_insula_inf',
'lh.G_Ins_lg_and_S_cent_ins',
'lh.S_circular_insula_ant',
# cingulate:
'lh.G_cingul-Post-ventral',
'lh.S_pericallosal',
'lh.G_cingul-Post-dorsal',
'lh.S_cingul-Marginalis',
'lh.G_and_S_cingul-Mid-Post',
'lh.G_and_S_cingul-Mid-Ant',
'lh.G_and_S_cingul-Ant',
# frontal:
'lh.G_precentral',
'lh.S_precentral-sup-part',
'lh.S_precentral-inf-part',
'lh.G_front_sup',
'lh.S_front_sup',
'lh.G_front_middle',
'lh.S_front_middle',
'lh.S_front_inf',
'lh.G_front_inf-Opercular',
'lh.G_front_inf-Triangul',
'lh.S_orbital_lateral',
'lh.Lat_Fis-ant-Horizont',
'lh.Lat_Fis-ant-Vertical',
'lh.G_front_inf-Orbital',
'lh.G_and_S_transv_frontopol',
'lh.G_and_S_frontomargin',
'lh.G_orbital',
'lh.S_orbital-H_Shaped',
'lh.S_orbital_med-olfact',
'lh.G_rectus',
'lh.S_suborbital',
'lh.G_subcallosal',
# PARCELATION RIGHT:
# -----------------
# visual:
'rh.Pole_occipital',
'rh.G_occipital_sup',
'rh.S_oc_sup_and_transversal',
'rh.G_occipital_middle',
'rh.S_occipital_ant',
'rh.S_oc_middle_and_Lunatus',
'rh.G_and_S_occipital_inf',
'rh.S_collat_transv_post',
'rh.G_oc-temp_med-Lingual',
'rh.S_calcarine',
'rh.G_cuneus',
# temporal:
'rh.Lat_Fis-post',
'rh.G_temp_sup-Plan_tempo',
'rh.S_temporal_transverse',
'rh.G_temp_sup-G_T_transv',
'rh.G_temp_sup-Lateral',
'rh.S_temporal_sup',
'rh.G_temporal_middle',
'rh.S_temporal_inf',
'rh.G_temporal_inf',
'rh.S_oc-temp_lat',
'rh.G_oc-temp_med-Parahip',
'rh.S_collat_transv_ant',
'rh.G_oc-temp_lat-fusifor',
'rh.S_oc-temp_med_and_Lingual',
'rh.G_temp_sup-Plan_polar',
'rh.Pole_temporal',
# parietal:
'rh.S_parieto_occipital',
'rh.S_subparietal',
'rh.G_precuneus',
'rh.G_parietal_sup',
'rh.S_intrapariet_and_P_trans',
'rh.G_pariet_inf-Angular',
'rh.S_interm_prim-Jensen',
'rh.G_and_S_paracentral',
'rh.S_postcentral',
'rh.G_postcentral',
'rh.S_central',
'rh.G_pariet_inf-Supramar',
'rh.G_and_S_subcentral',
# insular:
'rh.S_circular_insula_sup',
'rh.G_insular_short',
'rh.S_circular_insula_inf',
'rh.G_Ins_lg_and_S_cent_ins',
'rh.S_circular_insula_ant',
# cingulate:
'rh.G_cingul-Post-ventral',
'rh.S_pericallosal',
'rh.G_cingul-Post-dorsal',
'rh.S_cingul-Marginalis',
'rh.G_and_S_cingul-Mid-Post',
'rh.G_and_S_cingul-Mid-Ant',
'rh.G_and_S_cingul-Ant',
# frontal:
'rh.G_precentral',
'rh.S_precentral-sup-part',
'rh.S_precentral-inf-part',
'rh.G_front_sup',
'rh.S_front_sup',
'rh.G_front_middle',
'rh.S_front_middle',
'rh.S_front_inf',
'rh.G_front_inf-Opercular',
'rh.G_front_inf-Triangul',
'rh.S_orbital_lateral',
'rh.Lat_Fis-ant-Horizont',
'rh.Lat_Fis-ant-Vertical',
'rh.G_front_inf-Orbital',
'rh.G_and_S_transv_frontopol',
'rh.G_and_S_frontomargin',
'rh.G_orbital',
'rh.S_orbital-H_Shaped',
'rh.S_orbital_med-olfact',
'rh.G_rectus',
'rh.S_suborbital',
'rh.G_subcallosal',
])
# session.combine_rois_across_hemispheres(rois=rois)
# session.transfrom_destrieux_to_MNI(rois=rois)
# session.create_session_rois(rois=rois)
# analysis of interest:
# ---------------------
# localizer:
# session.GLM_localizer()
# V123:
# session.V123_univariate() # selects voxels based on localizer
# session.V123_multivariate() # selects voxels based on task
# rois:
# session.ROI_event_related_average(rois=rois, data_type='clean')
# whole brain:
# data_type = 'clean_MNI'
# session.WHOLEBRAIN_event_related_average(data_type=data_type,)
# session.WHOLEBRAIN_correlation(data_type=data_type,)
# session.WHOLEBRAIN_searchlight_decoding(data_type=data_type,)
# for testing;
if __name__ == '__main__':
########################################################################################################################################################################################################
if which_subject == 'sub-01':
# subject information
initials = 'sub-01'
firstName = 'sub-01'
standardFSID = 'AV_120414'
birthdate = datetime.date( 1900, 01, 01 )
labelFolderOfPreference = '2014_custom'
presentSubject = Subject( initials, firstName, birthdate, standardFSID, labelFolderOfPreference )
presentProject = Project( 'yes_no_fmri', subject = presentSubject, base_dir = os.path.join(this_project_folder, 'data') )
sessionID = 'yes_no_fmri' + presentSubject.initials
if s == 1:
sessionDate = datetime.date(2014, 6, 15)
sj_session1 = 'ses-01'
if s == 2:
sessionDate = datetime.date(2014, 6, 26)
sj_session2 = 'ses-02'
presentSession = defs_fmri_individuals(sessionID, sessionDate, presentProject, presentSubject)
try:
os.mkdir(os.path.join(this_project_folder, 'data', initials))
except OSError:
presentSession.logger.debug('output folders already exist')
# ----------------------
# Decision tasks: -
# ----------------------
if s == 1:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-01_ses-01_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-01_ses-01_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-01_ses-01_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-01_ses-01_TSEori.nii.gz' ),},
# T1:
{'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-01_ses-01_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-01_ses-01_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-01_ses-01_task-yesno_run-6_eyedata.edf' ),
},
]
if s == 2:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-01_ses-02_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-01_ses-02_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-01_ses-02_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-01_ses-02_TSEori.nii.gz' ),},
# T1:
{'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-01_ses-02_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-01_ses-02_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-01_ses-02_task-yesno_run-6_eyedata.edf' ),
},
]
# ----------------------
# Initialise session -
# ----------------------
runWholeSession( runDecisionArray, presentSession )
########################################################################################################################################################################################################
if which_subject == 'sub-02':
# subject information
initials = 'sub-02'
firstName = 'sub-02'
standardFSID = 'BL_120514'
birthdate = datetime.date( 1900, 01, 01 )
labelFolderOfPreference = '2014_custom'
presentSubject = Subject( initials, firstName, birthdate, standardFSID, labelFolderOfPreference )
presentProject = Project( 'yes_no_fmri', subject = presentSubject, base_dir = os.path.join(this_project_folder, 'data') )
sessionID = 'yes_no_fmri' + presentSubject.initials
if s == 1:
sessionDate = datetime.date(2014, 6, 4)
sj_session1 = 'ses-01'
if s == 2:
sessionDate = datetime.date(2014, 6, 14)
sj_session2 = 'ses-02'
presentSession = defs_fmri_individuals(sessionID, sessionDate, presentProject, presentSubject)
try:
os.mkdir(os.path.join(this_project_folder, 'data', initials))
except OSError:
presentSession.logger.debug('output folders already exist')
# ----------------------
# Decision tasks: -
# ----------------------
if s == 1:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-02_ses-01_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-02_ses-01_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-02_ses-01_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-02_ses-01_TSEori.nii.gz' ),},
# T1:
{'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-02_ses-01_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-02_ses-01_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-02_ses-01_task-yesno_run-6_eyedata.edf' ),
},
]
if s == 2:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-02_ses-02_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-02_ses-02_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-02_ses-02_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-02_ses-02_TSEori.nii.gz' ),},
# T1:
{'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-02_ses-02_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-02_ses-02_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-02_ses-02_task-yesno_run-6_eyedata.edf' ),
},
]
# ----------------------
# Initialise session -
# ----------------------
runWholeSession( runDecisionArray, presentSession )
########################################################################################################################################################################################################
if which_subject == 'sub-03':
# subject information
initials = 'sub-03'
firstName = 'sub-03'
standardFSID = 'DE_110412'
birthdate = datetime.date( 1900, 01, 01 )
labelFolderOfPreference = '2014_custom'
presentSubject = Subject( initials, firstName, birthdate, standardFSID, labelFolderOfPreference )
presentProject = Project( 'yes_no_fmri', subject = presentSubject, base_dir = os.path.join(this_project_folder, 'data') )
sessionID = 'yes_no_fmri' + presentSubject.initials
if s == 1:
sessionDate = datetime.date(2015, 2, 26)
sj_session1 = 'ses-01'
if s == 2:
sessionDate = datetime.date(2015, 3, 2)
sj_session2 = 'ses-02'
presentSession = defs_fmri_individuals(sessionID, sessionDate, presentProject, presentSubject)
try:
os.mkdir(os.path.join(this_project_folder, 'data', initials))
except OSError:
presentSession.logger.debug('output folders already exist')
# ----------------------
# Decision tasks: -
# ----------------------
if s == 1:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-03_ses-01_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'fmap', 'sub-03_ses-01_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-03_ses-01_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-03_ses-01_TSEori.nii.gz' ),},
# T1:
{'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-03_ses-01_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'anat', 'sub-03_ses-01_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 1,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session1, 'func', 'sub-03_ses-01_task-yesno_run-6_eyedata.edf' ),
},
]
if s == 2:
runDecisionArray = [
# B0:
{'ID' : 1, 'scanType': 'inplane_anat', 'condition': 'B0_anat_mag', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-03_ses-02_magnitude.nii.gz' ),},
{'ID' : 2, 'scanType': 'inplane_anat', 'condition': 'B0_anat_phs', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'fmap', 'sub-03_ses-02_phasediff.nii.gz' ),},
# Whole brain TSE:
{'ID' : 3, 'scanType': 'inplane_anat', 'condition': 'TSE_anat_whole', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-03_ses-02_TSEwb.nii.gz' ),},
# Neuromalanin:
{'ID' : 4, 'scanType': 'inplane_anat', 'condition': 'TSE_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-03_ses-02_TSEori.nii.gz' ),},
# # T1:
# {'ID' : 5, 'scanType': 'inplane_anat', 'condition': 'T1_anat', 'session' : 2,
# 'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-03_ses-02_T1w.nii.gz' ),},
# T2:
{'ID' : 6, 'scanType': 'inplane_anat', 'condition': 'T2_anat', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'anat', 'sub-03_ses-02_T2w.nii.gz' ),},
# Localizer:
{'ID' : 7, 'scanType': 'epi_bold', 'condition': 'loc', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-localizer_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-localizer_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-localizer_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-localizer_run-1_eyedata.edf' ),
},
# Decision tasks:
{'ID' : 8, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-1_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-1_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-1_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-1_eyedata.edf' ),
},
{'ID' : 9, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-2_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-2_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-2_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-2_eyedata.edf' ),
},
{'ID' : 10, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-3_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-3_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-3_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-3_eyedata.edf' ),
},
{'ID' : 11, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-4_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-4_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-4_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-4_eyedata.edf' ),
},
{'ID' : 12, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-5_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-5_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-5_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-5_eyedata.edf' ),
},
{'ID' : 13, 'scanType': 'epi_bold', 'condition': 'task', 'session' : 2,
'rawDataFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-6_bold.nii.gz' ),
'rawBehaviorFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-6_events.pickle' ),
'physiologyFile': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-6_physio.log' ),
'eyeLinkFilePath': os.path.join(this_raw_folder, initials, sj_session2, 'func', 'sub-03_ses-02_task-yesno_run-6_eyedata.edf' ),
},
]
# ----------------------
# Initialise session -
# ----------------------
runWholeSession( runDecisionArray, presentSession )
########################################################################################################################################################################################################
if which_subject == 'sub-04':
# subject information
initials = 'sub-04'
firstName = 'sub-04'
standardFSID = 'DL_190414'
birthdate = datetime.date( 1900, 01, 01 )
labelFolderOfPreference = '2014_custom'
presentSubject = Subject( initials, firstName, birthdate, standardFSID, labelFolderOfPreference )
presentProject = Project( 'yes_no_fmri', subject = presentSubject, base_dir = os.path.join(this_project_folder, 'data') )
sessionID = 'yes_no_fmri' + presentSubject.initials
if s == 0:
sessionDate = datetime.date(2014, 5, 25)
sj_session1 = 'ses-01'
if s == 1:
sessionDate = datetime.date(2014, 6, 6)
sj_session2 = 'ses-02'
if s == 2:
sessionDate = datetime.date(2014, 6, 13)
sj_session3 = 'ses-03'
presentSession = defs_fmri_individuals(sessionID, sessionDate, presentProject, presentSubject)
try:
os.mkdir(os.path.join(this_project_folder, 'data', initials))
except OSError:
presentSession.logger.debug('output folders already exist')