Skip to content

[MSD-219][fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"]#3309

Merged
pieleric merged 1 commit intodelmic:masterfrom
pieleric:fix-meteor-rename-md_fav_mill_pos_active-rx-mill_angle
Jan 15, 2026
Merged

[MSD-219][fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"]#3309
pieleric merged 1 commit intodelmic:masterfrom
pieleric:fix-meteor-rename-md_fav_mill_pos_active-rx-mill_angle

Conversation

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

@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
Copy Markdown

coderabbitai Bot commented Dec 19, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

This pull request renames the milling-angle metadata field from rx to mill_angle in multiple simulator YAML files and updates code to read, write and migrate that key. Four simulator YAMLs (Meteor/Tescan/TFS3 variants) have FAV_MILL_POS_ACTIVE entries changed to use mill_angle (keeping rz). Code changes in src/odemis/acq/move.py and src/odemis/gui/cont/tabs/fibsem_tab.py read/write mill_angle, perform an automatic migration from legacy rx when present (error if both exist), and propagate the value into posture/transform calculations.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant GUI as Fibsem Tab (GUI)
    participant Move as move.py
    participant Meta as Stage Metadata / YAML
    participant Transform as Posture/Transform Logic

    User->>GUI: open milling controls / change angle
    GUI->>Move: read MD_FAV_MILL_POS_ACTIVE
    Move->>Meta: fetch metadata (mill_angle or rx)
    alt legacy rx present
        Move->>Move: migrate rx -> mill_angle (error if both keys)
        Move->>Meta: write updated metadata (mill_angle)
    end
    Move->>Transform: provide mill_angle for posture transforms
    Transform->>Move: computed posture/rotations
    Move->>Meta: update stage metadata (ensure rx parity if needed)
    Move->>GUI: return current milling angle / updated state
    GUI->>User: display angle
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: renaming MD_FAV_MILL_POS_ACTIVE["rx"] to ["mill_angle"], which aligns perfectly with the changeset modifications across multiple configuration files and source code.
Description check ✅ Passed The description is directly related to the changeset, explaining the rationale (avoiding confusion with stage-bare tilt) and the upgrade mechanism to handle legacy configurations with the old key.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

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

📒 Files selected for processing (6)
  • install/linux/usr/share/odemis/sim/meteor-fibsem-sim.odm.yaml
  • install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-full-sim.odm.yaml
  • install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-sim.odm.yaml
  • install/linux/usr/share/odemis/sim/meteor-tfs3-sim.odm.yaml
  • src/odemis/acq/move.py
  • src/odemis/gui/cont/tabs/fibsem_tab.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • install/linux/usr/share/odemis/sim/meteor-fibsem-sim.odm.yaml
  • install/linux/usr/share/odemis/sim/meteor-tescan-fibsem-sim.odm.yaml
  • src/odemis/gui/cont/tabs/fibsem_tab.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.py: Always use type hints for function parameters and return types in Python code
Include docstrings for all functions and classes, following the reStructuredText style guide (without type information)
Ensure code is valid for Python 3.10 and above
Clean up code at the end of a task using autopep8 with the command: autopep8 --in-place --select W291,W292,W293,W391

Files:

  • src/odemis/acq/move.py
🧠 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.py
🪛 Ruff (0.14.11)
src/odemis/acq/move.py

353-354: 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). (2)
  • GitHub Check: build (ubuntu-22.04)
  • GitHub Check: build (ubuntu-24.04)
🔇 Additional comments (9)
install/linux/usr/share/odemis/sim/meteor-tfs3-sim.odm.yaml (1)

51-51: LGTM!

The rename from rx to mill_angle is correctly applied. The value (0.2443461 rad ≈ 14°) is preserved, and the inline comment accurately describes the semantic meaning of the milling angle.

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

138-138: LGTM!

The rename from rx to mill_angle is correctly applied. The value (0.174532925 rad ≈ 10°) is preserved, and the inline comment accurately describes the milling angle and rotation.

src/odemis/acq/move.py (7)

342-357: LGTM! Clean upgrade path implementation.

The migration logic correctly handles:

  • Detection of legacy rx key in MD_FAV_MILL_POS_ACTIVE
  • Error case when both rx and mill_angle exist (preventing ambiguity)
  • Automatic conversion using dict.pop() which atomically removes and retrieves the value
  • Persistence via updateMetadata() for the running backend session

The approach ensures backward compatibility with older configuration files while preventing conflicts.


507-512: LGTM!

The get_posture_orientation method correctly reads mill_angle from metadata and converts it to stage rx using calculate_stage_tilt_from_milling_angle. The returned dictionary properly contains the computed rx needed for stage positioning.


1700-1711: LGTM!

The _update_conversion method correctly reads mill_angle from metadata and computes the stage tilt for transformation matrix calculation.


1917-1946: LGTM!

The _transformFromSEMToMilling correctly:

  1. Creates a copy of mill_pos_active to avoid mutating original metadata
  2. Pops mill_angle and computes the stage rx value
  3. Sets rx in the local copy for the transformation

The pattern ensures the transformation returns proper stage coordinates with rx while the metadata retains mill_angle.


1962-1968: LGTM!

The _transformFromMillingToSEM correctly reads mill_angle from metadata and computes rx_mill for the coordinate transformation without modifying the original metadata.


2061-2068: LGTM!

When leaving the MILLING posture, the code correctly:

  1. Computes the mill_angle from the current stage rx using calculate_milling_angle_from_stage_tilt
  2. Updates MD_FAV_MILL_POS_ACTIVE with the new mill_angle value

This preserves the user's milling position for restoration on the next visit to MILLING posture.


2537-2562: LGTM!

Both helper functions are well-implemented with:

  • Clear docstrings following reStructuredText style
  • Proper type hints for parameters and return types
  • Documented equation showing the relationship between milling angle and stage tilt
  • Mathematically inverse operations that correctly convert between the two representations

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@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
Copy Markdown

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.

Comment thread src/odemis/acq/move.py Outdated
Comment thread src/odemis/acq/move.py
Comment thread src/odemis/acq/move.py Outdated
Comment thread src/odemis/acq/move.py
@pieleric pieleric changed the title [MSD_219][fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"] [MSD-219][fix] METEOR: rename MD_FAV_MILL_POS_ACTIVE["rx"] -> ["mill_angle"] Jan 14, 2026
"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 force-pushed the fix-meteor-rename-md_fav_mill_pos_active-rx-mill_angle branch from 7492b75 to ee8248a Compare January 15, 2026 10:59
@pieleric pieleric merged commit 7bbbec0 into delmic:master Jan 15, 2026
5 checks passed
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.

4 participants