[FieldTrip] Timestamp format using ft_spike functions

Dominic Depke dominic.depke at ruhr-uni-bochum.de
Thu Nov 6 13:57:47 CET 2014

Hi Robert,


Thanks for your answer. Actually I’m  working with a dataformat which is
currently not supported (Sonfiles, .smr), but it is possible to access and
export the data in various timeformats (including clockticks, microseconds
etc.) using functions from the SON-library provided by SigTOOL. 


Now  I would like to know whether I can simply create my own raw data
structure for further analysis using functions from the spike-toolbox or do
ft_spike functions still deal with different timecode-formats once the raw
data has been read into memory (so how should the (raw) spike data be
represented if no fileformat is specified)? 


Here’s just an example of my import procedure:


fid = fopen(‘filename.smr'); %open file and return filehandle

info_tmp = SONChanList(fid); %get channelinformation

spike = [];


kind = reshape({info_tmp.kind},size({info_tmp.kind},2),1); %find units and

if any(cell2mat(kind(:)) == 6) == 0

    error('no spike channels detected')


%find indices and names of spikechannels

%kind = 1 -> waveform, kind = 6 -> wavemark (spikes)

[wvmk] = find((cell2mat({info_tmp.kind})) == 6); %get index of

spikechan = [info_tmp(wvmk)]; 

spike.label = reshape({spikechan.title},size({spikechan.title},2),1);

sident = [spikechan.number];

%import channeldata

for i = 1:length(sident)

    n = sident(i);

    tmp =  [SONGetChannel(fid,n,'ticks')]; %export as clockticks

    spike.timestamp{1,i} = reshape([tmp.timings],1,size([tmp.timings],1));
%index (clockticks) of first spike-sample

    spike.waveform{1,i}(1,:,:) = double(tmp.adc)*1/6553.6; %10 V range; 16
bit int units to double (1x 32 datapoints per sike x timestamps)

    %create channelheader:

    %samplinginterval in Hz

    spike.hdr.Fs{1,i} = 1/(SONGetSampleInterval(fid,sident)*1e-6);

    spike.hdr.label{1,i} = {spikechan.title(i)}; 



So in this case spikes are just represented by their clocktick-indices as
well as the rest of the data. Since I know the sampling rate and the index
of the first spike-datapoint (which would be similar to the
timestamppersample field in the tutorials) it should be easy to synchronize
them with the continuous LFP data. I assume that all the required fields are
present in my spike structure but I am unsure about how fieldtrip functions
deal with my timestamp representation.


Thanks and best regards,



Von: fieldtrip-bounces at science.ru.nl
[mailto:fieldtrip-bounces at science.ru.nl] Im Auftrag von Robert Oostenveld
Gesendet: Mittwoch, 5. November 2014 19:30
An: FieldTrip discussion list
Betreff: Re: [FieldTrip] Timestamp format using ft_spike functions


Hi Dominic,


Timestamps are encoded in the original representation of the corresponding
acquisition system. For Plexon that means that they are at 40kHz, for
Neuralynx they are approximately 1MHz. This allows the different types of
data acquired with the system (spikes, LFP, events) to be synchronized. 


best regards,





On 31 Oct 2014, at 16:47, Dominic Depke <dominic.depke at ruhr-uni-bochum.de>

Dear all,


I have a question regarding the data structure of spikedata.

Especially I would like to ask how timestamps are encoded in the
spike.timestamp structure (which timecode format e.g. clockticks,
micro/mili/seconds) for further analysis in fieldtrip.



Thanks and best wishes,



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Dominic Depke, M.Sc.

PhD student

Institut für Physiologie I

Robert-Koch-Straße 27a

DE-48149 Münster

Tel. : +49 251-83-58112

Email: depke at uni-muenster.de



fieldtrip mailing list
 <mailto:fieldtrip at donders.ru.nl> fieldtrip at donders.ru.nl


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20141106/f9d7341a/attachment-0002.html>

More information about the fieldtrip mailing list