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

Allow dlc pipeline to run without prior position tracking #970

Merged
merged 5 commits into from
May 13, 2024
Merged

Conversation

samuelbray32
Copy link
Collaborator

@samuelbray32 samuelbray32 commented May 13, 2024

Description

Fixes #950

  • sources meters to pixels conversion from the camera device in the nwb
  • make metadata from pre-existing spatial series optional

Fixes #961

  • avoid altering analysis_file_name in make functions before fetching needed data

Checklist:

  • This PR should be accompanied by a release: no
  • N/A If release, I have updated the CITATION.cff
  • This PR makes edits to table definitions: no
  • N/A If table edits, I have included an alter snippet for release notes.
  • I have updated the CHANGELOG.md with PR number and description.
  • N/A I have added/edited docs/notebooks to reflect the changes

@edeno edeno requested a review from CBroz1 May 13, 2024 15:45
@samuelbray32 samuelbray32 marked this pull request as draft May 13, 2024 17:55
@samuelbray32
Copy link
Collaborator Author

Errors related to #961 showed up with further user use. Converting to a draft until I have those patched

@samuelbray32 samuelbray32 marked this pull request as ready for review May 13, 2024 18:23
@edeno edeno self-requested a review May 13, 2024 19:28
@edeno edeno merged commit 113ce9a into master May 13, 2024
7 checks passed
@edeno edeno deleted the dlc_no_pos branch May 13, 2024 19:29
CBroz1 added a commit that referenced this pull request May 13, 2024
### Pipelines

- DLC
- Allow dlc without pre-existing tracking data #950
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other lines reflect PR number out of my assumption that a user would want to see the set of changes from the PR, and can follow up on the linked issues for the motivation

Suggested change
- Allow dlc without pre-existing tracking data #950
- Allow dlc without pre-existing tracking data #970

Comment on lines +271 to +281
if (
RawPosition & key
): # if spatial series exists, get metadata from there
spatial_series = (RawPosition() & key).fetch_nwb()[0][
"raw_position"
]
reference_frame = spatial_series.reference_frame
comments = spatial_series.comments
else:
reference_frame = ""
comments = "no comments"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (
RawPosition & key
): # if spatial series exists, get metadata from there
spatial_series = (RawPosition() & key).fetch_nwb()[0][
"raw_position"
]
reference_frame = spatial_series.reference_frame
comments = spatial_series.comments
else:
reference_frame = ""
comments = "no comments"
# if spatial series exists, get metadata from there
if query := (RawPosition & key):
spatial_series = query.fetch_nwb()[0]["raw_position"]
else:
spatial_series = None

Comment on lines +289 to +290
reference_frame=reference_frame,
comments=comments,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reference_frame=reference_frame,
comments=comments,
reference_frame = getattr(spatial_series, "reference_frame", ""),
comments = getattr(spatial_series, "comments", "no comments"),

Comment on lines +156 to +157
reference_frame=reference_frame,
comments=comments,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
reference_frame=reference_frame,
comments=comments,
reference_frame = getattr(spatial_series, "reference_frame", ""),
comments = getattr(spatial_series, "comments", "no comments"),

Comment on lines +139 to +149
if (
RawPosition & key
): # if spatial series exists, get metadata from there
spatial_series = (RawPosition() & key).fetch_nwb()[0][
"raw_position"
]
reference_frame = spatial_series.reference_frame
comments = spatial_series.comments
else:
reference_frame = ""
comments = "no comments"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (
RawPosition & key
): # if spatial series exists, get metadata from there
spatial_series = (RawPosition() & key).fetch_nwb()[0][
"raw_position"
]
reference_frame = spatial_series.reference_frame
comments = spatial_series.comments
else:
reference_frame = ""
comments = "no comments"
# if spatial series exists, get metadata from there
if query := (RawPosition & key):
spatial_series = query.fetch_nwb()[0]["raw_position"]
else:
spatial_series = None

edeno added a commit that referenced this pull request May 13, 2024
…)" (#972)

This reverts commit 113ce9a.

Co-authored-by: Chris Brozdowski <CBrozdowski@yahoo.com>
@edeno edeno restored the dlc_no_pos branch May 13, 2024 19:33
# check if a position interval exists for this epoch
try:
interval_list_name = (
convert_epoch_interval_name_to_position_interval_name(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why convert_epoch... should only raise an error in the populate_missing case. I think might add another arg for raise_err over there to avoid try/except. I was taught that try/except only belongs in production if you can't modify the underlying behavior, eg on outside package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ CBroz1 agreed. I'll tweak that function

Comment on lines +262 to +264
pos_time = video_time
reference_frame = ""
comments = "no comments"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A similar thing could be done here as above with getattr and supplying these as defaults

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential Errors: analysis_file name Running DLC Pose Estimation without RawPosition
3 participants