Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

signal_channels in header information not read correctly for Neurolynx .ncs file #1574

Open
NxNiki opened this issue Sep 27, 2024 · 3 comments
Labels

Comments

@NxNiki
Copy link
Contributor

NxNiki commented Sep 27, 2024

Describe the bug

Signal_channels in the header are empty when reading the neuralynx file.

To Reproduce
I have a neuralynx file and when I read it with this code:

reader = neo.io.NeuralynxIO(dirname=folder_path, include_filenames=file_name)
header = reader.header
signal_channels = header.get('signal_channels', [])
signal_channels['name']
Out[20]: array([], dtype='<U64')
signal_channels['sampling_rate']
Out[21]: array([], dtype=float64)

The signal_channels and sampling_rate are empty.

Expected behaviour
My neuralynx file has the following header:

######## Neuralynx Data File Header
-FileType NCS
-FileVersion 3.4
-FileUUID ded50ee7-381d-43bf-913d-eaacd544c964
-SessionUUID 3d33ae15-dd0e-4e2a-b44d-c8728eca80c7
-ProbeName
-OriginalFileName "E:\ATLASData\D562\EXP2_Screening\2023-02-01_12-03-25\A1.ncs"
-TimeCreated 2023/02/01 12:03:25
-TimeClosed 2023/02/01 12:54:09

-RecordSize 1044
-ApplicationName Pegasus "2.1.2 "
-AcquisitionSystem AcqSystem1 ATLAS
-ReferenceChannel "Source 03 Reference 1"
-SamplingFrequency 2000
-ADMaxValue 32767
-ADBitVolts 0.000000091552734375000002
-AcqEntName A1
-NumADChannels 1
-ADChannel 81
-InputRange 3000
-InputInverted True

-DSPLowCutFilterEnabled True
-DspLowCutFrequency 0.1
-DspLowCutNumTaps 0
-DspLowCutFilterType DCO
-DSPHighCutFilterEnabled True
-DspHighCutFrequency 500
-DspHighCutNumTaps 256
-DspHighCutFilterType FIR
-DspDelayCompensation Enabled
-DspFilterDelay_µs 3984

I expect the channel_names to be 'A1' and sampling_frequency to be 2000

Environment:

  • OS: macOS Ventura 13.5.1
  • Python version 3.10.14
  • Neo version '0.13.3'
  • NumPy version '1.26.4'

Additional context
Add any other context about the problem here.

@NxNiki NxNiki added the bug label Sep 27, 2024
@NxNiki NxNiki changed the title signal_channels in header information not read correctly signal_channels in header information not read correctly for Neurolynx .ncs file Sep 27, 2024
@zm711
Copy link
Contributor

zm711 commented Sep 29, 2024

Is this a file you can share with us to debug?

@NxNiki
Copy link
Contributor Author

NxNiki commented Oct 1, 2024

Is this a file you can share with us to debug?

Hi Zach, I can read the header of other .ncs files in our project. The one that failed seems to be an empty file but still has the header info (as it only has a size of 16k). Can you send me your email so I can share the file? Thank you!

@zm711
Copy link
Contributor

zm711 commented Oct 1, 2024

Could you try one thing out of curiosity since you have the file.

from neo.rawio.neuralynxrawio.nlxheader import NlxHeader
header = NlxHeader('path/to/file', props_only=True)

If the file is empty with just a header our reader may fail, but the header reader portion by itself should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants