Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

NWB-export.ipynb error

Đang mở
#163 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
jupyter-notebook, python
Lĩnh vực
data, databases

Hướng nghiên cứu

Chạy NWB-export.ipynb với các phiên bản Element được liệt kê để tái hiện cả hai lỗi, sau đó đọc element_lab/export/nwb.py tại _lab_to_nwb_dict và các ô notebook chèn và lấy dữ liệu phòng thí nghiệm. Hoàn tất khi notebook chạy mà không có lỗi tiêu đề bảng và quá trình xuất dữ liệu phòng thí nghiệm trả về bản ghi mong đợi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

Bug Report

NWB-export.ipynb may be outdated. It yields the following errors described below.

Description
  • It inserts "institution" into lab.Lab, which doesn't exist in the table heading.

  • (lab.Lab * lab.Lab.Organization * lab.Organization & lab_key) returns empty table since lab.Lab.Organization is empty.

Reproducibility

Include:

  • OS (WIN)

  • DataJoint Element Version
    element-animal>=0.1.5
    element-array-ephys>=0.2.4
    element-electrode-localization>=0.1.2
    element-event>=0.1.2
    element-interface>=0.5.0
    element-lab>=0.2.0
    element-session>=0.1.2

  • MySQL Deployment Strategy (local-docker)

  • Complete error stack as a result of evaluating the above steps

KeyError                                  Traceback (most recent call last)
Cell In[19], line 2
      1 ## If you don't already have data in the Element Lab
----> 2 lab.Lab.insert1(
      3     {
      4         **lab_key,
      5         "lab_name": "LabA",
      6         "institution": "",
      7         "address": "",
      8         "time_zone": "UTC+0",
      9     },
     10     skip_duplicates=True,
     11 )
     12 lab.ProtocolType.insert1({"protocol_type": "A"})
     13 lab.Protocol.insert1({**protocol_key, "protocol_type": "A"}, skip_duplicates=True)

File [c:\Users\jaero\miniconda3\envs\workflow-array-ephys\lib\site-packages\datajoint\table.py:337](file:///C:/Users/jaero/miniconda3/envs/workflow-array-ephys/lib/site-packages/datajoint/table.py:337), in Table.insert1(self, row, **kwargs)
    330 def insert1(self, row, **kwargs):
    331     """
    332     Insert one data record into the table. For ``kwargs``, see ``insert()``.
    333 
    334     :param row: a numpy record, a dict-like object, or an ordered sequence to be inserted
    335         as one row.
    336     """
...
    859                 )
    860 elif set(field_list) != set(fields).intersection(self.heading.names):
    861     raise DataJointError("Attempt to insert rows with different fields.")

KeyError: '`institution` is not in the table heading'
Output exceeds the [size limit](command:workbench.action.openSettings?%5B%22notebook.output.textLineLimit%22%5D). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?8db8f3b2-9105-4915-b964-41d01d620f48)
---------------------------------------------------------------------------
DataJointError                            Traceback (most recent call last)
Cell In[18], line 2
      1 print('Lab:\n')
----> 2 print(element_lab_to_nwb_dict(lab_key=lab_key, protocol_key=protocol_key, 
      3                               project_key=project_key))
      4 print('\nAnimal:\n')
      5 print(subject_to_nwb(session_key=session_key))

File [c:\Users\jaero\miniconda3\envs\workflow-array-ephys\lib\site-packages\element_lab\export\nwb.py:112](file:///C:/Users/jaero/miniconda3/envs/workflow-array-ephys/lib/site-packages/element_lab/export/nwb.py:112), in element_lab_to_nwb_dict(lab_key, project_key, protocol_key)
    110 element_info = dict()
    111 if lab_key:
--> 112     element_info.update(_lab_to_nwb_dict(lab_key))
    113 if project_key:
    114     element_info.update(_project_to_nwb_dict(project_key))

File [c:\Users\jaero\miniconda3\envs\workflow-array-ephys\lib\site-packages\element_lab\export\nwb.py:19](file:///C:/Users/jaero/miniconda3/envs/workflow-array-ephys/lib/site-packages/element_lab/export/nwb.py:19), in _lab_to_nwb_dict(lab_key)
     10 def _lab_to_nwb_dict(lab_key: dict) -> dict:
     11     """Generate a dictionary containing all relevant lab and institution info.
     12 
     13     Args:
   (...)
     17         dict: Dictionary with NWB parameters.
     18     """
---> 19     lab_info = (lab.Lab * lab.Lab.Organization * lab.Organization & lab_key).fetch1()
...
    344         for name in heading.names
    345     )
    346 else:  # fetch some attributes, return as tuple

DataJointError: fetch1 requires exactly one tuple in the input set.
Ngôn ngữ chính
Jupyter Notebook
Star
10
Fork
44
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của datajoint/element-array-ephys

Tất cả issue của datajoint/element-array-ephys

Issue tương tự

Thêm issue về Data Engineering

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.