-
Notifications
You must be signed in to change notification settings - Fork 4
Fix timestamp checks for PCO cameras #525
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -388,6 +388,7 @@ async def _check_timestamp(self, producer): | |
| self.timestamp_missing = False | ||
| i = 0 | ||
| last_acquisition = await self._experiment.acquisitions[-1].get_state() == "running" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this isn't new but it's really a hack, we should improve this in the future.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean what if we raise an exception even if this is the first acquisition? If you want the timestamp and it's not there than it makes sense, doesn't it? |
||
| first_frame = 1 | ||
| async for img in producer: | ||
| if i == 0: | ||
| if not isinstance(img, ImageWithMetadata) or ( | ||
|
|
@@ -398,9 +399,10 @@ async def _check_timestamp(self, producer): | |
| "Works only with pco cameras.") | ||
| self.timestamp_missing = True | ||
| return | ||
| if img.metadata['frame_number'] != i + 1: | ||
| first_frame = img.metadata['frame_number'] | ||
| if img.metadata['frame_number'] != i + first_frame: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it safe to rely on the first frame index being 1? All PCO's behave the same way for sure? |
||
| self._experiment.log.error( | ||
| f"Frame {i + 1} had wrong frame number {img.metadata['frame_number']}.") | ||
| f"Frame {i} had wrong frame number {img.metadata['frame_number']} (first_frame: {first_frame}).") | ||
| self.timestamp_incorrect = True | ||
| i += 1 | ||
| if last_acquisition and self.timestamp_incorrect: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move away from
super()?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still, why did you change this?