forked from KuperbergLab/MEG_scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeInv.sh
executable file
·76 lines (60 loc) · 4 KB
/
makeInv.sh
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
#!/bin/csh -f
#usage makeInv subjID logfile
setenv USE_STABLE_5_0_0
source /usr/local/freesurfer/nmr-stable50-env
source /usr/pubsw/packages/mne/nightly/bin/mne_setup
if ( $#argv == 0 ) then
echo "NO SUBJECT ARGUMENT"
exit 1
endif
if ( $#argv == 1 ) then
set log='./makeInv.log'
echo "Logging to default log..." >>& $log
endif
if ( $#argv == 2) then
set log=$2
endif
# if log exists, delete
if ( -e $log ) then
rm $log
endif
setenv SUBJECT $1
cd /cluster/kuperberg/SemPrMM/MEG/data/$1/ave_projon
date
###################INVERSE SOLUTIONS####################
###note these only change if cov matrix changes###
##Note we're using the covariance from BaleenLP, because we don't have a good baseline period in ATLLoc
foreach t ('meg')
#foreach t ('meg' 'eeg' 'meg-eeg')
##This has to be done separately b/c just one fwd solution exists for EEG, and just need one for each covariance matrix
if ($t == 'eeg' ) then
mne_do_inverse_operator --fwd $1_All-ave-7-eeg-fwd.fif --depth --loose .5 --$t --senscov $1_Baleen_All-cov.fif --inv $1_ATLLoc-Baleen-ave-7-eeg-inv.fif >>& $log
mne_do_inverse_operator --fwd $1_All-ave-7-eeg-fwd.fif --depth --loose .5 --$t --senscov $1_MaskedMM_All-cov.fif --inv $1_MaskedMM-ave-7-eeg-inv.fif >>& $log
if ( -e $1_AXCPTRun1-ave.fif ) then
mne_do_inverse_operator --fwd $1_All-ave-7-eeg-fwd.fif --depth --loose .5 --$t --senscov $1_AXCPT_All-cov.fif --inv $1_AXCPT-ave-7-eeg-inv.fif >>& $log
endif
else if ( $t == 'meg') then
mne_do_inverse_operator --fwd $1_AXCPT-equalisedTar_All-ave-7-meg-fwd.fif --depth --loose .5 --$t --senscov $1_AXCPT_All-cov.fif --inv $1_AXCPT-equalisedTar_All-ave-7-$t-inv.fif >>& $log
mne_do_inverse_operator --fwd $1_AXCPT-equalisedPri_All-ave-7-meg-fwd.fif --depth --loose .5 --$t --senscov $1_AXCPT_All-cov.fif --inv $1_AXCPT-equalisedPri_All-ave-7-$t-inv.fif >>& $log
#mne_do_inverse_operator --fwd $1_ATLLoc-ave-7-$t-fwd.fif --depth --loose .5 --$t --senscov $1_Baleen_All-cov.fif --inv $1_ATLLoc-ave-7-$t-inv.fif >>& $log
#mne_do_inverse_operator --fwd $1_MaskedMM_All-ave-7-$t-fwd.fif --depth --loose .5 --$t --senscov $1_MaskedMM_All-cov.fif --inv $1_MaskedMM_All-ave-7-$t-inv.fif >>& $log
#mne_do_inverse_operator --fwd $1_BaleenLP_All-ave-7-$t-fwd.fif --depth --loose .5 --$t --senscov $1_Baleen_All-cov.fif --inv $1_BaleenLP_All-ave-7-$t-inv.fif >>& $log
#mne_do_inverse_operator --fwd $1_BaleenHP_All-ave-7-$t-fwd.fif --depth --loose .5 --$t --senscov $1_Baleen_All-cov.fif --inv $1_BaleenHP_All-ave-7-$t-inv.fif >>& $log
if ( -e $1_AXCPTRun1-ave.fif ) then
mne_do_inverse_operator --fwd $1_AXCPT_All-ave-7-$t-fwd.fif --depth --loose .5 --$t --senscov $1_AXCPT_All-cov.fif --inv $1_AXCPT_All-ave-7-$t-inv.fif >>& $log
endif
##This has to be done separately b/c I couldn't figure out how to code it with the previous loop given the --meg and --eeg options
else if ($t == 'meg-eeg') then
mne_do_inverse_operator --fwd $1_ATLLoc-ave-7-$t-fwd.fif --depth --loose .5 --meg --eeg --senscov $1_Baleen_All-cov.fif --inv $1_ATLLoc-ave-7-$t-inv.fif >>& $log
mne_do_inverse_operator --fwd $1_MaskedMM_All-ave-7-$t-fwd.fif --depth --loose .5 --meg --eeg --$t --senscov $1_MaskedMM_All-cov.fif --inv $1_MaskedMM_All-ave-7-$t-inv.fif >>& $log
mne_do_inverse_operator --fwd $1_BaleenLP_All-ave-7-$t-fwd.fif --depth --loose .5 --meg --eeg --$t --senscov $1_Baleen_All-cov.fif --inv $1_BaleenLP_All-ave-7-$t-inv.fif >>& $log
mne_do_inverse_operator --fwd $1_BaleenHP_All-ave-7-$t-fwd.fif --depth --loose .5 --meg --eeg --$t --senscov $1_Baleen_All-cov.fif --inv $1_BaleenHP_All-ave-7-$t-inv.fif >>& $log
if ( -e $1_AXCPTRun1-ave.fif ) then
mne_do_inverse_operator --fwd $1_AXCPT_All-ave-7-$t-fwd.fif --depth --loose .5 --meg --eeg --$t --senscov $1_AXCPT_All-cov.fif --inv $1_AXCPT_All-ave-7-$t-inv.fif >>& $log
endif
endif
end
######MAKE MORPHING MAP TO FSAVERAGE######
mne_make_morph_maps --from $1 --to fsaverage >>& $log ## --redo if they already exist
########FIX GROUP ON ALL FILES########
chgrp -R lingua .