You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on a project to adapt NWB files so that they are spyglass-compatible, and I noticed that TaskEpoch make() function expects many single-row DynamicTable objects to populate the task information:
# check if the task is in the Task table and if not, add it
Task.insert_from_task_table(task)
key["task_name"] =task.task_name[0]
# get the CameraDevice used for this task (primary key is
# camera name so we need to map from ID to name)
camera_ids=task.camera_id[0]
valid_camera_ids= [
camera_id
forcamera_idincamera_ids
ifcamera_idincamera_names.keys()
]
ifvalid_camera_ids:
key["camera_names"] = [
{"camera_name": camera_names[camera_id]}
forcamera_idinvalid_camera_ids
]
else:
logger.warning(
f"No camera device found with ID {camera_ids} in NWB "
+f"file {nwbf}\n"
)
# Add task environment
ifhasattr(task, "task_environment"):
key["task_environment"] =task.task_environment[0]
# get the interval list for this task, which corresponds to the
# matching epoch for the raw data. Users should define more
# restrictive intervals as required for analyses
session_intervals= (
IntervalList() & {"nwb_file_name": nwb_file_name}
).fetch("interval_list_name")
forepochintask.task_epochs[0]:
# TODO in beans file, task_epochs[0] is 1x2 dset of ints,
# so epoch would be an int
key["epoch"] =epoch
target_interval=self.get_epoch_interval_name(
epoch, session_intervals
)
iftarget_intervalisNone:
logger.warning("Skipping epoch.")
continue
key["interval_list_name"] =target_interval
task_inserts.append(key.copy())
Why not just use one table with many rows (one per task)? Is there a general principle in spyglass that I'm missing? Is this just a bug? Is there documentation somewhere that explains this?
Curiously, the Task table propagates all the rows of each DynamicTable, so if the tables are multi-row, you can get a task_name in the Task table that doesn't show up in the TaskEpoch table.
The text was updated successfully, but these errors were encountered:
No overarching principle here, just a legacy piece from how the frank lab nwb files were organized when this began (enhancement to do in our nwb conversion package). Agree that we should be able to read in multiple entries from a nwb table here.
I am working on a project to adapt NWB files so that they are spyglass-compatible, and I noticed that TaskEpoch make() function expects many single-row DynamicTable objects to populate the task information:
spyglass/src/spyglass/common/common_task.py
Lines 145 to 192 in dbae127
Why not just use one table with many rows (one per task)? Is there a general principle in spyglass that I'm missing? Is this just a bug? Is there documentation somewhere that explains this?
Curiously, the Task table propagates all the rows of each DynamicTable, so if the tables are multi-row, you can get a
task_name
in the Task table that doesn't show up in the TaskEpoch table.The text was updated successfully, but these errors were encountered: