Back to the main page.
Bug 1770 - improve the neuralynx NRD implementation
Status | CLOSED FIXED |
Reported | 2012-10-08 17:14:00 +0200 |
Modified | 2012-10-29 13:44:59 +0100 |
Product: | FieldTrip |
Component: | fileio |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P3 normal |
Assigned to: | Robert Oostenveld |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2012-10-08 17:14:32 +0200
At this moment the low-level reading function has some aspects that are hard-coded for the 256 channel setup in Nijmegen. TODO: - conrado will send an example dataset - implement test script that shows that present implementation fails on this dataset - fix the low-level FT code
Robert Oostenveld - 2012-10-08 21:25:04 +0200
I created a test script. See http://code.google.com/p/fieldtrip/source/detail?r=6706 In that script the nrd and nsc files seem to be interpreted correctly. They have different channel counts, and start with a slightly different timestamp, which is not unexpected given the neuralynx software. I estimate them to be 315 samples shifted relative to each other. However, apart from the schaling, the channel 1 (which is channel 18 in the other) is not precisely identical. It seems that different filters were used for the ncs file than for the nrd file. @Conrado: can you please try and run the test script yourself and reproduce the figures? Please note that the test dataset directory content is like this: roboos@mentat001> ls -al . 2012-07-14_15-33-09/ .: total 314920 drwxr-xr-x 3 roboos mrphys 4096 Oct 8 21:20 . drwxrwxr-x 52 roboos fieldtrip 8192 Oct 8 21:17 .. drwxrwxr-x 2 roboos mrphys 4096 Oct 8 20:51 2012-07-14_15-33-09 -rwxr-xr-x 1 roboos mrphys 321191936 Oct 8 16:10 DigitalLynxRawDataFile.nrd 2012-07-14_15-33-09/: total 1487332 drwxrwxr-x 2 roboos mrphys 4096 Oct 8 20:51 . drwxr-xr-x 3 roboos mrphys 4096 Oct 8 21:20 .. -rwxr-xr-x 1 roboos mrphys 462365 Oct 8 16:04 CheetahLogFile.txt -rwxr-xr-x 1 roboos mrphys 47384752 Oct 8 16:04 CSC0.ncs -rwxr-xr-x 1 roboos mrphys 47384752 Oct 8 16:04 CSC10.ncs ... -rwxr-xr-x 1 roboos mrphys 47384752 Oct 8 16:05 CSC7.ncs -rwxr-xr-x 1 roboos mrphys 47384752 Oct 8 16:05 CSC8.ncs -rwxr-xr-x 1 roboos mrphys 47384752 Oct 8 16:05 CSC9.ncs -rwxr-xr-x 1 roboos mrphys 17672 Oct 8 16:10 Events.nev I had some warnings/errors during the unzip procedure because the zip file was larger than 4GB, but still the files seem ok to me.
Robert Oostenveld - 2012-10-08 21:37:22 +0200
Created attachment 344 screenshot if you compare pwelch(ch1As, 2000, {}, {}, 32556); hold on pwelch(ch1Bs, 2000, {}, {}, 32556); (see figure), then it seems that the nrd version (B) is not filtered, whereas the ncs version is around 10kHz. The ncs filter is consistent with the header details (see also in screenshot). It is weird if there were no analog anti-aliassing filter! My guess at the moment is that the ncs version is a (digitally) filtered version of the nrd version. Still, it is silly that there is no anti-aliassing filter, because it causes high-frequency noise to creep into the signal.
Robert Oostenveld - 2012-10-08 21:49:04 +0200
Created attachment 345 screenshot of the filter and delay kernel yup, the FIR filter kernel can be retrieved from the two time series. See attached screen shot at the code therein. Also my previous estimate of the shift in number of samples (which was based on the timestamps) seems to be confirmed. So the two time series are the same, except that the one is a filtered and slightly time-shifted version of the other. Which means that there is nothing fundamentally wrong with the fT reading functions. Missing is a proper scaling/calibration of the nrd version. This can be obtained in this particular dataset with a multiplication with hdrB.orig.ADBitVolts. I don't understand why the signal then remains inverted (i.e. apparently multiplied with -1).
Arjen Stolk - 2012-10-10 14:33:23 +0200
test_bug1770 failed and has now been fixed (typo)