User Tools

Site Tools


Overview of data files

A promoted (i.e. pre-processed, annotated, and approved) data folder consists of most of the following files:

  • *.Ncs files: continuously sampled data, “local field potentials”
  • (*.ntt files: raw tetrode files, these are generally not included)
  • *.Nev file: raw Events file
  • *.Nvt file: video tracking file (usually zipped)

The above are raw data files stored by Neuralynx. The following files are the result of preprocessing and annotation:

  • *.t files: spike times for one putative neuron (output from MClust)
  • *.clusters: cluster information (output from MClust, you will generally not need this)
  • *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. (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)
  • *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.

Basic data loading

The below will only work if you have grabbed the vandermeerlab code base and added it to your MATLAB path (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:

>> S = LoadSpikes(FindFiles('*.t'));

this gives a cell array S with one cell for each spike train, stored in a ts object:

>> plot(Data(S{1}),0,'.k'); % crude plot

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:

>> csc = LoadCSC(FindFile('*CSC1a.Ncs'),'ConvertToS',1);
>> plot(Range(csc),Data(csc));

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:

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

We will now use the ExpKeys file and Restrict to only include data when the rat was actually on the track:

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

Description of the Multiple-T task



This is example of a Metadata struct, taken from session ZXXX

>> Metadata
Metadata = 
         Feeders: {[1x1 struct]  [1x1 struct]  [1x1 struct]  [1x1 struct]}
          Events: {[1x1 struct]  [1x1 struct]  [1x1 struct]}
     TimeOnTrack: 627.5610
    TimeOffTrack: 3.0261e+03
      SwitchTime: 1.7264e+03
        goodFood: 'y'
         Markers: [1x1 struct]
         Linpath: [1x1 struct]
analysis/adrlab.txt · Last modified: 2018/07/07 10:19 (external edit)