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

Fix timestamp checks for PCO cameras #525

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

MarcusZuber
Copy link
Member

Fixes timestamp checks for PCO cameras.

This also ignores the index of the first frame and checks only if all subsequent frames are correctly aligned

This also ignores the index of the first frame and checks only if all subsequent frames are correctly allignes
@MarcusZuber MarcusZuber self-assigned this Oct 6, 2023
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9336224) 88.38% compared to head (0a3ea97) 88.38%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #525   +/-   ##
=======================================
  Coverage   88.38%   88.38%           
=======================================
  Files         121      121           
  Lines        8317     8319    +2     
=======================================
+ Hits         7351     7353    +2     
  Misses        966      966           
Files Coverage Δ
concert/experiments/addons.py 83.47% <100.00%> (+0.13%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -409,6 +412,7 @@ async def _check_timestamp(self, producer):
raise PCOTimestampCheckError("Not all images contained timestamps.")



Copy link
Contributor

Choose a reason for hiding this comment

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

oops.

self._timestamp_enabled = await self.get_timestamp() in ['both', 'binary']
await super().start_readout()
self._timestamp_enabled = (await self.get_timestamp_mode()).value_name in ['UCA_PCO_CAMERA_TIMESTAMP_BINARY', 'UCA_PCO_CAMERA_TIMESTAMP_BOTH']
await UcaCamera.start_readout(self)
Copy link
Contributor

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()?

Copy link
Contributor

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?

if img.metadata['frame_number'] != i + 1:
if i == 0:
first_frame = img.metadata['frame_number']
if img.metadata['frame_number'] != i + first_frame:
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

@@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor

@tfarago tfarago left a comment

Choose a reason for hiding this comment

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

Just out of curiosity, why did you need to change the super() call? It didn't work or what?

self._timestamp_enabled = await self.get_timestamp() in ['both', 'binary']
await super().start_readout()
self._timestamp_enabled = (await self.get_timestamp_mode()).value_name in ['UCA_PCO_CAMERA_TIMESTAMP_BINARY', 'UCA_PCO_CAMERA_TIMESTAMP_BOTH']
await UcaCamera.start_readout(self)
Copy link
Contributor

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?

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.

None yet

2 participants