Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

`ProbeType.create_neuropixels_probe` warning message improvements

未关闭
#206 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python

调研方向

从 element_array_ephys/probe.py 中的 ProbeType.create_neuropixels_probe()、create_neuropixels_probe() 和 create_neuropixels_probe_types() 开始,以报告的 DuplicateError 作为要追踪的行为。明确需要哪一种提议的行为,然后确保警告或重复项处理能够适当地引导用户,并验证重复创建 Neuropixels probe 时的行为符合文档说明。

由索引模型根据 Issue 内容生成。

描述

bug

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().
主要语言
Jupyter Notebook
星标
10
派生
44
PR 合并指标
30 天内没有已合并 PR

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

datajoint/element-array-ephys 的其他 Issue

查看 datajoint/element-array-ephys 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。