- 
                Notifications
    
You must be signed in to change notification settings  - Fork 40
 
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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 sincelab.Lab.Organizationis 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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working