User Tools

Site Tools


analysis:adrlab

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:adrlab [2013/07/03 10:53]
mvdm
analysis:adrlab [2018/07/07 10:19] (current)
Line 4: Line 4:
  
    * *.Ncs files: continuously sampled data, "local field potentials"​    * *.Ncs files: continuously sampled data, "local field potentials"​
-   * *.ntt files: raw tetrode files, ​you will generally not need to load these+   ​* ​(*.ntt files: raw tetrode files, ​these are generally not included)
    * *.Nev file: raw Events file    * *.Nev file: raw Events file
    * *.Nvt file: video tracking file (usually zipped)    * *.Nvt file: video tracking file (usually zipped)
Line 12: Line 12:
    * *.t files: spike times for one putative neuron (output from MClust)    * *.t files: spike times for one putative neuron (output from MClust)
    * *.clusters: cluster information (output from MClust, you will generally not need this)    * *.clusters: cluster information (output from MClust, you will generally not need this)
-   * *wv.mat and *ClusterQual.mat files: waveforms and cluster quality metrics +   * *wv.mat and *%%ClusterQual%%.mat files: waveforms and cluster quality metrics 
-   * *Metadata.mat file: structured task-related information such as locations of feeders, times of rewards, etc. +   * *Metadata.mat file: structured task-related information such as locations of feeders, times of rewards, etc. (not included in all sessions) 
-   * *ExpKeys.m file: basic information about this recording session, such as task, start time, end time, etc. (note this is a .m file, so needs to be run rather than loaded as you would a .mat file) +   * *%%ExpKeys%%.m file: basic information about this recording session, such as task, start time, end time, etc. (note this is a .m file, so needs to be run rather than loaded as you would a .mat file) 
 +   * *vt.mat file: pre-processed video tracking data
  
 Note the naming convention for the above files: all files are identified by the RYYYY-MM-DD string in the filename, and recording files are further named with the tetrode number. Note the naming convention for the above files: all files are identified by the RYYYY-MM-DD string in the filename, and recording files are further named with the tetrode number.
  
 ===== Basic data loading ===== ===== Basic data loading =====
 +
 +The below will only work if you have grabbed the vandermeerlab code base and added it to your MATLAB path ([[computing:​matlabsetup|instructions]]). If you are using a Mac, you will need to get the data loading files from Neuralynx and add them to the relevant folders (you'​ll know where when you get errors upon trying to load something).
 +
 +First, change your current (working) folder to the recording session of interest.
 +
 +Spike time series from a single cluster (putative neuron) are stored in a *.t file. These files are generated by MClust after the spike sorting process is complete.
 +
 +To load all spike trains in a folder:
 +
 +<code matlab>
 +>> S = LoadSpikes(FindFiles('​*.t'​));​
 +</​code>​
 +
 +this gives a cell array S with one cell for each spike train, stored in a ts object:
 +
 +<code matlab>
 +>> plot(Data(S{1}),​0,'​.k'​);​ % crude plot
 +</​code>​
 +
 +This plots the spike times of the first cluster. A ts object is a custom (not built in into MATLAB) object with a number of methods (functions):​ the most useful are Data (get the spike times stored in it) and Restrict (restrict the spike times to specific times).
 +
 +To load and plot a CSC file:
 +
 +<code matlab>
 +>> csc = LoadCSC(FindFile('​*CSC1a.Ncs'​),'​ConvertToS',​1);​
 +>> plot(Range(csc),​Data(csc));​
 +</​code>​
 +
 +Note that %%LoadCSC%% returns a tsd object ("​timestamped data") which consists of matching arrays of times and data. As with ts objects, Range() returns the times, but now there is also Data() which returns the data.
 +
 +Be aware that this time series can be restricted to the time the rat was actually freely moving and engaged in behavior; use the %%ExpKeys%% file and the Restrict function explained below to do this.
 +
 +To access the position data, first load the *vt.mat file (which contains the x and y tsd objects) and then do:
 +
 +<code matlab>
 +x_data = Data(Vt.x);
 +y_data = Data(Vt.y);
 +plot(x_data,​y_data,'​.'​);​ % notice this has some extra tracking data outside of the track
 +</​code>​
 +
 +We will now use the %%ExpKeys%% file and Restrict to only include data when the rat was actually on the track:
 +
 +<code matlab>
 +run(FindFile('​*keys.m'​));​ % load experimental metadata; notice this is a script so we can run it
 +x = Restrict(Vt.x,​ExpKeys.TimeOnTrack,​ExpKeys.TimeOffTrack);​ % only include data from when rat was on track
 +y = Restrict(Vt.y,​ExpKeys.TimeOnTrack,​ExpKeys.TimeOffTrack);​
 +plot(Data(x),​Data(y),'​.'​);​ % looks better now
 +</​code>​
 +
  
 ====== Description of the Multiple-T task ====== ====== Description of the Multiple-T task ======
Line 44: Line 93:
          ​Linpath:​ [1x1 struct]          ​Linpath:​ [1x1 struct]
 </​code>​ </​code>​
- 
analysis/adrlab.1372863200.txt.gz · Last modified: 2018/07/07 10:19 (external edit)