<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
Hi Jan-Mathijs,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<span><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0">I think ft_read_data.m is calling read_neuralynx_ncs.m<br>
</span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<div><br class="ContentPasted0">
</div>
<div class="elementToProof"><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0">I just get this one warning ("</span><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0"><span style="background-color:white" class="ContentPasted0">predicted
 number of timestamps and observed number of timestamps differ by 157859.33</span>")</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white"><br class="ContentPasted0">
</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0">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.</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0"><br>
</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0">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. <br>
</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0"><br>
</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0">Do you have a guess as to where that can go wrong?</span></div>
<div><span style="color:black;font-size:12pt;font-family:Calibri,Arial,Helvetica,sans-serif;background-color:white" class="ContentPasted0"><br>
</span></div>
Thank you!</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<b><span class="ContentPasted1">Relevant Section From ft_read_data.m:</span></b></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<div><i><span><i><span style="color:black !important;font-size:12pt;background-color:white !important" class="ContentPasted1">
<blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 1ex; margin-left: 0.8ex; color: rgb(102, 102, 102);" itemscope="" itemtype="https://schemas.microsoft.com/QuotedText">
timestamps and observed number case 'neuralynx_ncs'
<div class="ContentPasted1">    NRecords  = hdr.nSamples/512;</div>
<div class="ContentPasted1">    begrecord = ceil(begsample/512);</div>
<div class="ContentPasted1">    endrecord = ceil(endsample/512);</div>
<div class="ContentPasted1">    % read the records that contain the desired samples</div>
<div class="ContentPasted1">    ncs = read_neuralynx_ncs(filename, begrecord, endrecord);</div>
<div class="ContentPasted1">    % cut out the desired samples</div>
<div class="ContentPasted1">    begsample = begsample - (begrecord-1)*512;</div>
<div class="ContentPasted1">    endsample = endsample - (begrecord-1)*512;</div>
<div class="ContentPasted1">    if istrue(timestamp)</div>
<div class="ContentPasted1">      ncs.dat = cast(ncs.dat, class(ncs.TimeStamp));</div>
<div class="ContentPasted1">      d = ncs.TimeStamp(2:end)-ncs.TimeStamp(1:end-1);</div>
<div class="ContentPasted1">      medianTimestampPerBlock  = median(double(d)); % to avoid influence of the gaps</div>
<div class="ContentPasted1">      TimestampPerSample       = medianTimestampPerBlock/512; % divide by known block size</div>
<div class="ContentPasted1">      cls = class(ncs.TimeStamp);</div>
<div class="ContentPasted1">      % replace the data with the timestamp of each sample</div>
<div class="ContentPasted1">      for i=1:512</div>
<div class="ContentPasted1">        ncs.dat(i,:) = ncs.TimeStamp + cast((i-1)*TimestampPerSample,cls);</div>
<div class="ContentPasted1">      end</div>
<div class="ContentPasted1">    end</div>
<div class="ContentPasted1">    % this selects samples and also reshape the data from 512*Nrecords into a linear array (row)</div>
<div class="ContentPasted1">    dat = ncs.dat(begsample:endsample);</div>
    dat = dat(:)';timestamps differ by 157859.33</blockquote>
