-
Notifications
You must be signed in to change notification settings - Fork 0
/
decode01_HPC_prepro_source_decodeSource_freqBands.py
68 lines (45 loc) · 1.57 KB
/
decode01_HPC_prepro_source_decodeSource_freqBands.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 13 09:41:36 2021
@author: andrewchang
"""
import os
import numpy as np
import mne
import preprocFunc as pf
import sys
######
## use the following few lines to check the input arguments
# print('Number of arguments:', len(sys.argv), 'arguments.')
# print('Argument List:', str(sys.argv))
# print('Type:', type(sys.argv))
## run the HPC with the code below
# sbatch --array=1-90 slurm_decode01_RidgeCV0711.s
######
input_arg = sys.argv[1]
file_num = int(np.ceil(int(input_arg)/5))
freq_num = int(int(input_arg)%5)
filename = 'subjPyScript/sub'+str(file_num)+'.py'
with open(filename, 'r') as file:
code = file.read()
# Execute the code from the .py file
exec(code)
mne.datasets.fetch_fsaverage(subjects_dir="/scratch/ac8888/mne_data/MNE-fsaverage-data")
os.environ["SUBJECTS_DIR"] = "/scratch/ac8888/mne_data/MNE-fsaverage-data"
#%%
meg_channels = mne.pick_types(raw.info, meg=True)
# % get the source data
if freq_num==1:
freq_bands = {'delta': (0.5,4)}
elif freq_num==2:
freq_bands = {'theta': (4,8)}
elif freq_num==3:
freq_bands = {'alpha': (8,13)}
elif freq_num==4:
freq_bands = {'beta': (13,25)}
elif freq_num==0:
freq_bands = {'gamma': (25,40)}
output_dir = 'sourceSTC20230711_ico3_freqBands_shuffled/decodeSource20230711_RidgeCV/auditory_frontal_alpha10^(-2)-10^3_41grid_correctPitchCoefPattern/'
pf.preproSource_freqBands(raw, ica_exclude, save_dir, subject, dataMRI_dir, freq_bands, output_dir, runBEM = 0, vis = 0, useTempMRI = useTempMRI)
# decoding procedure is embedded in it!