magland / mountainlab

spike sorting software
25 stars 22 forks source link

mlpython extract_timeseries throws error #177

Closed horsto closed 6 years ago

horsto commented 6 years ago

I am trying to run mp-run-process mlpython1.extract_timeseries or mp-run-process mpyms.extract_timeseries But cannot get it to work properly. If I run: mp-run-process mlpython1.extract_timeseries --timeseries=path_to_binary --timeseries_out=path_to_mda --timeseries_dtype='int16' --timeseries_num_channels=16 --channels=0,1,2,3,4 whatever I put for the channels argument I get Missing input path: channels_array If I run: mp-run-process mpyms.extract_timeseries --timeseries=path_to_binary --timeseries_out=path_to_mda --timeseries_dtype='int16' --timeseries_num_channels=16 --channels='0,1,2,3,4' it stops with NameError: name 'get_num_bytes_per_entry_from_dt' is not defined What am I doing wrong?

magland commented 6 years ago

Thanks for that report. First, I had a typo and it should have been pyms.extract_timeseries (not mpyms...).

Don't use quotes around the arguments 'int16'. Just do --timeseries_dtype=int16

Also, your channels should be 1-based indexing (that should be added to documentation for this processor -- note to self)

And I did fix (I think) the problem with get_num_bytes_per_entry_from_dt not being defined. Please let me know if it works now.

horsto commented 6 years ago

Thanks for the reply! If I do pyms.extract_timeseries --timeseries=path_to_dat --timeseries_out=path_to_mda --timeseries_dtype=int16 --timeseries_num_channels=16 --channels=1,2,3,4 now, it gives me:

RUNNING pyms.extract_timeseries: python3 /home/hotte/mountainlab/packages/pymountainsort/basic/basic.py pyms.extract_timeseries --timeseries=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.dat --timeseries_out=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.mda --channels=1,2,3,4 --t1=-1 --t2=-1 --timeseries_dtype=int16 --timeseries_num_channels=16 --_tempdir=/mnt/DATA/temp/mountainlab/tmp_short_term/tempdir_200PMI6WL5 
Traceback (most recent call last):
  File "/home/hotte/mountainlab/packages/pymountainsort/basic/basic.py", line 25, in <module>
    if not PM.run(sys.argv):
  File "/home/hotte/mountainlab/packages/pymountainsort/mlpy/processormanager.py", line 35, in run
    return P(**args)
  File "/home/hotte/mountainlab/packages/pymountainsort/basic/p_extract_timeseries.py", line 55, in extract_timeseries
    if (num_entries % timeseries_num_channels != 0):
TypeError: unsupported operand type(s) for %: 'float' and 'str'

Can you fix that?

magland commented 6 years ago

I think it should work now, please try.

This was a string not getting converted to a number. Before I had been explicitly doing the conversions, but now I've added code in processormanager.py that handles these conversions automatically.

horsto commented 6 years ago

Thanks, but it still throws errors.

mp-run-process pyms.extract_timeseries --timeseries=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.dat --timeseries_out=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.mda --timeseries_dtype=int16 --timeseries_num_channels=16 --channels=1,2,3,4
RUNNING pyms.extract_timeseries: python3 /home/hotte/mountainlab/packages/pymountainsort/basic/basic.py pyms.extract_timeseries --timeseries=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.dat --timeseries_out=/mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.mda --channels=1,2,3,4 --t1=-1 --t2=-1 --timeseries_dtype=int16 --timeseries_num_channels=16 --_tempdir=/mnt/DATA/temp/mountainlab/tmp_short_term/tempdir_KZK54XUNFL
required argument is not an integer
Invalid number of dimensions: -657400948

Traceback (most recent call last):
  File "/home/hotte/mountainlab/packages/pymountainsort/basic/basic.py", line 25, in <module>
    if not PM.run(sys.argv):
  File "/home/hotte/mountainlab/packages/pymountainsort/mlpy/processormanager.py", line 35, in run
    return P(**args)
  File "/home/hotte/mountainlab/packages/pymountainsort/basic/p_extract_timeseries.py", line 76, in extract_timeseries
    return TCR.run(timeseries,_kernel)
  File "/home/hotte/mountainlab/packages/pymountainsort/common/timeserieschunkreader.py", line 24, in run
    M,N = X.N1(),X.N2()
  File "/home/hotte/mountainlab/packages/pymountainsort/mlpy/mdaio.py", line 25, in N1
    return self._header.dims[0]
AttributeError: 'NoneType' object has no attribute 'dims'

Just for your information: mdaconvert /mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.dat /mnt/L/horsto/raw_test/01102017/01102017_signal_on_17_29.mda --input_format=raw_timeseries --num_channels=16 --dtype=int16 gives me Auto-setting number of timepoints to 5760300 and finishes without errors.

magland commented 6 years ago

I think I fixed it. This time I have an actual test. Please try it now.

horsto commented 6 years ago

Perfect, works!