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

vprobe electrodes locations #8

Merged
merged 9 commits into from
Dec 19, 2023
Merged

Conversation

luiztauffer
Copy link
Member

This change reads the relative-to-probe electrodes locations and add it to the recording. This is important for spike sorting

@luiztauffer luiztauffer requested a review from felixp8 December 6, 2023 11:40
@CodyCBakerPhD
Copy link
Member

Looks like you're setting it all explicitly

Can you instead make a ProbeInterface.Probe object and use recording_interface.set_probe instead?

@luiztauffer
Copy link
Member Author

@CodyCBakerPhD what would be the advantage of doing that?

@CodyCBakerPhD
Copy link
Member

It's a more standard workflow, is a more consolidatted injection, results in more standard electrode table structure (since it goes through a specific pathway for probes in the write tools)

@luiztauffer
Copy link
Member Author

@CodyCBakerPhD sounds good to me! Could you point me to an example converter doing this?

@alejoe91
Copy link
Contributor

alejoe91 commented Dec 7, 2023

@luiztauffer @CodyCBakerPhD

I implemented the set_probe and also changed the interface to use the BinaryRecording, so we don't need to duplicate all the memmapping logic. I think the result is much cleaner and simple. @luiztauffer can you test it out? I don't have the raw data on my side

Comment on lines +75 to +78
self.recording_extractor.set_property(
key="group_name",
values=[probe_name] * len(self.recording_extractor.channel_ids),
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luiztauffer
Copy link
Member Author

luiztauffer commented Dec 9, 2023

@alejoe91 I'm getting this error with the BinaryRecording

File /mnt/shared_storage/Github/neuroconv/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py:32, in BaseRecordingExtractorInterface.__init__(self, verbose, es_key, **source_data)
     20 """
     21 Parameters
     22 ----------
   (...)
     29 
     30 """
     31 super().__init__(**source_data)
---> 32 self.recording_extractor = self.get_extractor()(**source_data)
     33 self.subset_channels = None
     34 self.verbose = verbose

File /mnt/shared_storage/Github/neuroconv/src/neuroconv/baseextractorinterface.py:25, in BaseExtractorInterface.get_extractor(cls)
     23     return cls.Extractor
     24 extractor_module = get_package(package_name=cls.ExtractorModuleName)
---> 25 extractor = getattr(
     26     extractor_module,
     27     cls.ExtractorName or cls.__name__.replace("Interface", "Extractor"),
     28 )
     29 cls.Extractor = extractor
     30 return extractor

AttributeError: module 'spikeinterface.extractors' has no attribute 'BinaryRecording'

Edit 1: It works with BinaryRecordingExtractor, but other errors show up, I'll keep debugging

  File "/mnt/shared_storage/Github/jazayeri-lab-to-nwb/src/jazayeri_lab_to_nwb/watters/wattersrecordinginterface.py", line 47, in __init__
    super().__init__(verbose=verbose, es_key=es_key, **source_data)
  File "/mnt/shared_storage/Github/neuroconv/src/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py", line 32, in __init__
    self.recording_extractor = self.get_extractor()(**source_data)
  File "/home/luiz/anaconda3/envs/env_jaz/lib/python3.10/site-packages/spikeinterface/core/binaryrecordingextractor.py", line 113, in __init__
    self.set_channel_gains(gain_to_uV)
  File "/home/luiz/anaconda3/envs/env_jaz/lib/python3.10/site-packages/spikeinterface/core/baserecordingsnippets.py", line 381, in set_channel_gains
    self.set_property("gain_to_uV", gains, ids=channel_ids)
  File "/home/luiz/anaconda3/envs/env_jaz/lib/python3.10/site-packages/spikeinterface/core/base.py", line 194, in set_property
    assert values.shape[0] == size
AssertionError

@alejoe91
Copy link
Contributor

@luiztauffer should be fixed now :) gains and offsets needed to be a scalar rather than an array.

@CodyCBakerPhD you need to set group_name because the get_metadata sets a different custom group name, so we have to make sure that it corresponds to the group_name property!

@CodyCBakerPhD
Copy link
Member

@luiztauffer Any updates on this PR? Is it producing good files and do those files work with dendro?

@luiztauffer
Copy link
Member Author

@CodyCBakerPhD the conversion for Vprobe is working now, electrodes locations are correct

@CodyCBakerPhD CodyCBakerPhD merged commit 60464d4 into main Dec 19, 2023
1 check passed
@CodyCBakerPhD CodyCBakerPhD deleted the vprobe-electrodes-locations branch December 19, 2023 14:45
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

Successfully merging this pull request may close these issues.

3 participants