python-neo: NeuralynxIO Failed to Read Data
Hi all! I’m running the latest version of Neo and am using this code to create NeuralynxIO and read the directory of interest:
# import requisite dependencies
%matplotlib inline
import neo
import numpy as np
import matplotlib.pyplot as plt
from neo.io import NeuralynxIO
# read file
reader = NeuralynxIO(dirname='/home/user/Desktop/data')
In the data directory, there is a single .ncs file. However, when I run the code, this is the bug that I recieve TypeError: unsupported operand type(s) for /: 'NoneType' and 'float', with the full traceback being
TypeError Traceback (most recent call last)
<ipython-input-17-c76154c9cc99> in <module>
----> 1 reader = NeuralynxIO(dirname='/home/user/Desktop/data')
~/anaconda3/envs/noise_reduction/lib/python3.7/site-packages/neo/io/neuralynxio.py in __init__(self, dirname, use_cache, cache_path)
34 NeuralynxRawIO.__init__(self, dirname=dirname,
35 use_cache=use_cache, cache_path=cache_path)
---> 36 BaseFromRaw.__init__(self, dirname)
~/anaconda3/envs/noise_reduction/lib/python3.7/site-packages/neo/io/basefromrawio.py in __init__(self, *args, **kargs)
79 def __init__(self, *args, **kargs):
80 BaseIO.__init__(self, *args, **kargs)
---> 81 self.parse_header()
82
83 def read_block(self, block_index=0, lazy=False, signal_group_mode=None,
~/anaconda3/envs/noise_reduction/lib/python3.7/site-packages/neo/rawio/baserawio.py in parse_header(self)
149
150 """
--> 151 self._parse_header()
152 self._group_signal_channel_characteristics()
153
~/anaconda3/envs/noise_reduction/lib/python3.7/site-packages/neo/rawio/neuralynxrawio.py in _parse_header(self)
223 # case NO ncs but HAVE nev or nse
224 self._timestamp_limits = [(ts0, ts1)]
--> 225 self._seg_t_starts = [ts0 / 1e6]
226 self._seg_t_stops = [ts1 / 1e6]
227 self.global_t_start = ts0 / 1e6
TypeError: unsupported operand type(s) for /: 'NoneType' and 'float'
I am wondering what the problem is and how to solve it? I understand what a TypeError is, however, am not entirely sure how it applies and how to fix it.
Thank you
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (11 by maintainers)
The revision number is in the file header, which you are skipping to read here. You can read it using python, e.g. via
which should print something like: