Skip to content

Comments

Convert ADOdin to FastCS-Odin#1158

Closed
shihab-dls wants to merge 12 commits intomainfrom
fastcs_odin
Closed

Convert ADOdin to FastCS-Odin#1158
shihab-dls wants to merge 12 commits intomainfrom
fastcs_odin

Conversation

@shihab-dls
Copy link
Contributor

closes #551

This PR implement FastCS-Odin in place of ADOdin.

monitor: EigerMonitorIO
stream: EigerStreamIO
detector: EigerDetectorIO
od: OdinHdfIO
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make this odin rather than od?

@coretl
Copy link
Collaborator

coretl commented Dec 12, 2025

@claude

Copy link
Collaborator

@coretl coretl left a comment

Choose a reason for hiding this comment

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

@coretl
Copy link
Collaborator

coretl commented Dec 12, 2025

@claude

@claude
Copy link

claude bot commented Dec 12, 2025

Claude finished @coretl's task in 1m 52s —— View job


Code Review Complete

Tasks

  • Read repository guidelines
  • Review new FastCS Odin IO implementation
  • Review Eiger detector changes
  • Review Jungfrau detector changes
  • Review test updates
  • Check if previous review comments addressed
  • Provide comprehensive feedback

Summary

This PR successfully migrates from EPICS ADOdin to FastCS-Odin. Previous review comments have been addressed. The code is generally well-structured with good test coverage. I've identified a few issues:

Issues Found

Critical:

  • OdinWriter.open() always sets fp.frames = 0, potentially losing intended frame count configuration

Major:

  • Naming inconsistency: od used instead of odin in EigerDetector (already flagged by @coretl)
  • Jungfrau has duplicate OdinHdfIO class that should be removed once FastCS updates

Minor:

  • wait_for_value() call uses single-item tuple unnecessarily
  • asyncio.gather() with single coroutine in multiple places

Detailed Feedback

src/ophyd_async/fastcs/odin/_odin_io.py:76

The fp.frames.set(0) call appears to discard the exposure information. This was changed from exposures_per_event in commit 5d61dec.

Question: Is this intentional? If fp.frames represents expected frame count, setting it to 0 seems incorrect. If it's meant to reset a counter, the parameter name is misleading.

src/ophyd_async/fastcs/odin/_odin_io.py:87-89

await asyncio.gather(
    wait_for_value(self._drv.fp.writing, True, timeout=DEFAULT_TIMEOUT),
)

The single-item gather() is unnecessary. Use: await wait_for_value(self._drv.fp.writing, True, timeout=DEFAULT_TIMEOUT)

src/ophyd_async/fastcs/eiger/_eiger.py:23

od: OdinHdfIO

Should be odin: OdinHdfIO for clarity (as noted by @coretl). The 2-letter abbreviation makes the code less readable.

src/ophyd_async/fastcs/jungfrau/_jungfrau.py:9-17

The duplicate OdinHdfIO class with custom __init__ is a temporary workaround. The TODO comment indicates this should be removed once FastCS Jungfrau provides top-level 'detector' and 'odin' similar to EigerDetector.

Line 35: Type ignore comment

self.odin,  # type: ignore

This type ignore is needed because of the duplicate OdinHdfIO class. Will be resolved when the TODO is addressed.

Positive Observations

  • ✅ All previous review comments addressed (unused Reference import removed, wait=True defaults removed)
  • ✅ Good separation of concerns: IO devices, writer, and detector classes
  • ✅ Comprehensive test coverage for the migration
  • ✅ Consistent with existing ophyd-async patterns
  • ✅ Tests properly updated to use FastCS PVs instead of EPICS

Recommendations

  1. Clarify the intent of fp.frames.set(0) - add a comment or reconsider if frame count should be tracked
  2. Rename ododin in EigerDetector
  3. Remove unnecessary single-item gather() calls
  4. Track the FastCS Jungfrau update to remove the duplicate OdinHdfIO class

f"uint{await self._detector_bit_depth.get_value()}"
),
self._drv.fp.data_compression.set("BSLZ4"),
self._drv.fp.frames.set(0),
Copy link

Choose a reason for hiding this comment

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

Setting frames to 0 appears unusual. What does fp.frames represent in the Odin context?

If it's the expected frame count, this would always set it to 0 regardless of acquisition parameters. If it's a frame counter that should be reset, consider adding a comment explaining this behavior.


await self._drv.fp.start_writing.trigger()

await asyncio.gather(
Copy link

Choose a reason for hiding this comment

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

Suggested change
await asyncio.gather(
await wait_for_value(self._drv.fp.writing, True, timeout=DEFAULT_TIMEOUT)

Single-item gather() is unnecessary.

monitor: EigerMonitorIO
stream: EigerStreamIO
detector: EigerDetectorIO
od: OdinHdfIO
Copy link

Choose a reason for hiding this comment

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

Suggested change
od: OdinHdfIO
odin: OdinHdfIO

As mentioned in previous review, odin is clearer than the abbreviated od.

Comment on lines +9 to +12
# TODO: Delete this duplicate device, once FastCS Jungfrau
# has top level 'detector' and 'odin', after which, follow
# EigerDetector as an example of correct structure
class OdinHdfIO(Device):
Copy link

Choose a reason for hiding this comment

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

This duplicate OdinHdfIO class should be tracked for removal. Once FastCS Jungfrau provides the same structure as Eiger (with top-level 'detector' and 'odin'), this workaround can be eliminated.

Consider creating a GitHub issue to track this technical debt if one doesn't already exist.

@coretl
Copy link
Collaborator

coretl commented Jan 30, 2026

Merged into #1177

@coretl coretl closed this Jan 30, 2026
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.

Eiger FastCS: Use PVI information to fill in PVs

2 participants