Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
fd5c0e8
Remove unused codes
hannalee2 Sep 26, 2025
7874de4
Change coords transform into functions and remove previous class
hannalee2 Sep 29, 2025
e085f61
Change the transM convention
hannalee2 Sep 29, 2025
9ec2aa7
Change the format to local = R @ global + t where local, global and …
hannalee2 Sep 29, 2025
2d13786
Add debug msg on reticleMetadata
hannalee2 Sep 29, 2025
dae4cd0
Add functions to get TransM from bregma to local
hannalee2 Sep 30, 2025
1b36c97
Update tramsM info into stage info (this will be used saving json and…
hannalee2 Sep 30, 2025
cf54e2c
Change the format of bregma to local
hannalee2 Oct 1, 2025
731e61d
Print bregma point in mm
hannalee2 Oct 1, 2025
e2c75a2
Merge remote-tracking branch 'origin/dev' into feature/transM
hannalee2 Oct 1, 2025
e3f4e32
Update release version
hannalee2 Oct 1, 2025
a8a95cc
Remove comments
hannalee2 Oct 1, 2025
d7b7dc9
Update parallax/utils/coords_converter.py
hannalee2 Oct 1, 2025
1d02b94
Fix typeO in comments
hannalee2 Oct 1, 2025
876780d
CoordsConverter change to helper functions
hannalee2 Oct 2, 2025
eb34047
Seperate into more functions
hannalee2 Oct 2, 2025
df78b2f
Update docstring
hannalee2 Oct 2, 2025
170d348
Add codes to get arc angle rx, ry and vector
hannalee2 Oct 2, 2025
2d2f01a
Implement to get arch angle (rx, ry) for the calibrated probes
hannalee2 Oct 3, 2025
0fe2dd6
Update calib info only when calib status is changed to save resources
hannalee2 Oct 6, 2025
89bdd07
Convert calib transforms to mm
hannalee2 Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parallax/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import os

__version__ = "1.12.0"
__version__ = "1.13.0"

# allow multiple OpenMP instances
os.environ["KMP_DUPLICATE_LIB_OK"] = "True"
21 changes: 18 additions & 3 deletions parallax/control_panel/probe_calibration_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from parallax.probe_calibration.probe_calibration import ProbeCalibration
from parallax.handlers.calculator import Calculator
from parallax.handlers.reticle_metadata import ReticleMetadata
from parallax.utils.coords_converter import get_transMs_bregma_to_local
from parallax.utils.probe_angles import find_probe_angle, find_probe_angles_dict

logger = logging.getLogger(__name__)
logger.setLevel(logging.WARNING)
Expand All @@ -25,6 +27,9 @@ class StageCalibrationInfo:
"""
detection_status: str = "default" # options: default, process, accepted
transM: Optional[np.ndarray] = None
transM_bregma: Optional[dict] = None
arc_angle_global: Optional[tuple] = None
arc_angle_bregma: Optional[dict] = None
L2_err: Optional[float] = None
dist_travel: Optional[np.ndarray] = None
status_x: Optional[str] = None
Expand Down Expand Up @@ -500,6 +505,10 @@ def probe_detect_accepted_status(self, switch_probe=False):
return

self.probe_detection_status = "accepted"

# Update reticle selector
self.reticle_metadata.load_metadata_from_file()

# Update into model
self.update_stage_info_to_model(self.selected_stage_id)
self.model.set_calibration_status(self.selected_stage_id, True)
Expand Down Expand Up @@ -536,9 +545,6 @@ def probe_detect_accepted_status(self, switch_probe=False):
self.filter = "no_filter"
logger.debug(f"filter: {self.filter}")

# Update reticle selector
self.reticle_metadata.load_metadata_from_file()


def update_probe_calib_status_transM(self, transformation_matrix):
"""
Expand Down Expand Up @@ -607,6 +613,7 @@ def display_probe_calib_status(self, transM, L2_err, dist_travel):

def update_probe_calib_status(self, moving_stage_id, transM, L2_err, dist_travel):
"""
Handler for the signal emitted when the probe calibration. (transM_info)
Updates the probe calibration status based on the moving stage ID and the provided calibration data.
If the selected stage matches the moving stage, the calibration data is displayed on the UI.
"""
Expand Down Expand Up @@ -786,6 +793,14 @@ def update_stage_info_to_model(self, stage_id) -> None:
stage_info.status_y = self.calib_status_y
stage_info.status_z = self.calib_status_z

# Update transM from bregma if available
transMbs = get_transMs_bregma_to_local(self.model, stage_id)
stage_info.transM_bregma = transMbs

# Get 3D angle
stage_info.arc_angle_global = find_probe_angle(self.transM)
stage_info.arc_angle_bregma = find_probe_angles_dict(transMbs)

def update_stage_info(self, info):
if isinstance(info, StageCalibrationInfo):
self.transM = info.transM
Expand Down
10 changes: 5 additions & 5 deletions parallax/handlers/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from PyQt6.uic import loadUi
from PyQt6.QtCore import Qt

from parallax.utils.coords_converter import CoordsConverter
from parallax.utils.coords_converter import local_to_global, global_to_local
from parallax.stages.stage_controller import StageController
from parallax.config.config_path import ui_dir

Expand Down Expand Up @@ -167,11 +167,11 @@ def _convert(self, sn):
logger.debug(f"User Input (Local): {self.reticle}")
trans_type, local_pts, global_pts = self._get_transform_type(globalX, globalY, globalZ, localX, localY, localZ)
if trans_type == "global_to_local":
local_pts_ret = CoordsConverter.global_to_local(self.model, sn, global_pts, self.reticle)
local_pts_ret = global_to_local(self.model, sn, global_pts, self.reticle)
if local_pts_ret is not None:
self._show_local_pts_result(sn, local_pts_ret)
elif trans_type == "local_to_global":
global_pts_ret = CoordsConverter.local_to_global(self.model, sn, local_pts, self.reticle)
global_pts_ret = local_to_global(self.model, sn, local_pts, self.reticle)
if global_pts_ret is not None:
self._show_global_pts_result(sn, global_pts_ret)
else:
Expand Down Expand Up @@ -434,8 +434,8 @@ def _is_z_safe_pos(self, stage_sn, x, y, z):
continue
try:
# Apply transformations to get global points for Z=15 and Z=0
global_pts_z15 = CoordsConverter.local_to_global(self.model, stage_sn, local_pts_z15)
global_pts_z0 = CoordsConverter.local_to_global(self.model, stage_sn, local_pts_z0)
global_pts_z15 = local_to_global(self.model, stage_sn, local_pts_z15)
global_pts_z0 = local_to_global(self.model, stage_sn, local_pts_z0)

if global_pts_z15 is None or global_pts_z0 is None:
return False # Transformation failed, return False
Expand Down
7 changes: 5 additions & 2 deletions parallax/handlers/reticle_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __init__(self, model, reticle_selector):
self.ui.add_btn.clicked.connect(self._add_groupbox)
self.ui.update_btn.clicked.connect(self._update_reticle_info)

# Update reticle selector
self.model.add_reticle_metadata_instance(self)

def load_metadata_from_file(self):
Expand All @@ -87,7 +88,7 @@ def load_metadata_from_file(self):
Exception: If there is an error reading the metadata file, logs the error.
"""
if not os.path.exists(reticle_metadata_file):
logger.info("No existing metadata file found. Starting fresh.")
logger.debug("No existing metadata file found. Starting fresh.")
return

try:
Expand All @@ -98,7 +99,8 @@ def load_metadata_from_file(self):
for group_box in self.groupboxes.values():
self._update_reticles(group_box)
self._update_to_reticle_selector()

else:
logger.debug("Metadata json file is empty. Starting fresh.")
except Exception as e:
logger.error(f"Error reading metadata file: {e}")

Expand All @@ -111,6 +113,7 @@ def _create_groupbox_from_metadata(self, reticle_data):
return # Do not add a new groupbox if it already exists

self._populate_groupbox(name, reticle_info)
logger.debug(f"Created groupbox for reticle: {name}")

def _add_groupbox(self):
"""This method creates new groupboxes with an alphabet name."""
Expand Down
2 changes: 1 addition & 1 deletion parallax/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def get_reticle_metadata(self, reticle_name):
Returns:
dict: Metadata information for the reticle.
"""
return self.reticle_metadata.get(reticle_name)
return self.reticle_metadata.get(reticle_name, None)

def remove_reticle_metadata(self, reticle_name):
"""Remove reticle metadata.
Expand Down
202 changes: 0 additions & 202 deletions parallax/probe_calibration/coords_transformation.py

This file was deleted.

Loading
Loading