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

NWB-export.ipynb error #163

Open
JaerongA opened this issue Mar 15, 2023 · 0 comments
Open

NWB-export.ipynb error #163

JaerongA opened this issue Mar 15, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@JaerongA
Copy link
Collaborator

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.
@JaerongA JaerongA added the bug Something isn't working label Mar 15, 2023
@kabilar kabilar transferred this issue from datajoint/workflow-array-ephys Jun 21, 2023
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

2 participants