Skip to content

Conversation

@pieleric
Copy link
Member

"rx" is too easy to confuse with the stage-bare tilt. So rename the key
to "mill_angle", and add a "upgrade" code that automatically updates the
metadata of the stage-bare if a backend was started with an old
configuration.

"rx" is too easy to confuse with the stage-bare tilt. So rename the key
to "mill_angle", and add a "upgrade" code that automatically updates the
metadata of the stage-bare if a backend was started with an old
configuration.
@pieleric pieleric changed the title [fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"] [MSD_219][fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"] Dec 19, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 19, 2025

📝 Walkthrough

Walkthrough

This pull request renames the milling angle field key from rx to mill_angle across multiple YAML configuration files and their corresponding code references. Four simulator YAML files for the Meteor FIBSEM systems are updated to use mill_angle instead of rx in the FAV_MILL_POS_ACTIVE metadata entry, while retaining the rz value. The code changes in src/odemis/acq/move.py and src/odemis/gui/cont/tabs/fibsem_tab.py are updated to read and write using the new mill_angle key instead of rx, affecting posture managers, transformation functions, and UI metadata handling.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.50% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description accurately explains the motivation (avoiding confusion with stage-bare tilt) and the implementation approach (renaming the key and adding upgrade code), which matches the actual changeset.
Title check ✅ Passed The title clearly and specifically describes the main change: renaming a metadata key from 'rx' to 'mill_angle' in the METEOR configuration, which is the primary focus of all file changes in the pull request.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a 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/cont/tabs/fibsem_tab.py (1)

190-191: Consider renaming variable for clarity.

The code correctly reads "mill_angle" from metadata, but stores it in a variable named rx, which is misleading. Consider renaming to mill_angle for better code clarity:

-        rx = self.pm.stage.getMetadata()[model.MD_FAV_MILL_POS_ACTIVE]["mill_angle"]
-        self.panel.ctrl_milling_angle.SetValue(math.degrees(rx))
+        mill_angle = self.pm.stage.getMetadata()[model.MD_FAV_MILL_POS_ACTIVE]["mill_angle"]
+        self.panel.ctrl_milling_angle.SetValue(math.degrees(mill_angle))
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ed4659c and 7492b75.

📒 Files selected for processing (6)
  • install/linux/usr/share/odemis/sim/meteor-fibsem-sim.odm.yaml (1 hunks)
  • install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-full-sim.odm.yaml (1 hunks)
  • install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-sim.odm.yaml (1 hunks)
  • install/linux/usr/share/odemis/sim/meteor-tfs3-sim.odm.yaml (1 hunks)
  • src/odemis/acq/move.py (6 hunks)
  • src/odemis/gui/cont/tabs/fibsem_tab.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/odemis/acq/move.py (1)
src/odemis/driver/actuator.py (5)
  • updateMetadata (446-450)
  • updateMetadata (749-754)
  • updateMetadata (2215-2223)
  • updateMetadata (2819-2837)
  • updateMetadata (3318-3327)
🪛 Ruff (0.14.8)
src/odemis/acq/move.py

352-353: Avoid specifying long messages outside the exception class

(TRY003)

⏰ 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). (4)
  • GitHub Check: Agent
  • GitHub Check: CodeQL analysis (python)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build (ubuntu-24.04)
🔇 Additional comments (11)
src/odemis/acq/move.py (6)

342-356: LGTM! Well-designed upgrade path for backward compatibility.

The automatic conversion from "rx" to "mill_angle" ensures smooth upgrades for existing installations. The check for conflicting keys (both "rx" and "mill_angle") is a good safeguard.


506-511: LGTM! Correct usage of mill_angle for posture orientation.

The code properly reads "mill_angle" from metadata and converts it to stage tilt "rx" for the MILLING posture orientation.


1699-1708: LGTM! Transformation matrices correctly use mill_angle.

The milling transformation matrix computation now properly reads "mill_angle" from metadata.


1916-1923: LGTM! Correct transformation logic using mill_angle.

The code properly pops "mill_angle" from the metadata, converts it to stage tilt "rx", and updates the position accordingly.


1964-1968: LGTM! Reverse transformation correctly uses mill_angle.

The code properly reads "mill_angle" from metadata for the milling-to-SEM transformation.


2060-2068: LGTM! Proper persistence of milling angle when leaving MILLING posture.

The code correctly calculates the milling angle from the current stage tilt and updates the metadata to preserve the user's setting.

src/odemis/gui/cont/tabs/fibsem_tab.py (1)

410-418: LGTM! Correct metadata update using mill_angle.

The code properly writes "mill_angle" to the metadata while preserving the "rz" value, consistent with the backend changes.

