-
Notifications
You must be signed in to change notification settings - Fork 0
/
EEG_RestingState_Pipeline.py
executable file
·50 lines (42 loc) · 2.24 KB
/
EEG_RestingState_Pipeline.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
###############################################################################################
# Emma Bailey, 18/10/2022
# Wrapper script for project to investigate high frequency oscillations in the human brain
###############################################################################################
# Can run a bad channel check for data quality purposes, but no channels are excluded before running CCA
import numpy as np
from Common_Functions.import_data_rs import import_data
from Common_Functions.Create_Frequency_Bands_RS import create_frequency_bands_rs
if __name__ == '__main__':
srmr_nr = 2 # Set the experiment number
if srmr_nr == 1:
n_subjects = 36 # Number of subjects
subjects = np.arange(1, 37) # (1, 37) # 1 through 36 to access subject data
conditions = [1] # Conditions of interest
sampling_rate = 5000 # Frequency to downsample to from original of 10kHz
elif srmr_nr == 2:
n_subjects = 24 # Number of subjects
subjects = np.arange(1, 25) # (1, 25) # 1 through 24 to access subject data
conditions = [1] # Conditions of interest - tib digits and med digits, also including mixed nerve now
sampling_rate = 5000 # Frequency to downsample to from original of 10kHz
######## 1. Import ############
import_d = True # Prep work
######## 2. Freq band ##########
split_bands_flag = True
############################################
# Import Data from BIDS directory
# Select channels to analyse
# Remove stimulus artefact by PCHIP interpolation
# Downsample and concatenate blocks of the same conditions
# Also notch filters powerline noise and hpf at 1Hz
############################################
if import_d:
for subject in subjects:
for condition in conditions:
import_data(subject, condition, srmr_nr, sampling_rate, esg_flag=False)
###################################################
# Split into frequency bands of interest
###################################################
if split_bands_flag:
for subject in subjects:
for condition in conditions:
create_frequency_bands_rs(subject, condition, srmr_nr, sampling_rate, channel_type='eeg')