</span></i></span></i></div>
<div><i><span><i><span style="color:black !important;font-size:12pt;background-color:white !important" class="ContentPasted1"><br>
</span></i></span></i></div>
<div><i><span><i><span style="color:black !important;font-size:12pt;background-color:white !important" class="ContentPasted1"><br>
</span></i></span></i></div>
</div>
<div class="elementToProof"><b><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">Header data from .ncs file</span></b></div>
<div class="elementToProof"><span style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-weight: 400;">
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">######## Neuralynx Data File
<span data-markjs="true" class="markpfhchnrhh ContentPasted2" data-ogac="" data-ogab="" data-ogsc="" data-ogsb="">
Header</span> </span></p>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-FileType NCS</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-FileVersion 3.4</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-FileUUID f3e488f2-c8dc-43a4-b9c5-5e650611dafa</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-SessionUUID e37a8e42-e3e0-4d3f-88c2-02cbe9b25662</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ProbeName
</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-OriginalFileName "D:\PegasusData\2022-10-12_10-11-21\CSC1.ncs"</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-TimeCreated 2022/10/12 10:11:49</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-TimeClosed 2022/10/12 10:50:37</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2"> </span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-RecordSize 1044</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ApplicationName Pegasus "2.2.2 "</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-AcquisitionSystem AcqSystem1 ATLAS</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ReferenceChannel "Source 01 Reference 1"</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-SamplingFrequency 4000</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ADMaxValue 32767</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ADBitVolts 0.000000030517578125000001</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-AcqEntName CSC1</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-NumADChannels 1</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-ADChannel 0</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-InputRange 1000</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-InputInverted True</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2"> </span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DSPLowCutFilterEnabled True</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspLowCutFrequency 0.1</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspLowCutNumTaps 0</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspLowCutFilterType DCO</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DSPHighCutFilterEnabled True</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspHighCutFrequency 1000</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspHighCutNumTaps 256</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspHighCutFilterType FIR</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspDelayCompensation Enabled</span></p>
</div>
<div>
<p class="x_x_MsoNormal" style="background:white"><span style="font-size:12.0pt;color:black" class="ContentPasted2">-DspFilterDelay_µs 7969</span></p>
</div>
<br>
</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<div><i><span><span style="color:rgb(102, 102, 102) !important"></span></span></i></div>
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);" class="elementToProof">
<br>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText elementToProof"><br>
------------------------------<br>
<br>
Message: 3<br>
Date: Mon, 23 Jan 2023 17:07:16 +0000<br>
From: "Schoffelen, J.M. (Jan Mathijs)"<br>
        <janmathijs.schoffelen@donders.ru.nl><br>
To: FieldTrip discussion list <fieldtrip@science.ru.nl><br>
Subject: Re: [FieldTrip] ft_read_data gives discontinuous data warning<br>
        with NeuraLynx .csc files<br>
Message-ID: <193E2328-4072-44E3-AE71-0BE05D52F1A5@donders.ru.nl><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi Peter,<br>
<br>
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.<br>
<br>
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?<br>
<br>
Best wishes,<br>
Jan-Mathijs<br>
<br>
<br>
On 20 Jan 2023, at 18:43, Peter Kaskan via fieldtrip <fieldtrip@science.ru.nl<mailto:fieldtrip@science.ru.nl>> wrote:<br>
<br>
Hello all,<br>
<br>
I am recording intracranial EEG data with a NeuraLynx Atlas system.<br>
<br>
I'm using ft_read_data on my folder of NeuraLynx .csc channels, but I am getting a warning message.<br>
<br>
Warning: discontinuous recording, predicted number of timestamps and observed number of timestamps differ by 157859.33<br>
<br>
Please consult <a href="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$" data-auth="NotApplicable">
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</a>
 <<a href="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$" data-auth="NotApplicable">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</a>><br>
<br>
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.<br>
<br>
Has anyone got this discontinuous error message with NeuraLynx .csc files that should be / were recorded continuously?<br>
<br>
The low-level read_neuralynx_ncs function detects the presence of gaps in the .ncs file and issues a warning.<br>
Can the detection fail, do I really have discontinuous data?<br>
<br>
Thanks, Peter<br>
<br>
<br>
<br>
<br>
Peter M. Kaskan, Ph.D.<br>
Assistant Professor<br>
Albert Einstein College of Medicine<br>
Leo M. Davidoff Department of Neurological Surgery<br>
1410 Pelham Parkway South<br>
Kennedy Center Room 429B<br>
Bronx, NY 10461<br>
</div>
</span></font></div>
</body>
</html>