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

ephysqc.spike_sorting_metrics_ks2 function called with too many arguments in extract_files #51

Open
cbimbo opened this issue Feb 2, 2022 · 3 comments

Comments

@cbimbo
Copy link

cbimbo commented Feb 2, 2022

Hi!
I am very new to this pipeline, and am trying to prepare some ephys data for future alignment with histology using the extract_data function with the following code:

from pathlib import Path
from atlaselectrophysiology.extract_files import extract_data

ks_path = Path(r'D:\spikeSorting_Celian\CB008_2021-03-11_bank0_audioVis_g0\sorting') # Path to KS2 output
ephys_path = Path(r'\\znas\Subjects\CB008\2021-03-11\ephys\CB008_2021-03-11_bank0_audioVis_g0') # Path to raw ephys data
out_path = Path(r'D:\spikeSorting_Celian\CB008_2021-03-11_bank0_audioVis_g0\alf') # Save path

extract_data(ks_path, ephys_path, out_path)

However, I get this error:

Traceback (most recent call last):

  Input In [1] in <module>
    extract_data(ks_path, ephys_path, out_path)

  File ~\Documents\int-brain-lab\iblapps\atlaselectrophysiology\extract_files.py:129 in extract_data
    ks2_to_alf(ks_path, ephys_path, out_path, bin_file=efile.ap,

  File ~\Documents\int-brain-lab\iblapps\atlaselectrophysiology\extract_files.py:119 in ks2_to_alf
    ephysqc.spike_sorting_metrics_ks2(ks_path, m, save=True, save_path=out_path)

TypeError: spike_sorting_metrics_ks2() got an unexpected keyword argument 'save_path'

I think it's because ephysqc.spike_sorting_metrics_ks2 takes only 3 arguments (def spike_sorting_metrics_ks2(ks2_path=None, m=None, save=True): ...) but is called with 4 (ephysqc.spike_sorting_metrics_ks2(ks_path, m, save=True, save_path=out_path)).

I'm not sure how it's possible (it should crash for everyone..)? I'm on the dev branch of iblapps and ibllib (I followed the instructions here. Maybe I've missed some obvious step?

Many thanks for your help,
Celian

@cbimbo cbimbo changed the title ephysqc.spike_sorting_metrics_ks2 function called with two many arguments in extract_files ephysqc.spike_sorting_metrics_ks2 function called with too many arguments in extract_files Feb 2, 2022
@mayofaulkner
Copy link
Contributor

Hi, sorry about that. If you pull the latest changes from ibllib develop branch that should be fixed. Let me know if not!

@cbimbo
Copy link
Author

cbimbo commented Feb 7, 2022

Hi Mayo,
Thanks for that. This fixed it for me.
However, I'm still getting an error:

  File ~\Documents\int-brain-lab\phylib\phylib\io\traces.py:654 in export_waveforms
    writer = NpyWriter(path, shape, dtype)

  File ~\Documents\int-brain-lab\phylib\phylib\io\traces.py:555 in __init__
    self.fp = open(path, 'wb')

OSError: [Errno 22] Invalid argument: 'D:\\spikeSorting_Celian\\CB008_2021-03-11_bank0_audioVis_g0\\sorting\\_phy_spikes_subset.waveforms.npy

I still have to dive into it, and if I can't fix it maybe I'll open another issue.
Thanks again for the quick reply!
Celian

@mayofaulkner
Copy link
Contributor

Hi, following up on this. Did you fix this path issue?

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