install/linux/usr/share/odemis/sim/meteor-tfs3-sim.odm.yaml (1)

51-51: LGTM! Configuration correctly updated to use mill_angle.

The FAV_MILL_POS_ACTIVE key has been properly renamed from "rx" to "mill_angle", with the numeric value and "rz" preserved. The comment accurately describes mill_angle as the angle between the ion beam column and sample plane.

install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-sim.odm.yaml (1)

137-138: LGTM! Configuration correctly updated to use mill_angle.

The FAV_MILL_POS_ACTIVE key has been properly renamed from "rx" to "mill_angle", preserving both the numeric value and "rz". The comment explaining the tilt angle calculation remains accurate.

install/linux/usr/share/odemis/sim/meteor-fibsem-sim.odm.yaml (1)

96-96: LGTM! Configuration correctly updated to use mill_angle.

The FAV_MILL_POS_ACTIVE key has been properly renamed from "rx" to "mill_angle", with the numeric value (14°) and "rz" preserved. The comment correctly describes it as the milling angle.

install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-full-sim.odm.yaml (1)

137-138: LGTM! Configuration correctly updated to use mill_angle.

The FAV_MILL_POS_ACTIVE key has been properly renamed from "rx" to "mill_angle", preserving the milling angle value (10°) and "rz" rotation. The comment provides helpful context about the tilt angle calculation.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR renames the key "rx" to "mill_angle" in the MD_FAV_MILL_POS_ACTIVE metadata to improve clarity and avoid confusion with the stage tilt angle. The change includes an automatic upgrade path that converts old configurations to the new format when the backend starts.

Key changes:

  • Added automatic upgrade code in MeteorPostureManager.__init__() to convert "rx" to "mill_angle" in existing metadata
  • Updated all references to use "mill_angle" instead of "rx" throughout the codebase
  • Updated configuration files to use the new key format

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/odemis/acq/move.py Added upgrade path logic to automatically convert old "rx" key to "mill_angle", and updated all code references to use the new key name
src/odemis/gui/cont/tabs/fibsem_tab.py Updated GUI code to read and write "mill_angle" instead of "rx" in the milling metadata
install/linux/usr/share/odemis/sim/meteor-tfs3-sim.odm.yaml Updated configuration to use "mill_angle" key and improved comment clarity
install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-sim.odm.yaml Updated configuration to use "mill_angle" key and removed outdated comment
install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-full-sim.odm.yaml Updated configuration to use "mill_angle" key and removed outdated comment
install/linux/usr/share/odemis/sim/meteor-fibsem-sim.odm.yaml Updated configuration to use "mill_angle" key and improved comment clarity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mill_angle = mill_pos_active.pop("rx")
mill_angle = mill_pos_active.pop("mill_angle")
rx_mill = calculate_stage_tilt_from_milling_angle(mill_angle, pre_tilt=self.pre_tilt, column_tilt=self.fib_column_tilt)
mill_pos_active["rx"] = rx_mill # update the computed rx based on the milling angle, see the note above
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The comment "see the note above" is now outdated. The note that was previously above these lines (which explained that "rx" referred to the milling angle) has been removed in this PR. This comment should either be removed or updated to accurately reflect what the code is doing (computing the actual stage rx from the milling angle).

Suggested change
mill_pos_active["rx"] = rx_mill # update the computed rx based on the milling angle, see the note above
mill_pos_active["rx"] = rx_mill # update the stage rx (tilt) based on the computed milling-angle tilt

Copilot uses AI. Check for mistakes.
Comment on lines +345 to +347
# From Odemis v3.8 onwards, the "mill_angle" key is used instead.
# As it should never have a "rx" angle defined, we automatically convert it here, for the
# running back-end.
Copy link

Copilot AI Dec 19, 2025

Choose a reason for hiding this comment

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

The comment "As it should never have a "rx" angle defined" is confusing. The code is specifically checking for and handling the case where "rx" IS defined (from old configurations). Consider rephrasing to clarify that this refers to the stage-bare metadata in the new format, e.g., "As the stage-bare should use 'mill_angle' instead of 'rx' for the milling angle".

Suggested change
# From Odemis v3.8 onwards, the "mill_angle" key is used instead.
# As it should never have a "rx" angle defined, we automatically convert it here, for the
# running back-end.
# From Odemis v3.8 onwards, the "mill_angle" key is used instead for stage-bare metadata.
# As the stage-bare metadata in the new format should use "mill_angle" instead of "rx" for
# the milling angle, we automatically convert any legacy "rx"-based configuration here for
# the running back-end.

Copilot uses AI. Check for mistakes.
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.

3 participants