-
Notifications
You must be signed in to change notification settings - Fork 28
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
Neuropyxels with Open Ephys data #96
Comments
Hi Javier, I could actually use your help! Can you send me an example dataset? Are you recording with neuropixels 1.0, the commercial version? Maxime |
Sure, you can find a little piece of data here https://owncloud.icm-institute.org/index.php/s/b8i5s4lVV8Dub6C |
Cheers, and which spike-sorter did you use? |
Kilosort 3, I added a folder with the spike sorting outputs. |
Hi! |
Hi! I am currently working on it, I edited the readme file a but prematurely - bear with me! |
Hi Javier, almost there - I am trying to work out how to infer the bits to uVolts conversion factor from openephys metadata. In spikeGLX, the amplification factor can customized and is typically 500. From there, I can compute the conversion factor which is about 2.34: glx_convfactor = Vrange/2**bits_encoding/ampFactor in the oebin file, I do not find any amplification factor but I find another number per channel: "bit_volts", which must be what I am looking for. Its value is 0.19499999284744262695 on all of your channels. I assume that this number must be 1/glx_convfactor, but it would mean that you have an amplification factor of ~228.5 which is rather odd. Can you let me know what was your amplification factor? MAxime |
FYI, I figured it out - the compatibility layer is now written, and updated on github and pip. The only missing bit is how to format the sync channel in events/Neuropixels-PXI-100.0, for that I need an example of recording with an actual sync signal |
Hi Maxime, that's amazing! sorry, I had some issues and couldn't record
the sample with the TTLs as we agreed, I'm hoping to do it tomorrow if
everything goes well. I'll keep you posted.
Cheers !
…On Mon, 25 Oct 2021 at 00:22, Maxime Beau ***@***.***> wrote:
FYI, I figured it out - the compatibility layer is now written, and
updated on github and pip.
The only missing bit is how to format the sync channel in
events/Neuropixels-PXI-100.0, for that I need an example of recording with
an actual sync signal
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#96 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEJTX4VJFNLZEUZNW6CQW3TUISBLZANCNFSM5FTX2PFA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Hello Maxime, |
Hi Javier, I am not prioritizing this at the moment - you can now use npyx with OpenEphys, simply not load the sync channel through npyx yet. It isn't critical with openephys though as you can simply load the sync signal from 'events/Neuropix-PXI-100.0/TTL_1/timestamps.npy using numpy! Let me know how npyx works for you, don't hesitate to ask if you encounter further issues! |
Hi Javier, Did it work out for you? Everything should work smoothly on an openEphys dataset, apart from extracting the sync channel which is very easy to do manually (it is pre-extracted in OpenEphys, at 'events/Neuropix-PXI-100.0/TTL_1/timestamps.npy' I reckon) |
Confirmed that it worked orally - closing this issue |
FWIW, there was a recent OpenEphys update that has made most of this code no longer work for data recorded with the new GUI (mostly due to folder name changes). I'm working on updating it! |
Damn! Thanks, pull requests from open ephys users are welcome! I am not acquainted with the system :) |
just dropping in to say I believe @chris-angeloni did fix this in his fork of the repo. I tried to open a PR but don't have permission. could be worth merging so more openephys folks can make use of this excellent repo. |
Hey, thanks for letting me know - let me figure out how to edit the PR permissions (@brandonStell managed to open PRs in the past, I am surprised that it didn't work for you) |
It may be because @chris-angeloni 's fork is pretty far behind the current master branch (202 commits behind!)? In any case @davoudian , if you were willing to make a fresh fork, edit the relevant bits of code to and then try to open a PR, it'd be dope. Alternatively, I am happy to work on it myself - I just need someone to send me an openEphys dataset so that I can do proper unit testing. |
Ah, yes, sorry I did not do a pull request sooner! I am currently gearing up to do a bunch of neuropixels recordings, at which point I will need to revisit the analysis pipeline. At that time I will try to take the opportunity to clone the new branch and reimplement the fixes I previously added. |
thanks @m-beau ! I may have some time early next week to try and open a PR. in the meantime i've also emailed a short ~15min recording using oephys to the email listed on your github. |
Hey guys! I got your recording - I am working on this now. the npyx.inout.metadata function loads openephys' metadata (inside the .oebin file) properly. Am I right that the dataset you sent me isn't spike-sorted though? I cannot find any params.py or spike_times.npy file in your directory structure. Maxime |
yeah I just did a quick recording while setting up / de-noising a new rig. I can spike sort it via spikeinterface/KS if that would help though. let me know |
yep it'd be useful! just send me the output of the sorter, to make sure that other npyx functions work well. Other question: in a dataset that someone sent me in the past, the AP and LFP folder were called Neuropix-PXI-100.0 and 100.1 instead: can you confirm that the openephys-generated directories are always called ''blahblah-AP' and 'blahblah-LFP' these days for the AP and LFP channels? |
I have just pushed npyx version 3.0.0 - the functions |
If you guys could try it out on a bunch of recordings for me, to make sure that it doesn't crash, it would be great. Happy to implement any fixes asap this week (download from pip or install from the master branch, making sure that version 3.0.0 is printed in your notebook/terminal after import)! |
@m-beau fantastic!
|
@m-beau two things I noticed by running some bare bones analysis quickly:
i'll try and keep track of these and any other bugs I find and hopefully open a PR to squash them when I have some more time. thanks again for sharing all your hard work, glad to not be in matlab |
I just merged @chris-angeloni's pull request - it should do the trick. I am opening a new issue #318 regarding the pandas .append deprecation - I will not close this issue for another month to make sure we didn't miss any OE incompatibility! |
I use open ephys recording, kilosort3, and create phy. However, I still have problem to use Neuropyxels with Open Ephys data #WARNING only probe version Acquisition Board not handled with openEphys I attempt to use quickstart.ipynb, but it (# Threshold crosses of the sync channel acquired with the SMA port on the acquisition board; onsets, offsets = get_npix_sync(dp); onsets) shows AssertionError Traceback (most recent call last) File ~\AppData\Local\miniconda3\envs\si_env\lib\site-packages\npyx\inout.py:460, in get_npix_sync(dp, output_binary, filt_key, unit, verbose, again, sample_span) File ~\AppData\Local\miniconda3\envs\si_env\lib\site-packages\npyx\inout.py:48, in read_metadata(dp) File ~\AppData\Local\miniconda3\envs\si_env\lib\site-packages\npyx\inout.py:135, in metadata(dp) AssertionError: WARNING only probe version Acquisition Board not handled with openEphys - post an issue at www.github.com/m-beau/NeuroPyxels I think it means I should modified about the probe info, but I don't know where could I change? I also follow the Directory structure with "myrecording.oebin, params.py, spike_times.npy, spike_clusters.npy, cluster_groups.tsv # if manually curated with phy", and I use "Preprocess binary data": from npyx.inout import preprocess_binary_file # star import is sufficient, but I like explicit imports! can perform bandpass filtering (butterworth 3 nodes) and median subtraction (aka common average referenceing, CAR)in the future: ADC realignment (like CatGT), whitening, spatial filtering (experimental).filtered_fname = preprocess_binary_file(dp, filt_key='ap', median_subtract=True, f_low=None, f_high=300, order=3, verbose=True) and the results showed that "Preprocessing not_found...
|
Hey there, Try to install npyx from the master repo: pip install git+https://github.com/m-beau/NeuroPyxels.git |
I did it, and it showed as below: Collecting git+https://github.com/m-beau/NeuroPyxels.git × python setup.py egg_info did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. × Encountered error while generating package metadata. note: This is an issue with the package mentioned above, not pip. |
I thought my issue is that I use the same Directory structure as your README. But, I still cannot use test_npyx or onsets, offsets = get_npix_sync(dp) to acquire my dataset. Could you please share the dataset of quickstart.ipynb? |
Try to create a new conda environment, it sounds like you have versioning issues. Make sure that the python version of your conda environment is python 10 or lower! And try to install npyx from a local repository.
|
Thanks for your guidance and assistance! I installed npyx from a local repository: Then, I open the "quickstart.ipynb", when I ran "# Threshold crosses of the sync channel acquired with the SMA port on the acquisition board It showed as following:UnboundLocalError Traceback (most recent call last) File ~\NeuroPyxels\npyx\inout.py:479, in get_npix_sync(dp, output_binary, filt_key, unit, verbose, again, sample_span) File ~\NeuroPyxels\npyx\inout.py:48, in read_metadata(dp) File ~\NeuroPyxels\npyx\inout.py:138, in metadata(dp) UnboundLocalError: local variable 'probe_index' referenced before assignment I'd like to know how to define "probe_index" before this. I used the probe as below: |
Great to see you managed to install npyx! The openephys version hasn't been tested super well by myself as I do not use it, but I think other users on this thread already solved this - @chris-angeloni @javierzsm @davoudian, if you managed to pull the last version of npyx, copy-paste the section of your code which solves compatibility issues with open ephys and then commit or pull-request (from a fork), it would be much appreciated! |
Yep this is normal, check out the installation instructions in the readme file. |
Hi all - I am trying npyx on my data (i.e., openephys + KS2.5 + phy curated). I got an error when loading metadata (read_metadata) and spikes (ten(dp, u)). I followed the directory structure specified in the readme file. The error was as the below: `TypeError Traceback (most recent call last) File c:\Users\yangy1\AppData\Local\anaconda3\envs\npyx\lib\site-packages\npyx\inout.py:48, in read_metadata(dp) File c:\Users\yangy1\AppData\Local\anaconda3\envs\npyx\lib\site-packages\npyx\inout.py:163, in metadata(dp) TypeError: list indices must be integers or slices, not list` Here are the directories/files in my dp: Does anyone have any clue about what could be wrong? |
Hi! NeuroPyxels hasn't been super well tested with open ephys datasets - would you mind sending me your dataset as a Dropbox link so that I can try running it on my end and understand what's going on? Cheers |
Do you have the most recent version of neuropyxels? I had to add some code before where your error is occurring to prevent this:
And the line numbers in your error don't quite line up with the current version of the code? |
@chris-angeloni I used npyx 4.0.5 before. The error persists as I updated to the latest 4.0.6.
|
@m-beau Thanks for the reply and I am happy to share my data. The only problem is that the current recording is quite large in size like over 120 gb. I can send you a shorter one though it hasn't been curated using phy but has all the KS2.5 output. I think this should be enough to replicate the error? https://www.dropbox.com/scl/fo/0qi3zr16l3xr7zzob8oib/ACRRrywnHDf7aq1gdWz1_Vk?rlkey=jnvebqzty2lndwc3i744txlki&st=5q1f7qoq&dl=0
|
Hi,
This is super cool although I can't use it because I'm not using SpikeGL. Is there any chance to have it working with data acquired using Open Ephys?
Best,
Javier
The text was updated successfully, but these errors were encountered: