Skip to content

Fix timestamp checks for PCO cameras#525

Open
MarcusZuber wants to merge 3 commits intomasterfrom
fix-pco-timestamps
Open

Fix timestamp checks for PCO cameras#525
MarcusZuber wants to merge 3 commits intomasterfrom
fix-pco-timestamps

Conversation

@MarcusZuber
Copy link
Copy Markdown
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 requested a review from tfarago October 6, 2023 13:38
@MarcusZuber MarcusZuber self-assigned this Oct 6, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Oct 6, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.38%. Comparing base (9336224) to head (0a3ea97).
⚠️ Report is 40 commits behind head on master.

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           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

raise PCOTimestampCheckError("Not all images contained timestamps.")



Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants