`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 摘要。