cortex-lab / phylib

Lightweight electrophysiological data analysis library
BSD 3-Clause "New" or "Revised" License
11 stars 23 forks source link

bug when run from pykilosort #24

Closed m-beau closed 4 years ago

m-beau commented 4 years ago

in pykilosort/main.py, l.38: get_ephys_reader is instanciated

raw_data = get_ephys_reader(dat_path)

The default parameter in init() of this class for n_channel is None.

This gets fed to _memmap_flat() in phylib/io/traces.py, l.310

where it is compared with 0: assert n_channels > 0, phylib/io/traces.py, l.154

Full log:

Traceback (most recent call last):
  File "<ipython-input-10-e3f4401b61dd>", line 4, in <module>
    run(dat_path=dat_path, probe=probe, params=params, dir_path=dir_path)
  File "C:\Users\Maxime\Desktop\pyKilosort\pykilosort\pykilosort\main.py", line 38, in run
    raw_data = get_ephys_reader(dat_path)
  File "c:\users\maxime\anaconda3\envs\pykilosort\lib\site-packages\phylib\io\traces.py", line 490, in get_ephys_reader
    return klass(arg, **kwargs)
  File "c:\users\maxime\anaconda3\envs\pykilosort\lib\site-packages\phylib\io\traces.py", line 310, in __init__
    self._mmaps = [
  File "c:\users\maxime\anaconda3\envs\pykilosort\lib\site-packages\phylib\io\traces.py", line 311, in <listcomp>
    _memmap_flat(path, dtype=dtype, n_channels=n_channels, offset=offset)
  File "c:\users\maxime\anaconda3\envs\pykilosort\lib\site-packages\phylib\io\traces.py", line 154, in _memmap_flat
    assert n_channels > 0
TypeError: '>' not supported between instances of 'NoneType' and 'int'
rossant commented 4 years ago

Thanks, I'd only tested on compressed datasets... I just pushed a fix. You need to update the runks script to specify the n_channels, dtype, and sample_rate (see README)