User Tools

Site Tools


analysis:course-w16:week7

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
analysis:course-w16:week7 [2016/02/01 11:42]
mvdm [Options and parameters for FieldTrip spectrograms]
analysis:course-w16:week7 [2018/07/07 10:19] (current)
Line 8: Line 8:
   * Apply your knowledge of spectral leakage to the selection of spectrogram parameters   * Apply your knowledge of spectral leakage to the selection of spectrogram parameters
   * Cultivate an awareness of common pitfalls in spectrogram-based analysis   * Cultivate an awareness of common pitfalls in spectrogram-based analysis
-  * Get started with using the fieldtrip ​toolbox+  * Get started with using the %%FieldTrip%% ​toolbox
  
 Resources: Resources:
Line 63: Line 63:
 axis xy; xlabel('​time (s)'); ylabel('​Frequency (Hz)'​);  ​ axis xy; xlabel('​time (s)'); ylabel('​Frequency (Hz)'​);  ​
 </​code>​ </​code>​
 +
 +(If you can't access the server, I put this session on Google Drive [[https://​drive.google.com/​file/​d/​0BzgbmK-cayRENFY2dEFWNG5XWWM/​view?​usp=sharing | here]].)
  
 You should see: You should see:
Line 166: Line 168:
  
 <code matlab> <code matlab>
-cscR = restrict(csc,​3300,​3340); ​% if you don't have this, implement it (it's one line of code!)+cscR = restrict(csc,​3300,​3340);​
  
 [S,F,T,P] = spectrogram(cscR.data,​rectwin(256),​128,​1:​200,​Fs);​ [S,F,T,P] = spectrogram(cscR.data,​rectwin(256),​128,​1:​200,​Fs);​
Line 203: Line 205:
 === Processing Neuralynx events files (.nev) === === Processing Neuralynx events files (.nev) ===
  
-Apart from neural data stored in ''​.ncs''​ and ''​.ntt''​ files, the Neuralynx system also stores //events// in a file called ''​Events.Nev''​ (see [[analysis:nsb2015:​week2|Module 2]] for details). Here is an example usage for the specific task in this data:+Apart from neural data stored in ''​.ncs''​ and ''​.ntt''​ files, the Neuralynx system also stores //events// in a file called ''​Events.Nev''​ (see [[analysis:course-w16:​week2|Module 2]] for details). Here is an example usage for the specific task in this data:
  
 <code matlab> <code matlab>
Line 252: Line 254:
 ==== Event-triggered spectrograms using FieldTrip ==== ==== Event-triggered spectrograms using FieldTrip ====
  
-[[http://​fieldtrip.fcdonders.nl/​ | FieldTrip]] is a toolbox originally developed for the analysis of human EEG and MEG data. Because these settings have historically faced complex signal processing challenges, such as eyeblink artifact removal, source reconstruction,​ and mapping across many electrodes, the methods developed to address these challenges are mature and have much to offer to rodent electrophysiologists+[[http://​fieldtrip.fcdonders.nl/​ | FieldTrip]] is a toolbox originally developed for the analysis of human EEG and MEG data. Because these settings have historically faced complex signal processing challenges, such as eyeblink artifact removal, source reconstruction,​ and mapping across many electrodes, the methods developed to address these challenges are mature and have much to offer, particularly ​to rodent electrophysiologists
  
 The FieldTrip toolbox continues to be actively developed and maintained, primarily at the [[http://​www.ru.nl/​donders/​ | Donders Institute for Brain, Cognition and Behaviour]] in Nijmegen. It is supported by a popular [[http://​fieldtrip.fcdonders.nl/​discussion_list | mailing list]], extensive documentation with [[http://​fieldtrip.fcdonders.nl/​tutorial | tutorials]],​ and various workshops organized across the globe (such as [[http://​fieldtrip.fcdonders.nl/​workshop/​toronto | this one]] in Toronto). The FieldTrip toolbox continues to be actively developed and maintained, primarily at the [[http://​www.ru.nl/​donders/​ | Donders Institute for Brain, Cognition and Behaviour]] in Nijmegen. It is supported by a popular [[http://​fieldtrip.fcdonders.nl/​discussion_list | mailing list]], extensive documentation with [[http://​fieldtrip.fcdonders.nl/​tutorial | tutorials]],​ and various workshops organized across the globe (such as [[http://​fieldtrip.fcdonders.nl/​workshop/​toronto | this one]] in Toronto).
Line 258: Line 260:
 === Loading Neuralynx data into FieldTrip === === Loading Neuralynx data into FieldTrip ===
  
-☛ If you haven'​t already done so, clone the lab'​s ​[[https://​github.com/​fieldtrip/​fieldtrip|FieldTrip repository on GitHub]]. Make sure you have a shortcut that sets up MATLAB'​s path to include it.+☛ If you haven'​t already done so, clone the [[https://​github.com/​fieldtrip/​fieldtrip|FieldTrip repository on GitHub]]. Make sure you have a shortcut that sets up MATLAB'​s path to include it. Also do a ''​git pull''​ of the course repository. 
 + 
 +:!: **IMPORTANT:​ to make this section work, your path shortcut should add %%FieldTrip%% first, the course repository second!** :!: This ensures that our (modified) functions take precedence over the %%FieldTrip%% code.
  
 Let's load our familiar ventral striatal LFP into FieldTrip: Let's load our familiar ventral striatal LFP into FieldTrip:
Line 441: Line 445:
 %% load the data %% load the data
 fc = FindFiles('​*.ncs'​);​ % get filenames of all LFPs recorded fc = FindFiles('​*.ncs'​);​ % get filenames of all LFPs recorded
-data = ft_read_neuralynx_interp(fc);​ % load them all -- this will take a while+data_all ​= ft_read_neuralynx_interp(fc);​ % load them all -- this will take a while
 data_all.hdr.Fs = data_all.fsample;​ % for some reason this is missing from the header data_all.hdr.Fs = data_all.fsample;​ % for some reason this is missing from the header
  
Line 447: Line 451:
 cfg = []; cfg = [];
 cfg.layout = '​ordered';​ cfg.channel = data.label; cfg.layout = '​ordered';​ cfg.channel = data.label;
-layout = ft_prepare_layout(cfg, ​data);+layout = ft_prepare_layout(cfg, ​data_all);
 </​code>​ </​code>​
  
Line 529: Line 533:
  
 Test your code with the same events used to generate the event-triggered spectrogram above. Do you think the average is a reasonable charaterization of what is happening in the LFP for these events? Test your code with the same events used to generate the event-triggered spectrogram above. Do you think the average is a reasonable charaterization of what is happening in the LFP for these events?
 +
 +☆ Choose your own challenge! Make sure to discuss your idea(s) with me first. Remember, this module concludes the first half of the course, and you should pick something from this first set of modules.
analysis/course-w16/week7.1454344921.txt.gz · Last modified: 2018/07/07 10:19 (external edit)