|
@@ -0,0 +1,406 @@
|
|
|
+# How to start
|
|
|
+
|
|
|
+
|
|
|
+written by Hio-Been Han, hiobeen.han@gmail.com, 2023-08-23.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+This guide will provide instructions on accessing the dataset uploaded to the GIN G-Node repository [hiobeen/Mouse-threat-and-escape-CBRAIN] ([https://gin.g-node.org/hiobeen/Mouse-threat-and-escape-CBRAIN](https://gin.g-node.org/hiobeen/Mouse-threat-and-escape-CBRAIN)).
|
|
|
+
|
|
|
+
|
|
|
+## EEG dataset
|
|
|
+
|
|
|
+
|
|
|
+Most of all, the overall dataset structure adheres to the BIDS-EEG format introduced by Pernet et al. (2019). Within the top-level directory 'data_BIDS/', the EEG data is organized under paths starting with 'sub-\#\#/'. These EEG recordings (mouse n = 8) were recorded under the Threat-and-escape paradigm experiment, which involves dynamic interactions with a spider robot. This experiment was done in two separate conditions: the solitary condition, where a mouse was exposed to the robot alone in the arena (referred to as the 'Single' condition), and the group condition, where mice encountered the robot alongside other conspecifics (referred to as the 'Group' condition). CBRAIN headstage (Kim et al., 2019) was employed to record this EEG data at a sampling rate of 1024 Hz. The recordings were taken from the medial prefrontal cortex (channel 1) and the basolateral amygdala (channel 2). For a comprehensive understanding of the experimental methods and procedures, please see our original publications: Han et al. (in press), Cho et al. (2023), and Kim et al. (2020).
|
|
|
+
|
|
|
+
|
|
|
+## Position dataset
|
|
|
+
|
|
|
+
|
|
|
+Secondly, the EEG measurements and simultaneously recorded video data are stored under the directory 'stimuli/video/'. You have the option to extract frame files from the video for a direct comparison between the neural activity and the instantaneous movement parameters derived from the video. Additionally, we have also uploaded the mouse's instantaneous position extracted from each video. These positions are located in the 'stimuli/position/' directory.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+It's important to note that the position tracking process differs for single-condition and group-condition videos. For single-condition videos, the position tracking is performed using the U-Net architecture of CNN (Ronnenberger, 2015; also see, Han et al. in press for detailed procedure). This method tracks the body area's location to extract its centroid. On the other hand, for group-condition videos, a custom-built script is used (based on OpenCV in Python, described in Kim et al., 2020). This script tracks the headstage's location for each mouse to extract its head position. Consequently, the two position datasets contain distinct information: body position for single-condition and headstage position for group-condition. Please be aware of these differences if you intend to analyze this data.
|
|
|
+
|
|
|
+
|
|
|
+## References
|
|
|
+
|
|
|
+
|
|
|
+Pernet, C. R., Appelhoff, S., Gorgolewski, K. J., Flandin, G., Phillips, C., Delorme, A., \& Oostenveld, R. (2019). EEG-BIDS, an extension to the brain imaging data structure for electroencephalography. *Scientific data*, *6*(1), 103.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Kim, J., Kim, C., Han, H. B., Cho, C. J., Yeom, W., Lee, S. Q., \& Choi, J. H. (2020). A bird’s-eye view of brain activity in socially interacting mice through mobile edge computing (MEC). *Science Advances*, *6*(49), eabb9841.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Cho, S., \& Choi, J. H. (2023). A guide towards optimal detection of transient oscillatory bursts with unknown parameters. *Journal of Neural Engineering*.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Ronneberger, O., Fischer, P., \& Brox, T. (2015). U-net: Convolutional networks for biomedical image segmentation. In *Medical Image Computing and Computer-Assisted Intervention–MICCAI 2015: 18th International Conference, Munich, Germany, October 5-9, 2015, Proceedings, Part III 18* (pp. 234-241). Springer International Publishing.
|
|
|
+
|
|
|
+
|
|
|
+# Part 0) Environment setup for eeglab extension
|
|
|
+
|
|
|
+
|
|
|
+Since the EEG data is in the eeglab dataset format (*.set/*.fdt), installing the eeglab toolbox (Delorme \& Makeig, 2004) is necessary to access the data. For details on the installation process, please refer to the following webpage: [https://eeglab.org/others/How_to_download_EEGLAB.html](https://eeglab.org/others/How_to_download_EEGLAB.html)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+% Adding eeglab-installed directory to MATLAB path
|
|
|
+eeglab_dir = './subfunc/external/eeglab2023.0';
|
|
|
+addpath(genpath(eeglab_dir));
|
|
|
+```
|
|
|
+
|
|
|
+# Part 1) EEG data overview
|
|
|
+## 1-1) Loading single EEG dataset
|
|
|
+
|
|
|
+
|
|
|
+In this instance, we'll go through loading EEG data from a single session and visualizing a segment of that data. For this specific example, we'll use Mouse 1, Session 1, under the Single condition.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+path_base = './data_BIDS/';
|
|
|
+mouse = 1;
|
|
|
+sess = 1;
|
|
|
+eeg_data_path = sprintf('%ssub-%02d/ses-%02d/eeg/',path_base, mouse, sess);
|
|
|
+eeg_data_name = dir([eeg_data_path '*.set']);
|
|
|
+EEG = pop_loadset('filename', eeg_data_name.name, 'filepath', eeg_data_name.folder, 'verbose', 'off');
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```text:Output
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+After loading this data, we can visualize tiny piece of EEG time trace (2 seconds) as follow.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+win = [1:2*EEG.srate] + EEG.srate*60; % 2 seconds arbitary slicing for example
|
|
|
+fig = figure(1); clf
|
|
|
+plot_multichan( EEG.times(win), EEG.data(:,win));
|
|
|
+xlabel('Time (sec)')
|
|
|
+title(sprintf('Example EEG time trace, [%s]',eeg_data_name.name))
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+![figure_0.png](how_to_start_images/figure_0.png)
|
|
|
+
|
|
|
+## 1-2) Visualizing example spectrogram
|
|
|
+
|
|
|
+
|
|
|
+Each dataset contains 240 seconds of EEG recording, under the procedure of threat-and-escape paradigm described in the original publication. To visualize overall pattern of EEG activities in one example dataset, a spectrogram can be obtained as follow.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+FIY, the threat-and-escape procedure is consist of four different stages.
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Stage 1: (Robot absent) Baseline (0-60 sec)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Stage 2: (Robot present) Robot attack (60-120 sec)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Stage 3: (Robot present) Gate to safezone open (120-180 sec)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Stage 4: (Robot absent) No threat (180-240 sec)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+% Calculating spectrogram
|
|
|
+ch = 1;
|
|
|
+[spec_d, spec_t, spec_f] = get_spectrogram( EEG.data(ch,:), EEG.times );
|
|
|
+spec_d = spec_d*1000; % Unit scaling - millivolt to microvolt
|
|
|
+
|
|
|
+% Visualization
|
|
|
+fig = figure(2); clf
|
|
|
+imagesc( spec_t, spec_f, spec_d' ); axis xy
|
|
|
+xlabel('Time (sec)'); ylabel('Frequency (Hz)');
|
|
|
+axis([0 240 1 60])
|
|
|
+hold on
|
|
|
+plot([1 1]*60*1,ylim,'w-');
|
|
|
+plot([1 1]*60*2,ylim,'w-');
|
|
|
+plot([1 1]*60*3,ylim,'w-');
|
|
|
+set(gca, 'XTick', [0 60 120 180 240])
|
|
|
+colormap('jet')
|
|
|
+cbar=colorbar; ylabel(cbar, 'Amplitude (\muV^2/Hz)')
|
|
|
+caxis([0 20])
|
|
|
+title(sprintf('Example spectrogram, [%s]',eeg_data_name.name))
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+![figure_1.png](how_to_start_images/figure_1.png)
|
|
|
+
|
|
|
+## 1-3) Visualizing grand-averaged spectrogram
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+n_mouse = 8; % number of mouse
|
|
|
+n_sess = 16; % number of session
|
|
|
+n_ch = 2; % number of channel
|
|
|
+spec = single([]);
|
|
|
+for mouse = 1:n_mouse
|
|
|
+ for sess = 1:n_sess
|
|
|
+ eeg_data_path = sprintf('%ssub-%02d/ses-%02d/eeg/',path_base, mouse, sess);
|
|
|
+ eeg_data_name = dir([eeg_data_path '*.set']);
|
|
|
+ EEG = pop_loadset('filename', eeg_data_name.name, 'filepath', eeg_data_name.folder, 'verbose', 'off');
|
|
|
+ for ch = 1:n_ch
|
|
|
+ [spec_d, spec_t, spec_f] = get_spectrogram( EEG.data(ch,:), EEG.times );
|
|
|
+ spec(:,:,ch,mouse,sess) = spec_d*1000; % Unit scaling - millivolt to microvolt
|
|
|
+ end
|
|
|
+ end
|
|
|
+end
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```text:Output
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-01\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-02\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-03\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-04\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-05\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-06\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-07\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-01\eeg\Day1-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-02\eeg\Day1-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-03\eeg\Day1-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-04\eeg\Day1-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-05\eeg\Day2-Trial1-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-06\eeg\Day2-Trial2-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-07\eeg\Day2-Trial3-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-08\eeg\Day2-Trial4-Single.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-09\eeg\Day1-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-10\eeg\Day1-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-11\eeg\Day1-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-12\eeg\Day1-Trial4-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-13\eeg\Day2-Trial1-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-14\eeg\Day2-Trial2-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-15\eeg\Day2-Trial3-Group.fdt'...
|
|
|
+Reading float file 'D:\Mouse-threat-and-escape-CBRAIN\data_BIDS\sub-08\ses-16\eeg\Day2-Trial4-Group.fdt'...
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+Now we have spectrograms derived from all recordings (n = 8 mice x 8 sessions x 2 single/group conditions). Before visualizing the grand-averaged spectrogram, we will first perform baseline correction. This is done by subtracting the mean value of each frequency component during the baseline period (Stage 1, 0-60 sec).
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+fig = figure(1); clf
|
|
|
+for ch = 1:2
|
|
|
+ % calculating grand-averaged spectrogram
|
|
|
+ spec_avg = mean(mean(spec(:,:,ch,:,:),5),4);
|
|
|
+
|
|
|
+ % baseline correction
|
|
|
+ stage_1_win = 1:size( spec_avg,1 )/4;
|
|
|
+ spec_baseline = repmat( mean( spec_avg(stage_1_win,:), 1 ), [size(spec_avg,1), 1]);
|
|
|
+ spec_norm = spec_avg - spec_baseline;
|
|
|
+
|
|
|
+ % single channel visualization
|
|
|
+ subplot(2,1,ch)
|
|
|
+ imagesc( spec_t, spec_f, spec_norm' ); axis xy
|
|
|
+ xlabel('Time (sec)'); ylabel('Frequency (Hz)');
|
|
|
+ axis([0 240 1 60])
|
|
|
+ hold on
|
|
|
+ plot([1 1]*60*1,ylim,'w-');
|
|
|
+ plot([1 1]*60*2,ylim,'w-');
|
|
|
+ plot([1 1]*60*3,ylim,'w-');
|
|
|
+ set(gca, 'XTick', [0 60 120 180 240])
|
|
|
+ colormap('jet')
|
|
|
+ cbar=colorbar; ylabel(cbar, '\DeltaAmplitude (\muV^2/Hz)')
|
|
|
+ caxis([-1 1]*3/ch)
|
|
|
+ title(sprintf('Grand-averaged spectrogram [Channel %d]',ch))
|
|
|
+end
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+![figure_2.png](how_to_start_images/figure_2.png)
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+% Coexistence matrix 계산 넣을까 말까 고민중
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+# (2) Accessing position data
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+% Example session position data visualization - single condition
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+% Example session position data visualization - group condition
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+% Overlay frame image + position data
|
|
|
+frames_path = './data_BIDS/stimuli/video_parsed/';
|
|
|
+if ~isdir(frames_path), parse_video_rgb(); end
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+# (3) Applying position data for EEG data analysis
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+% 속도에 따라서 power spectrum 달라지는거 보여주기
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+% 위치에 따른 power mapping - 할까말까 고민중
|
|
|
+```
|
|
|
+
|
|
|
+# (4) Burst detection 관련 내용 (성준)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+```
|
|
|
+
|
|
|
+
|
|
|
+```matlab:Code
|
|
|
+
|
|
|
+```
|
|
|
+
|