Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
89a810d
cleanup imports
rocco8773 May 14, 2026
7118503
apply black to enforce PEP8
rocco8773 May 14, 2026
7b55fef
first really rough pass on LaPDXYZTransform
rocco8773 May 14, 2026
0b0d389
first really rough pass on LaPDXYZTransform._matrix_to_drive
rocco8773 May 14, 2026
42ebeda
refactor variable names and remove argument table_pivot_to_zlead_vert…
rocco8773 May 14, 2026
fd1feba
update comments
rocco8773 May 14, 2026
e847534
remove noqa associated with PEP8 N806
rocco8773 May 14, 2026
5ffa4bb
clean up comments
rocco8773 May 14, 2026
32cd942
be consistent... use "ball-valve" instead of "ball valve"
rocco8773 May 14, 2026
8688ac1
update annotations for drive_polarity and mspace_polarity
rocco8773 May 14, 2026
525d1be
fix __transformer__ so it does not contain LaPD6KTransform twice
rocco8773 May 14, 2026
10f6587
add default values to LaPDXYZTransform arguments
rocco8773 May 14, 2026
7335192
audit all LaPDXYZTransform docstrings
rocco8773 May 14, 2026
56cb344
fix typos
rocco8773 May 15, 2026
27869ab
add ipykernel to the doc dependencies
rocco8773 May 15, 2026
b58faf7
nbsphinx_prolog explicitly convert to string
rocco8773 May 15, 2026
872b52a
nada commit
rocco8773 May 15, 2026
5099930
fix beta to b_that relation
rocco8773 May 17, 2026
723fa07
rough out example notebook
rocco8773 May 17, 2026
ba9628f
rename lapd_xy_transform.ipynb -> LaPDXYTransform.ipynb
rocco8773 May 18, 2026
5829bfa
remove prototyping sections from LaPDXYTransform.ipynb
rocco8773 May 18, 2026
57c2f89
rename LaPDXYZTransform_.ipynb -> LaPDXYZTransform.ipynb
rocco8773 May 18, 2026
2e2744f
clean up example notebook
rocco8773 May 18, 2026
7335e13
rough our layout for LaPDXYZTransformCalculator
rocco8773 May 20, 2026
e07a8a6
Merge branch 'main' into xyz_transform
rocco8773 May 20, 2026
0c4282d
appease isort and black
rocco8773 May 20, 2026
3c95a0d
fix spelling errors and clear all outputs
rocco8773 May 20, 2026
dfa3fd8
add a codespell configuration to setup.cfg
rocco8773 May 20, 2026
8f502dd
fix spelling errors
rocco8773 May 20, 2026
798e404
clear all outputs
rocco8773 May 20, 2026
3be8fc0
Merge branch 'xyz_transform' into xyz_calculator
rocco8773 May 20, 2026
435a0b1
add initial diagram for the xyz calculator
rocco8773 May 21, 2026
47e8359
rename all functionality of measure_2a -> measure_2, and remove measu…
rocco8773 May 21, 2026
3d4de9a
reposition the "Reset to Defaults" button
rocco8773 May 21, 2026
3a19f17
reposition the "pivot_to_center" text box
rocco8773 May 21, 2026
7f85cd8
rename functionality for pivot_to_drive -> pivot_to_xzcross
rocco8773 May 21, 2026
6b2bd9f
reposition pivot_to_center and pivot_to_xzcross text boxes
rocco8773 May 21, 2026
0302ff3
reposition pivot_to_feedthru text box
rocco8773 May 21, 2026
45330e0
remove "measure_2" radio button
rocco8773 May 21, 2026
fb4e740
move "measure_1" text box
rocco8773 May 21, 2026
5ccec99
move "measure_2" text box
rocco8773 May 21, 2026
3ec71c5
remove functionality around fiducial_width
rocco8773 May 21, 2026
2b0d672
move text boxes
rocco8773 May 21, 2026
0875feb
reorder initialization of constants, measures, and calc parameters...…
rocco8773 May 21, 2026
e8631f8
reorder definitions of label widgets
rocco8773 May 21, 2026
b69c4b8
update calc_pivot_to_xzcross()
rocco8773 May 21, 2026
4748dc3
add label probe_axis_offset_label
rocco8773 May 21, 2026
2f56a60
add label table_pivot_to_zlead_screw_label
rocco8773 May 22, 2026
696e26e
simplify _validate_measure_1 and _validate_measure_2
rocco8773 May 22, 2026
bac06e1
leave clarifying comment
rocco8773 May 22, 2026
3a3ac95
create module bapsf_motion.gui.calculators
rocco8773 May 22, 2026
e0091a5
create calculator base classes BaseCalculatorWindow and BaseCalculato…
rocco8773 May 22, 2026
1773ffe
have LaPDXYZTransformCalculator inherit from BaseCalculatorWindow and…
rocco8773 May 22, 2026
ed1e396
remove unused imports
rocco8773 May 22, 2026
6e5699f
move lapd_xyz_transform_calculator.py into the bapsf_motion.gui.calcu…
rocco8773 May 22, 2026
0deb09f
rename lapd_xyz_transform_calculator.py -> lapd_xyz_transform.py
rocco8773 May 22, 2026
be5a1fa
move closing Signal into BaseCalculatorWindow
rocco8773 May 22, 2026
f3efb4a
move image defining architecture into BaseCalculatorWindow
rocco8773 May 22, 2026
e8d317b
add typing annotation to closeEvent
rocco8773 May 22, 2026
a079847
move definition of main window into BaseCalculatorWindow
rocco8773 May 22, 2026
f35229f
create abstract method _connect_signals
rocco8773 May 22, 2026
ac8508c
remove unnecessary setting of stylesheet
rocco8773 May 22, 2026
cb3b5e8
create metaclass QABCMainWindow
rocco8773 May 22, 2026
1604cbd
create property _stylesheet_string and move stylesheet setting into B…
rocco8773 May 22, 2026
78a9585
add ABD to BaseCalculatorWindow inheritance
rocco8773 May 22, 2026
ffe6a46
move background image setup into BaseCalculatorWindow
rocco8773 May 22, 2026
8cee16b
reorder methode definitions
rocco8773 May 22, 2026
e49a923
create abstract methode _init_widgets
rocco8773 May 22, 2026
948ad69
move _define_layout() to BaseCalculatorWindow
rocco8773 May 22, 2026
8c1174f
move the reset_btn into BaseCalculatorWindow
rocco8773 May 23, 2026
b10bb9a
define an export parameters button
rocco8773 May 23, 2026
b99b5a1
make abstract method _reset_parameters
rocco8773 May 23, 2026
639203a
decorate _reset_parameters() with @Slot()
rocco8773 May 23, 2026
a60de6e
create abstract method _collect_export_parameters
rocco8773 May 23, 2026
936ce4f
connect the export button
rocco8773 May 23, 2026
7c6d4c9
move lapd_xy_transform_calculator.py into bapsf_motion.gui.calculators
rocco8773 May 23, 2026
a7b424a
create property BaseCalculatorApp.calculator
rocco8773 May 23, 2026
6475801
rename lapd_xy_transform_calculator.py -> lapd_xy_transform.py
rocco8773 May 23, 2026
ebaafc0
appease grumpy isort
rocco8773 May 23, 2026
7c58d2a
appease grumpy black
rocco8773 May 23, 2026
f9bf84a
remove unused imports
rocco8773 May 23, 2026
34783aa
have LaPDXYTransformCalculatorApp inherit from BaseCalculatorApp
rocco8773 May 23, 2026
ed94d67
add word Transform to the XYZ window title
rocco8773 May 24, 2026
1753453
Integrate BaseCalculoatorWindow into LaPDXYTransformCalculator
rocco8773 May 24, 2026
0210c68
add class attributes _CALCULATOR_FAMILY and _CALCULATOR_TYPE to BaseC…
rocco8773 May 26, 2026
4a3a093
start incorporating BaseCalculatorWindow.exportParameters into Config…
rocco8773 May 26, 2026
bfec80b
add to TransformConfigOverlay the signal importParameters
rocco8773 May 26, 2026
e973915
update LaPDXYZTransformCalculator to utilize class attributes _CALCUL…
rocco8773 May 26, 2026
df5f6a0
create a generic warning dialog box
rocco8773 May 26, 2026
fd251e4
flush out ConfigureGUI._import_calculator_parameters()
rocco8773 May 26, 2026
1eed4f4
Merge branch 'main' into xyz_transform
rocco8773 May 28, 2026
4d5dbb3
Merge branch 'xyz_transform' into xyz_calculator
rocco8773 May 28, 2026
2fc8d4e
Merge branch 'main' into xyz_transform
rocco8773 May 28, 2026
20b5a42
Merge branch 'xyz_transform' into xyz_calculator
rocco8773 May 28, 2026
8c72c45
replace uses of Union[] with pipe |
rocco8773 May 28, 2026
acb0e9a
Merge branch 'main' into xyz_calculator
rocco8773 Jun 6, 2026
5e1e9b6
Merge branch 'main' into xyz_transform
rocco8773 Jun 6, 2026
0d51534
Merge branch 'main' into xyz_transform
rocco8773 Jun 8, 2026
551ad3e
Merge branch 'xyz_transform' into xyz_calculator
rocco8773 Jun 8, 2026
99037c4
Merge branch 'main' into xyz_calculator
rocco8773 Jun 14, 2026
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
6 changes: 5 additions & 1 deletion bapsf_motion/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
__all__ = [
"ConfigureApp",
"LaPDXYTransformCalculatorApp",
"LaPDXYZTransformCalculatorApp",
"get_qapplication",
"get_color_scheme",
"cast_color_to_rgba_string",
]

