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

Mean waveforms: Value error #57

Open
Kasia-Bz opened this issue Feb 28, 2021 · 1 comment
Open

Mean waveforms: Value error #57

Kasia-Bz opened this issue Feb 28, 2021 · 1 comment

Comments

@Kasia-Bz
Copy link

Hello,
I have been trying to calculate mean waveforms on my data. I used all three: Kilosort2, Kilosort 2.5 and Kilosort 3 outputs and I always get the same error:

Loading data...
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\mean_waveforms\__main__.py", line 69, in <module>
    main()
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\mean_waveforms\__main__.py", line 59, in main
    output = calculate_mean_waveforms(mod.args)
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\mean_waveforms\__main__.py", line 23, in calculate_mean_waveforms
    data = np.reshape(rawData, (int(rawData.size/args['ephys_params']['num_channels']), args['ephys_params']['num_channels']))
  File "<__array_function__ internals>", line 6, in reshape
  File "D:\.venv\lib\site-packages\numpy\core\fromnumeric.py", line 299, in reshape
    return _wrapfunc(a, 'reshape', newshape, order=order)
  File "D:\.venv\lib\site-packages\numpy\core\fromnumeric.py", line 58, in _wrapfunc
    return bound(*args, **kwds)
ValueError: cannot reshape array of size 22608838945 into shape (59030911,383)

Could you please help me with how I could fix this error?

I also tried to run the post processing module, but I get an error:
ecephys spike sorting: kilosort postprocessing module

Loading data...
Removing within-unit overlapping spikes...
 ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒░ 99% Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 193, in _run_module_as_main
    "_main_", mod_spec)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\kilosort_postprocessing\_main_.py", line 76, in <module>
    main()
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\kilosort_postprocessing\_main_.py", line 66, in main
    output = run_postprocessing(mod.args)
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\kilosort_postprocessing\_main_.py", line 38, in run_postprocessing
    args['ks_postprocessing_params'])
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\kilosort_postprocessing\postprocessing.py", line 88, in remove_double_counted_spikes
    spikes_to_remove)
  File "D:\.venv\lib\site-packages\ecephys_spike_sorting\modules\kilosort_postprocessing\postprocessing.py", line 219, in remove_spikes
    spike_times = np.delete(spike_times, spikes_to_remove, 0)
  File "<__array_function__ internals>", line 6, in delete
  File "D:\.venv\lib\site-packages\numpy\lib\function_base.py", line 4480, in delete
    keep[obj,] = False
IndexError: arrays used as indices must be of integer (or boolean) type

Lastly, I noticed that in the output from Kilosort3, there are no longer files: pc_feature_ind.npy and pc_feature.npy. Are you planning to switch to Kilosort3 in the future?

Thank you in advance for your help.

@jsiegle
Copy link
Collaborator

jsiegle commented Mar 9, 2021

Hi @Kasia-Bz , for the first error, it looks like the number of data channels indicated in the create_input_json.py file is incorrect. 22608838945 is evenly divisible by 385, so I'm guessing that's what the value of "num_channels" should be.

I'm not sure what's going on with the second error, can you print out the values of spike_times and spikes_to_remove?

The latest changes to the code base add compatibility with Kilosort3, including the option to ignore the PC-based metrics when pc_features.npy is not available.

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

No branches or pull requests

2 participants