Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Scantool.step_sizes #58

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

Added:

- The [Scantool.step_sizes][extra.components.Scantool.step_sizes] property (!58).
- The [Scan][extra.components.Scan] component to automatically detect steps
within a motor scan (!4).
- [DldPulses][extra.components.DldPulses] to access pulse information saved during delay line detector event reconstruction (!42).
Expand Down
13 changes: 13 additions & 0 deletions src/extra/components/scantool.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ def get_first_value(keys):
self._stop_positions = dict(zip(self.motors,
values["scanEnv.stopPoints.value"][:n_motors]))

# Calculate the step size
self._step_sizes = { motor: abs(self.start_positions[motor] - self.stop_positions[motor]) / self.steps[motor]
for motor in self.motors }

@property
def source_name(self) -> str:
"""The name of the scantool device."""
Expand Down Expand Up @@ -140,6 +144,15 @@ def steps(self) -> dict:
scanned over."""
return self._steps

@property
def step_sizes(self) -> dict:
"""A dictionary mapping motor aliases to their step size.

Unlike most other properties, this is calculated from the step
information rather than being read from a property.
"""
return self._step_sizes

@property
def start_positions(self) -> dict:
"""A dictionary mapping motor aliases to their start positions."""
Expand Down