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

ProbeType.create_neuropixels_probe warning message improvements #206

Open
tabedzki opened this issue Sep 27, 2024 · 0 comments
Open

ProbeType.create_neuropixels_probe warning message improvements #206

tabedzki opened this issue Sep 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tabedzki
Copy link
Contributor

Bug Report

Description

In our code, we had been defining our probes using the ProbeType class as such

for probe_type in ('neuropixels 1.0 - 3A', 'neuropixels 1.0 - 3B',
                   'neuropixels 2.0 - SS', 'neuropixels 2.0 - MS'):
    probe_element.ProbeType.create_neuropixels_probe(probe_type)

We recently updated to the latest version of element-array-ephys which broke our pipeline since the class version is now passed directly to probe_element.create_neuropixels_probe() which removes the skip_duplicates=True that the older version of the pipeline had, resulting in

  File "/home/[email protected]/Datajoint_projs/U19-pipeline_python/u19_pipeline/ephys_pipeline.py", line 149, in <module>
    probe_element.ProbeType.create_neuropixels_probe(probe_type)
  File "/home/[email protected]/miniconda3/envs/U19-pipeline_python_env3/lib/python3.12/site-packages/element_array_ephys/probe.py", line 77, in create_neuropixels_probe
    return create_neuropixels_probe(probe_type)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/[email protected]/miniconda3/envs/U19-pipeline_python_env3/lib/python3.12/site-packages/element_array_ephys/probe.py", line 173, in create_neuropixels_probe
    ProbeType.insert1({"probe_type": probe_type})
  File "/home/[email protected]/miniconda3/envs/U19-pipeline_python_env3/lib/python3.12/site-packages/datajoint/table.py", line 347, in insert1
    self.insert((row,), **kwargs)
  File "/home/[email protected]/miniconda3/envs/U19-pipeline_python_env3/lib/python3.12/site-packages/datajoint/table.py", line 464, in insert
    raise err.suggest(
datajoint.errors.DuplicateError: ("Duplicate entry 'neuropixels 1.0 - 3A' for key 'PRIMARY'", 'To ignore duplicate entries in insert, set skip_duplicates=True')

If follow the deprecation advice and update to:

for probe_type in ('neuropixels 1.0 - 3A', 'neuropixels 1.0 - 3B',
                   'neuropixels 2.0 - SS', 'neuropixels 2.0 - MS'):
    probe_element.create_neuropixels_probe(probe_type)

we get the same error as above since skip_dulicates=True is still not passed.

Possible solutions

There are two solutions:

  1. Keep the old behavior by passing a skip_duplicates=True to probe_element.create_neuropixels_probe similar to the older behavior.
  2. Update the Deprecation message to advise the user to replace the repeated calls of create_neuropixels_probe with a single create_neuropixels_probe_types().
@tabedzki tabedzki added the bug Something isn't working label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant