Skip to content

Commit

Permalink
Merge branch 'main' into devel-0.47.x
Browse files Browse the repository at this point in the history
  • Loading branch information
arnobaer committed Feb 26, 2024
2 parents 9b26e8f + 0d953a8 commit 02ad2a9
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 31 deletions.
7 changes: 6 additions & 1 deletion changelog
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Reset sequence state for group items correctly.

## [0.46.2] - 2024-02-26
### Fixed
- Table calibration fails for Z axis (#214).

## [0.46.1] - 2023-10-16
### Added
- Collapse all samples action (#210).
Expand Down Expand Up @@ -411,7 +415,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Default HV source route terminal `rear` (#17).

[Unreleased]: https://github.com/hephy-dd/comet-pqc/compare/0.47.0...HEAD
[0.47.0]: https://github.com/hephy-dd/comet-pqc/compare/0.46.1...0.47.0
[0.47.0]: https://github.com/hephy-dd/comet-pqc/compare/0.46.2...0.47.0
[0.46.2]: https://github.com/hephy-dd/comet-pqc/compare/0.46.1...0.46.2
[0.46.1]: https://github.com/hephy-dd/comet-pqc/compare/0.46.0...0.46.1
[0.46.0]: https://github.com/hephy-dd/comet-pqc/compare/0.45.0...0.46.0
[0.45.0]: https://github.com/hephy-dd/comet-pqc/compare/0.44.0...0.45.0
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ aux_links:
"PQC on GitHub":
- "//github.com/hephy-dd/comet-pqc"

footer_content: "Copyright &copy; 2019-2023 <a href=\"https://hephy.at\">HEPHY</a>. PQC is licensed under the <a href=\"https://github.com/hephy-dd/comet-pqc/tree/main/LICENSE\">GNU General Public License Version 3</a>."
footer_content: "Copyright &copy; 2019-2024 <a href=\"https://hephy.at\">HEPHY</a>. PQC is licensed under the <a href=\"https://github.com/hephy-dd/comet-pqc/tree/main/LICENSE\">GNU General Public License Version 3</a>."
5 changes: 5 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ nav_order: 10
### Fixed
- Reset sequence state for group items correctly.

## 0.46.2

### Fixed
- Table calibration fails for Z axis.

## 0.46.1

### Added
Expand Down
1 change: 1 addition & 0 deletions pqc/core/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __call__(self, *args, **kwargs) -> None:
self._result = self._target(*args, **kwargs)
except Exception as exc:
self._exc = exc
raise exc
finally:
self._ready.set()

Expand Down
2 changes: 1 addition & 1 deletion pqc/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def axes(self):
return self.table.x, self.table.y, self.table.z

@property
def table_is_moving(self) -> None:
def is_moving(self) -> None:
return (self.table.status & 0x1) == 0x1

def configure(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pqc/view/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__all__ = ["MainWindow"]

APP_TITLE = "PQC"
APP_COPY = "Copyright &copy; 2020-2023 HEPHY"
APP_COPY = "Copyright &copy; 2020-2024 HEPHY"
APP_LICENSE = "This software is licensed under the GNU General Public License v3.0"
APP_DECRIPTION = """Process Quality Control (PQC) for CMS Tracker."""

Expand Down
53 changes: 28 additions & 25 deletions pqc/workers/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,9 @@ def calibrate_table(self) -> Request:
def request(table):
self._stop_event.clear()
self.set_message("Calibrating...")
timeout: float = 60.0 # movement timeout in seconds
retries = RETRIES
delay = 1.0
delay: float = 1.0 # operaion delay in seconds
axes = table.axes

def handle_abort():
Expand All @@ -374,35 +375,37 @@ def ncal(axis):
index = axes.index(axis)
logger.info("ncal %s...", AXIS_NAMES.get(index))
axis.ncal()
for i in range(retries + 1):
t_start = time.monotonic()
time.sleep(delay)
while table.is_moving:
handle_abort()
# Axis reached origin?
if time.monotonic() - t_start > timeout:
raise TimeoutError()
current_pos = table.position
update_status(*current_pos)
if current_pos[index] == 0.0:
logger.info("ncal %s... done.", AXIS_NAMES.get(index))
break
time.sleep(delay)
return i < retries
current_pos = table.position
update_status(*current_pos)
logger.info("ncal %s... done.", AXIS_NAMES.get(index))
return True

def nrm(axis):
index = axes.index(axis)
logger.info("nrm %s...", AXIS_NAMES.get(index))
axis.nrm()
reference_pos = table.position
update_status(*reference_pos)
t_start = time.monotonic()
time.sleep(delay)
for i in range(retries + 1):
while table.is_moving:
handle_abort()
if time.monotonic() - t_start > timeout:
raise TimeoutError()
current_pos = table.position
update_status(*current_pos)
# Axis stopped moving?
if reference_pos[index] == current_pos[index]:
logger.info("nrm %s... done.", AXIS_NAMES.get(index))
break
reference_pos = current_pos
time.sleep(delay)
return i < retries
current_pos = table.position
update_status(*current_pos)
logger.info("nrm %s... done.", AXIS_NAMES.get(index))
return True

handle_abort()
update_caldone()
Expand Down Expand Up @@ -476,10 +479,10 @@ def nrm(axis):
table.handle_error()

# Moving into limit switches generates error 1004
table.relative_move((-AXIS_OFFSET, -AXIS_OFFSET, 0))
table.move_relative((-AXIS_OFFSET, -AXIS_OFFSET, 0))
for i in range(retries):
time.sleep(delay)
if not table.is_moving():
if not table.is_moving:
break
handle_abort()
update_status(*table.position)
Expand All @@ -491,12 +494,12 @@ def nrm(axis):
table.handle_error(ignore=[1004])

# Move X=52.000 mm before Z calibration to avoid collisions
x_offset = 52000
x_offset = 52000 # TODO
y_offset = 0
table.relative_move((x_offset, y_offset, 0))
table.move_relative((x_offset, y_offset, 0))
for i in range(retries):
time.sleep(delay)
if not table.is_moving():
if not table.is_moving:
break
handle_abort()
update_status(*table.position)
Expand Down Expand Up @@ -538,12 +541,12 @@ def nrm(axis):
table.handle_error()

# Move Z axis down
x_offset = 52000
x_offset = 52000 # TODO
y_offset = 0
table.move_absolute((x_offset, y_offset, 0))
for i in range(retries):
time.sleep(delay)
if not table.is_moving():
if not table.is_moving:
break
handle_abort()
update_status(*table.position)
Expand All @@ -559,10 +562,10 @@ def nrm(axis):
table.handle_error()

# Move to default position
table.move_absolute(0, 0, 0)
table.move_absolute((0, 0, 0))
for i in range(retries):
time.sleep(delay)
if not table.is_moving():
if not table.is_moving:
break
handle_abort()
update_status(*table.position)
Expand Down
2 changes: 1 addition & 1 deletion pyinstaller/windows_app.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ app_filename = f"pqc-{app_version}.exe"
app_icon = os.path.join(app_root, "assets", "icons", "pqc.ico")
app_title = "PQC"
app_description = "Process Quality Control for CMS outer tracker"
app_copyright = "Copyright © 2019-2023 HEPHY"
app_copyright = "Copyright © 2019-2024 HEPHY"
app_organization = "HEPHY"

# Entry point for the application
Expand Down
3 changes: 2 additions & 1 deletion tests/test_core_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def test_request():

def test_request_exception():
req = Request(lambda: 1 / 0)
req()
with pytest.raises(ZeroDivisionError):
req()
with pytest.raises(ZeroDivisionError):
req.get(timeout=.001)

Expand Down

0 comments on commit 02ad2a9

Please sign in to comment.