-
Notifications
You must be signed in to change notification settings - Fork 40
TFS scan rotation metadata support & UI fix #3312
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?
Conversation
📝 WalkthroughWalkthroughThis pull request adjusts rotation handling and related metadata across the codebase. In move.py, when a computed scan rotation (sr) is non-zero the code now calls Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/odemis/acq/move.py (1)
579-587: Call to undefined_set_scanner_rotation_corwill crash when scan rotation ≠ 0In
_update_conversion, you now do:sr = self._get_scan_rotation() if sr != 0: self._set_scanner_rotation_cor(sr)Neither
MeteorPostureManagernor its subclasses in this file define_set_scanner_rotation_cor, so as soon assris non‑zero this will raise anAttributeErroron posture managers likeMeteorTFS1PostureManager/MeteorTFS3PostureManagerthat use the base_update_conversion.You probably want either:
- A concrete implementation on
MeteorPostureManager(or all relevant subclasses), or- To call an existing API that performs the intended correction, instead of a method that doesn’t exist yet.
Until such a method is implemented, this side-effect should be removed or guarded behind a capability check.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/odemis/acq/move.pysrc/odemis/driver/autoscript_client.pysrc/odemis/driver/test/autoscript_client_test.pysrc/odemis/gui/comp/slider.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build (ubuntu-24.04)
- GitHub Check: build (ubuntu-22.04)
🔇 Additional comments (2)
src/odemis/driver/autoscript_client.py (1)
1530-1541: Rotation metadata key switch toMD_ROTATIONlooks consistentStoring the scanner rotation under
model.MD_ROTATIONalongside the other MD_* entries fits the metadata pattern and matches the updated tests. No issues spotted in this change.src/odemis/driver/test/autoscript_client_test.py (1)
847-850: Test expectations correctly updated toMD_ROTATIONThe required metadata keys now include
model.MD_ROTATION, matching the driver’s metadata assignment. This keeps the detector-component test aligned with the new rotation key.
74abaa8 to
f3960fd
Compare
During testing on the autoscript simulator, the probe current VA (represented by a log slider) was found to have a minimum value of 0. This is problematic since log(0) is undefined. To fix this in the general sense, the log representation now internally checks if there is an invalid range, and if so, automatically switches to a cubic scale.
f3960fd to
152e371
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/odemis/gui/comp/slider.py (1)
229-232: Good fix for the log(0) undefined behavior.The safety check correctly prevents the crash when a log scale slider has a minimum of 0 or negative. Switching to cubic is a reasonable fallback.
Minor observation: The condition
min_val <= 0is slightly conservative—if bothmin_valandmax_valare negative (e.g., range[-100, -1]), the existing_log_val_to_perccan handle it via the negative-range recursion at lines 140-141. A more precise condition would bemin_val <= 0 <= max_val(i.e., when the range contains or crosses zero). However, the current fix is safe and achieves the goal.♻️ Optional: More precise condition
- if scale == "log" and min_val <= 0: - logging.debug("Log scale must be strictly positive (range: %s, %s), switching to cubic", min_val, max_val) + if scale == "log" and min_val <= 0 <= max_val: + logging.debug("Log scale cannot contain 0 (range: %s, %s), switching to cubic", min_val, max_val) scale = "cubic" # log scale cannot have 0 in range
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/odemis/acq/move.pysrc/odemis/driver/autoscript_client.pysrc/odemis/driver/test/autoscript_client_test.pysrc/odemis/gui/comp/slider.py
🚧 Files skipped from review as they are similar to previous changes (2)
- src/odemis/driver/test/autoscript_client_test.py
- src/odemis/driver/autoscript_client.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-12T12:37:35.155Z
Learnt from: K4rishma
Repo: delmic/odemis PR: 3245
File: src/odemis/acq/align/z_localization.py:29-40
Timestamp: 2026-01-12T12:37:35.155Z
Learning: Maintain the debugging pattern of importing odemis.gui.conf and exporting TIFF files within acquisition/localization loops across all odemis Python sources. Do not remove or restructure this behavior in refactors if it serves debugging consistency; document the debugging purpose with comments and ensure the behavior remains consistent across modules (e.g., acquisition/localization loops such as src/odemis/acq/align/z_localization.py).
Applied to files:
src/odemis/acq/move.pysrc/odemis/gui/comp/slider.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: build (ubuntu-22.04)
- GitHub Check: build (ubuntu-24.04)
🔇 Additional comments (1)
src/odemis/acq/move.py (1)
581-584: LGTM! Rotation correction is now applied conditionally.The guard prevents unnecessary metadata updates when scan rotation is zero. The comment clearly explains the purpose.
Note: There's a slight behavioral difference with
MeteorTescan1PostureManager._update_conversion()(line 1677), which calls_set_scanner_rotation_cor(sr)unconditionally. If the Tescan behavior should also be conditional, consider aligning them for consistency.
MD_ROTATIONfor the TFS posture managerMD_ROTATIONwhile acquiring in the autoscript driverlogscale could have a minimum of 0 (and log(0) is undefined) --> fix: switch tocubicinstead when minimum is zero or negative