Representation of spiketrain data after readout
Spiketrain data can be described as a series of timepoints where spikes occurred, with accompanying waveforms. After reading out the data using ft_preprocessing, ft_read_data, or a custom import functions or scripts, the spike data has the format
Processing spiketrains relative to a trigger event
After the raw spiketrain data has been read in, we restructure it relative to event triggers, i.e., we add a trial dimension to it. This serves two goals. First, by making trials, we can proceed with further analyses, such as peristimulus histograms, raster plots etc. Second, by making trials, the data can be linked to the LFP data which we assume is represented in the Fieldtrip data format, with fields data.trial and data.time.
For making trials, one uses the function ft_spike_maketrials. The idea of this function is to convert the spike format to a structure having the following additional fields:
Together, these three fields fully define the structure of the spiketrain. The field spike.time tells us where the spikes occurred in time, the field spike.trial tells us in which trial they occurred. This information is not yet sufficient to fully identify the structure of the spike-train, because the number of trials is not specified, and the beginning and end times of the trials are not specified. This is solved by the additional field spike.trialtime.
The critical input to ft_spike_maketrials is the input cfg.trl. This field has a similar role as cfg.trl in ft_preprocessing. The first two column specify the beginning and the end of the trials in time-stamps. Thus, the trigger event (e.g., the onset of a visual stimulus) must be specified on the same time-axis as the spikes in spike.timestamp. The third column of cfg.trl serves a similar role as the third column of cfg.trl in ft_preprocessing. It indicates the offset of the trigger relative to t = 0. For example, an offset of -1000 indicates that the trigger occurred 1000 timestamps after t = 0. Another required field is cfg.timestampspersecond. This information is necessary to convert the raw timestamp (with an unknown relationship to seconds) to seconds. For the neuralynx system, one typically has cfg.timestampspersecond = 1000000, although timestamps are sometimes represented in 100's of microseconds, in which case cfg.timestampspersecond = 10000.
This point-representation of the spikes in this format is very efficient, because we only store a value for those points at which spikes occurred, and we do not store a value for times at which no spikes occurred (as opposed to a binary representation of the spiketrain).
Conversion to a binary format
For some analyses, e.g. a spike-density analysis (ft_spikedensity), it is desirable to convert the point-representation of the spiketrains to a binary representation (i.e., as arrays of zeros and ones). This is achieved using the function ft_spike_spike2data, which creates a standard data format with the fields data.trial and data.time. It is also possible to convert the binary representation back to the point-representation, using the function ft_spike_data2spike.
Share this page: