[FieldTrip] fieldtrip Digest, Vol 146, Issue 15

Peter Kaskan peter.kaskan at einsteinmed.edu
Tue Jan 24 23:01:11 CET 2023


Hi Jan-Mathijs,

I think ft_read_data.m is calling read_neuralynx_ncs.m

I just get this one warning ("predicted number of timestamps and observed number of timestamps differ by 157859.33")

But it does not seem like a real crash, so I have just been looking at these two scripts to figure out what conversion rates, recording duration, # timestamps they are looking for in my ncs data file.

The header from my file is posted below, but it does not contain much info, which makes me think these two scripts are calculating timestamps from the actual data.

Do you have a guess as to where that can go wrong?

Thank you!


Relevant Section From ft_read_data.m:
timestamps and observed number case 'neuralynx_ncs'
    NRecords  = hdr.nSamples/512;
    begrecord = ceil(begsample/512);
    endrecord = ceil(endsample/512);
    % read the records that contain the desired samples
    ncs = read_neuralynx_ncs(filename, begrecord, endrecord);
    % cut out the desired samples
    begsample = begsample - (begrecord-1)*512;
    endsample = endsample - (begrecord-1)*512;
    if istrue(timestamp)
      ncs.dat = cast(ncs.dat, class(ncs.TimeStamp));
      d = ncs.TimeStamp(2:end)-ncs.TimeStamp(1:end-1);
      medianTimestampPerBlock  = median(double(d)); % to avoid influence of the gaps
      TimestampPerSample       = medianTimestampPerBlock/512; % divide by known block size
      cls = class(ncs.TimeStamp);
      % replace the data with the timestamp of each sample
      for i=1:512
        ncs.dat(i,:) = ncs.TimeStamp + cast((i-1)*TimestampPerSample,cls);
      end
    end
    % this selects samples and also reshape the data from 512*Nrecords into a linear array (row)
    dat = ncs.dat(begsample:endsample);
    dat = dat(:)';timestamps differ by 157859.33


Header data from .ncs file

######## Neuralynx Data File Header

-FileType NCS

-FileVersion 3.4

-FileUUID f3e488f2-c8dc-43a4-b9c5-5e650611dafa

-SessionUUID e37a8e42-e3e0-4d3f-88c2-02cbe9b25662

-ProbeName

-OriginalFileName "D:\PegasusData\2022-10-12_10-11-21\CSC1.ncs"

-TimeCreated 2022/10/12 10:11:49

-TimeClosed 2022/10/12 10:50:37



-RecordSize 1044

-ApplicationName Pegasus "2.2.2 "

-AcquisitionSystem AcqSystem1 ATLAS

-ReferenceChannel "Source 01 Reference 1"

-SamplingFrequency 4000

-ADMaxValue 32767

-ADBitVolts 0.000000030517578125000001

-AcqEntName CSC1

-NumADChannels 1

-ADChannel 0

-InputRange 1000

-InputInverted True



-DSPLowCutFilterEnabled True

-DspLowCutFrequency 0.1

-DspLowCutNumTaps 0

-DspLowCutFilterType DCO

-DSPHighCutFilterEnabled True

-DspHighCutFrequency 1000

-DspHighCutNumTaps 256

-DspHighCutFilterType FIR

-DspDelayCompensation Enabled

-DspFilterDelay_µs 7969











------------------------------

Message: 3
Date: Mon, 23 Jan 2023 17:07:16 +0000
From: "Schoffelen, J.M. (Jan Mathijs)"
        <janmathijs.schoffelen at donders.ru.nl>
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Subject: Re: [FieldTrip] ft_read_data gives discontinuous data warning
        with NeuraLynx .csc files
Message-ID: <193E2328-4072-44E3-AE71-0BE05D52F1A5 at donders.ru.nl>
Content-Type: text/plain; charset="utf-8"

Hi Peter,

I have not worked with neuralynx data for a very long time, so any comment should be taken with a grain of salt, but I’d be tempted to say that if the computer says so, the feature in the data that causes the warning is actually in the data.

I don’t see anything in the code base about a specific warning being thrown, and since you haven’t mentioned this in your original post: could it be that the warning is issued by the external mex-file that you installed from some other source?

Best wishes,
Jan-Mathijs


On 20 Jan 2023, at 18:43, Peter Kaskan via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello all,

I am recording intracranial EEG data with a NeuraLynx Atlas system.

I'm using ft_read_data on my folder of NeuraLynx .csc channels, but I am getting a warning message.

Warning: discontinuous recording, predicted number of timestamps and observed number of timestamps differ by 157859.33

Please consult https://urldefense.com/v3/__https://nam04.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__http*3A*2F*2Fwww.fieldtriptoolbox.org*2Ffaq*2Fdiscontinuous_neuralynx__*3B!!HJOPV4FYYWzcc1jazlU!8K283C6P04ak2bqEwzaFMAVPf1gigaeF1naXZzxeH33hMZONsxksfamY0d-AKYCtsFN505W_tpHRjGyIYIMJQ-dZZahTazhwjFJO7A*24&data=05*7C01*7Cpeter.kaskan*40einsteinmed.edu*7C288a031652c54fca083708dafdeb430d*7C9c01f0fd65e040c089a82dfd51e62025*7C0*7C0*7C638101484148513853*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C&sdata=RAe*2FExDwIe2mOfv4XmdG6JNz5jkuBFKQ7Gic*2FgtLvz0*3D&reserved=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUl!!HJOPV4FYYWzcc1jazlU!4oX-yG18mdNNL-hrpJw5Chqpx8fYNL3z81oVLXIUwn5mfXDoMv1DAjVCxCy9PhyQfOyCHAiBPAZW-HU9GtN0fxK7oq7MyHwSsA$  <https://urldefense.com/v3/__https://nam04.safelinks.protection.outlook.com/?url=https*3A*2F*2Furldefense.com*2Fv3*2F__http*3A*2F*2Fwww.fieldtriptoolbox.org*2Ffaq*2Fdiscontinuous_neuralynx__*3B!!HJOPV4FYYWzcc1jazlU!7-_XqLVpShrv9VUuhF00Lr3AAbVFRKcf7GHuVU6BbKsOQD7GYgiyfblZNzX6KCdvgDlJ_K09LwPU2DqtoZA0WcvCZ23Y9wClew*24&data=05*7C01*7Cpeter.kaskan*40einsteinmed.edu*7C288a031652c54fca083708dafdeb430d*7C9c01f0fd65e040c089a82dfd51e62025*7C0*7C0*7C638101484148513853*7CUnknown*7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0*3D*7C3000*7C*7C*7C&sdata=XNIYCHvw0dNZnJCCRP3wXOfN37X4fThKJWytKNgxQiU*3D&reserved=0__;JSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJSUlJQ!!HJOPV4FYYWzcc1jazlU!4oX-yG18mdNNL-hrpJw5Chqpx8fYNL3z81oVLXIUwn5mfXDoMv1DAjVCxCy9PhyQfOyCHAiBPAZW-HU9GtN0fxK7oq61BAfrnw$ >

This little bit of info only seems to tell one how to deal with that if true; not if this is an error. I do not believe the data is discontinuous.

Has anyone got this discontinuous error message with NeuraLynx .csc files that should be / were recorded continuously?

The low-level read_neuralynx_ncs function detects the presence of gaps in the .ncs file and issues a warning.
Can the detection fail, do I really have discontinuous data?

Thanks, Peter




Peter M. Kaskan, Ph.D.
Assistant Professor
Albert Einstein College of Medicine
Leo M. Davidoff Department of Neurological Surgery
1410 Pelham Parkway South
Kennedy Center Room 429B
Bronx, NY 10461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230124/c067da2e/attachment.htm>


More information about the fieldtrip mailing list