Skip to content

Commit

Permalink
Add objects to analysis file before insert (#1112)
Browse files Browse the repository at this point in the history
* add objects to analysis file before insert

* update changelog
  • Loading branch information
samuelbray32 authored Sep 16, 2024
1 parent c5ee862 commit a711874
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ dj.FreeTable(dj.conn(), "common_session.session_group").drop()

- Fix video directory bug in `DLCPoseEstimationSelection` #1103
- Restore #973, allow DLC without position tracking #1100
- Minor fix to `DLCCentroid` make function order #1112

- Spike Sorting

Expand Down
13 changes: 7 additions & 6 deletions src/spyglass/position/v1/position_dlc_centroid.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ def _logged_make(self, key):
# Add to Analysis NWB file
analysis_file_name = AnalysisNwbfile().create(key["nwb_file_name"])
nwb_analysis_file = AnalysisNwbfile()
key["dlc_position_object_id"] = nwb_analysis_file.add_nwb_object(
nwb_analysis_file.add_nwb_object(analysis_file_name, position)
)
key["dlc_velocity_object_id"] = nwb_analysis_file.add_nwb_object(
nwb_analysis_file.add_nwb_object(analysis_file_name, velocity)
)

nwb_analysis_file.add(
nwb_file_name=key["nwb_file_name"],
analysis_file_name=analysis_file_name,
Expand All @@ -304,12 +311,6 @@ def _logged_make(self, key):
{
**key,
"analysis_file_name": analysis_file_name,
"dlc_position_object_id": nwb_analysis_file.add_nwb_object(
analysis_file_name, position
),
"dlc_velocity_object_id": nwb_analysis_file.add_nwb_object(
analysis_file_name, velocity
),
}
)

Expand Down

0 comments on commit a711874

Please sign in to comment.