try:
from bapsf_motion.gui.calculators import LaPDXYTransformCalculatorApp
from bapsf_motion.gui.calculators import (
LaPDXYTransformCalculatorApp,
LaPDXYZTransformCalculatorApp,
)
from bapsf_motion.gui.configure.configure_ import ConfigureApp
from bapsf_motion.gui.helpers import (
cast_color_to_rgba_string,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions bapsf_motion/gui/calculators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
__all__ = [
"LaPDXYTransformCalculator",
"LaPDXYTransformCalculatorApp",
"LaPDXYZTransformCalculator",
"LaPDXYZTransformCalculatorApp",
]

from bapsf_motion.gui.calculators.lapd_xy_transform import (
LaPDXYTransformCalculator,
LaPDXYTransformCalculatorApp,
)
from bapsf_motion.gui.calculators.lapd_xyz_transform import (
LaPDXYZTransformCalculator,
LaPDXYZTransformCalculatorApp,
)
341 changes: 341 additions & 0 deletions bapsf_motion/gui/calculators/lapd_xyz_transform.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
__all__ = ["LaPDXYZTransformCalculator", "LaPDXYZTransformCalculatorApp"]

import ast
import re

from PySide6.QtCore import QPoint, Qt, Slot
from PySide6.QtWidgets import QLineEdit
from typing import Optional

from bapsf_motion.gui.calculators.bases import BaseCalculatorApp, BaseCalculatorWindow
from bapsf_motion.gui.widgets import StyleButton


class LaPDXYZTransformCalculator(BaseCalculatorWindow):
_WINDOW_TITLE = "LaPD XYZ Transform Calculator"
_IMAGE_NAME = "LaPDXYZTransform_diagram.png"

_CALCULATOR_FAMILY = "transform"
_CALCULATOR_TYPE = "lapd_xyz"

_defaults = { # all values in cm
"measure_1": 54.2,
"measure_2": 58.0,
}

def __init__(self):

# Initialized measure values
self.measure_1 = self._defaults["measure_1"]
self.measure_2 = self._defaults["measure_2"]

# Initialized constants
self.ball_valve_cap_thickness = 0.81 * 2.54
self.probe_drive_endplate_thickness = 0.75 * 2.54
self.probe_kf40_thickness = 2.54
self.velmex_rail_width = 3.4 * 2.54

# Initilized "Calculated" Transform Parameters
self.pivot_to_center = 58.771
self.probe_axis_offset = 30.47
self.table_pivot_to_zlead_screw = 12.488
self.pivot_to_feedthru = self.calc_pivot_to_feedthru()
self.pivot_to_xzcross = self.calc_pivot_to_xzcross()

super().__init__()

def _init_widgets(self):
# Place "measure" labels
_txt = QLineEdit(f"{self.measure_1:.2f} cm", parent=self)
_txt.setReadOnly(False)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(598, 442)
_txt.move(p)
_txt.setFixedWidth(120)
_txt.setObjectName("measure_1")
self.measure_1_label = _txt

_txt = QLineEdit(f"{self.measure_2:.2f} cm", parent=self)
_txt.setReadOnly(False)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1050, 508)
_txt.move(p)
_txt.setFixedWidth(120)
_txt.setObjectName("measure_2")
self.measure_2_label = _txt

# Place "constant" labels
_txt = QLineEdit(f"{self.ball_valve_cap_thickness:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(12)
font.setBold(True)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(526, 191)
_txt.move(p)
_txt.setFixedWidth(86)
_txt.setObjectName("ball_valve_cap_thickness")
self.ball_valve_cap_thickness_label = _txt

_txt = QLineEdit(f"{self.probe_kf40_thickness:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(12)
font.setBold(True)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1053, 187)
_txt.move(p)
_txt.setFixedWidth(86)
_txt.setObjectName("probe_kf40_thickness")
self.probe_kf40_thickness_label = _txt

_txt = QLineEdit(f"{self.probe_drive_endplate_thickness:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(12)
font.setBold(True)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1129, 230)
_txt.move(p)
_txt.setFixedWidth(86)
_txt.setObjectName("probe_drive_endplate_thickness")
self.probe_drive_endplate_thickness_label = _txt

_txt = QLineEdit(f"{self.velmex_rail_width:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(12)
font.setBold(True)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1496 - 273, 121 + 24)
_txt.move(p)
_txt.setFixedWidth(86)
_txt.setObjectName("velmex_rail_width")
self.velmex_rail_width_label = _txt

# Place "Transform Parameter" labels
_txt = QLineEdit(f"{self.pivot_to_center:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(262, 17)
_txt.move(p)
_txt.setFixedWidth(120)
self.pivot_to_center_label = _txt

_txt = QLineEdit(f"{self.pivot_to_feedthru:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(570, 108)
_txt.move(p)
_txt.setFixedWidth(120)
self.pivot_to_feedthru_label = _txt

_txt = QLineEdit(f"{self.probe_axis_offset:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1590, 658)
_txt.move(p)
_txt.setFixedWidth(120)
self.probe_axis_offset_label = _txt

_txt = QLineEdit(f"{self.pivot_to_xzcross:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(980, 17)
_txt.move(p)
_txt.setFixedWidth(120)
self.pivot_to_xzcross_label = _txt

_txt = QLineEdit(f"{self.table_pivot_to_zlead_screw:.3f} cm", parent=self)
_txt.setReadOnly(True)
_txt.setAlignment(Qt.AlignmentFlag.AlignCenter)
font = _txt.font()
font.setPointSize(14)
_txt.setFont(font)
p = self.geometry().topLeft() + QPoint(1437, 82)
_txt.move(p)
_txt.setFixedWidth(120)
self.table_pivot_to_zlead_screw_label = _txt

# Place Action Buttons
p = self.geometry().topLeft() + QPoint(270, 694)
self.reset_btn.move(p)

p += QPoint(220, 0)
self.export_btn.move(p)

def _connect_signals(self):
self.measure_1_label.editingFinished.connect(self._validate_measure_1)
self.measure_2_label.editingFinished.connect(self._validate_measure_2)

@property
def _stylesheet_string(self):
_stylesheet = super()._stylesheet_string
_stylesheet += """
QLineEdit { border: 2px solid black; border-radius: 5px }
QLineEdit#measure_1 { border: 2px solid rgb(255, 0, 0) }
QLineEdit#measure_2 { border: 2px solid rgb(255, 0, 0) }

QLineEdit#ball_valve_cap_thickness {
border: 2px solid rgb(68, 114, 196);
color: rgb(68, 114, 196);
}
QLineEdit#probe_kf40_thickness {
border: 2px solid rgb(68, 114, 196);
color: rgb(68, 114, 196);
}
QLineEdit#probe_drive_endplate_thickness {
border: 2px solid rgb(68, 114, 196);
color: rgb(68, 114, 196);
}
QLineEdit#velmex_rail_width {
border: 2px solid rgb(68, 114, 196);
color: rgb(68, 114, 196);
}
"""
return _stylesheet

def _collect_export_parameters(self) -> dict:
return {
**super()._collect_export_parameters(),
"pivot_to_center": self.pivot_to_center,
"probe_axis_offset": self.probe_axis_offset,
"table_pivot_to_zlead_screw": self.table_pivot_to_zlead_screw,
"pivot_to_xzcross": self.pivot_to_xzcross,
}

def calc_pivot_to_feedthru(self):
return ( # fmt: skip
self.ball_valve_cap_thickness
+ self.measure_1
- self.probe_kf40_thickness
)

def calc_pivot_to_xzcross(self):
return (
self.ball_valve_cap_thickness
+ self.measure_1
+ self.probe_drive_endplate_thickness
+ self.measure_2
+ self.table_pivot_to_zlead_screw
)

def recalculate_parameters(self):
self.pivot_to_feedthru = self.calc_pivot_to_feedthru()
self.pivot_to_xzcross = self.calc_pivot_to_xzcross()

self._update_all_labels()

def _reset_measure_values(self):
self.measure_1 = self._defaults["measure_1"]
self.measure_2 = self._defaults["measure_2"]

self.recalculate_parameters()

@Slot()
def _reset_parameters(self):
self._reset_measure_values()

def _update_all_labels(self):
# No update of
#
# - pivot_to_center_label
# - probe_axis_offset_label
# - table_pivot_to_zlead_screw_label
#
# is needed because they do NOT change with measure_1
# and measure_2
#
self._update_measure_1_label()
self._update_measure_2_label()
self._update_pivot_to_feedthru_label()
self._update_pivot_to_xzcross_label()

def _update_pivot_to_feedthru_label(self):
_txt = f"{self.pivot_to_feedthru:.3f} cm"
self.pivot_to_feedthru_label.setText(_txt)

def _update_pivot_to_xzcross_label(self):
_txt = f"{self.pivot_to_xzcross:.3f} cm"
self.pivot_to_xzcross_label.setText(_txt)

def _update_measure_1_label(self):
_txt = f"{self.measure_1:.2f} cm"
self.measure_1_label.setText(_txt)

def _update_measure_2_label(self):
_txt = f"{self.measure_2:.2f} cm"
self.measure_2_label.setText(_txt)

@staticmethod
def _validate_measure(text: str) -> float | None:
match = re.compile(r"(?P<value>\d+(.\d*)?)(\s*cm)?").fullmatch(text)

if match is None:
return None

value = ast.literal_eval(match.group("value"))

if value == 0:
return None

return float(value)

@Slot()
def _validate_measure_1(self):
_txt = self.measure_1_label.text()
value = self._validate_measure(_txt)

if (
value is None # input was invalid
or value <= self.probe_kf40_thickness # not physically possible
):
self._update_all_labels()
return

self.measure_1 = value
self.recalculate_parameters()

@Slot()
def _validate_measure_2(self):
_txt = self.measure_2_label.text()
value = self._validate_measure(_txt)

if value is None or value <= 0:
# input was invalid OR not physically possible
self._update_all_labels()
return

self.measure_2 = value
self.recalculate_parameters()


class LaPDXYZTransformCalculatorApp(BaseCalculatorApp):
_CALCULATOR_CLASS = LaPDXYZTransformCalculator


if __name__ == "__main__":
app = LaPDXYZTransformCalculatorApp([])
app.exec()
9 changes: 7 additions & 2 deletions bapsf_motion/transform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@
"DroopCorrectABC",
"LaPDXYDroopCorrect",
]
__transformer__ = ["IdentityTransform", "LaPDXYTransform", "LaPD6KTransform"]
__transformer__ = [
"IdentityTransform",
"LaPDXYTransform",
"LaPD6KTransform",
"LaPDXYZTransform",
]
__all__ += __transformer__

from bapsf_motion.transform.base import BaseTransform
from bapsf_motion.transform.helpers import register_transform, transform_factory
from bapsf_motion.transform.identity import IdentityTransform
from bapsf_motion.transform.lapd import LaPD6KTransform, LaPDXYTransform
from bapsf_motion.transform.lapd import LaPD6KTransform, LaPDXYTransform, LaPDXYZTransform
from bapsf_motion.transform.lapd_droop import DroopCorrectABC, LaPDXYDroopCorrect
Loading
Loading