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 Long name to OphydObj #1187

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
304d852
Added long name to OphydObject and Signal
cjtitus Apr 10, 2024
87118ae
fixed long_name setter
cjtitus Apr 10, 2024
43ac00e
STY: Ran Black formatter
cjtitus Apr 10, 2024
50a5362
long_name added to signal class
cjtitus Jul 15, 2024
2d4602a
MNT #1206 array comparison handling
prjemian Jul 30, 2024
d0719d9
STY #1206 lint
prjemian Jul 30, 2024
d4bdea2
TST #1206
prjemian Jul 31, 2024
51821c0
STY #1206
prjemian Jul 31, 2024
4b69284
STY #1206
prjemian Jul 31, 2024
a26fff0
STY #1206
prjemian Jul 31, 2024
97607cf
TST #1206 tuples & numpy arrays
prjemian Jul 31, 2024
1e9b4f7
STY #1206
prjemian Jul 31, 2024
f2af9c0
MNT #1260 refactor per discussion
prjemian Jul 31, 2024
b67697f
MNT #1206
prjemian Jul 31, 2024
9df37cd
simpler, per @tacaswell
prjemian Jul 31, 2024
f8827f3
MNT #1206 remove commented code
prjemian Jul 31, 2024
9451e6b
Propagating Long Name through components, test for name propagation a…
cjtitus Aug 1, 2024
ba4c59a
Merge branch 'bluesky:master' into long_name
cjtitus Aug 1, 2024
884bf05
STY: Fixed comma
cjtitus Aug 1, 2024
050b98f
Merge pull request #1207 from bluesky/1206-EpicsSignal-array-set
tacaswell Aug 1, 2024
851264f
Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows
dependabot[bot] Sep 3, 2024
6807862
Merge pull request #1209 from bluesky/dependabot/github_actions/dot-g…
ZLLentz Sep 3, 2024
e8114eb
TYPO should be lower case to be consistent with others in this module
prjemian Sep 20, 2024
27f9fd7
Merge pull request #1211 from bluesky/TYPO-in-quadem
prjemian Sep 21, 2024
afc4bb9
Unpin numpy
danielballan Oct 16, 2024
84d9e3d
Merge pull request #1214 from danielballan/unpin-numpy
tacaswell Oct 17, 2024
2f09ec0
Test on prereleases of bluesky, event-model.
danielballan Oct 25, 2024
a7db790
Fix actions syntax
danielballan Oct 25, 2024
71f8075
Fix actions syntax again
danielballan Oct 25, 2024
5df3f56
Merge pull request #1217 from danielballan/test-on-prereleases
tacaswell Oct 25, 2024
fbcb304
MNT #1218 use provided value of trigger_value
prjemian Oct 29, 2024
651cec9
TST #1218
prjemian Oct 29, 2024
c24440c
TST #1218 test
prjemian Oct 29, 2024
19d225c
STY #1218
prjemian Oct 29, 2024
66d3df8
STY #1218 per black
prjemian Oct 29, 2024
ada8229
TST #1218 refactor and reduce number of tests
prjemian Oct 29, 2024
895b5ac
TST #1218 straggler
prjemian Oct 29, 2024
6b409b9
TST #1218
prjemian Oct 29, 2024
19e1edb
TST #1218
prjemian Oct 29, 2024
52c082d
Merge pull request #1219 from bluesky/1218-use-the-value-of-trigger_v…
tacaswell Oct 29, 2024
da948eb
signal: add dtype, shape keyword arguments to constructor, to be able…
May 24, 2024
1038ac8
fix: set default shape in NDDerivedSignal
Jun 5, 2024
e93622e
test: add tests for different dtype, shape and Signals
Jun 5, 2024
db157c5
fix: data shape returns a tuple
Oct 31, 2024
ee7ab9b
Merge pull request #1194 from mguijarr/signal_valueinfo
tacaswell Nov 12, 2024
1043148
Add release notes for v1.10.0
Nov 21, 2024
69d7650
Merge pull request #1220 from mguijarr/rel-notes-1.10.0
tacaswell Nov 21, 2024
d27a577
CI: do not try to start docker images that no longer exist
tacaswell Nov 21, 2024
caf6c0b
TST: remove pytest.ini so the marks in pyproject.toml are found
tacaswell Nov 21, 2024
36af81d
TST: mark more tests that require motorsim to be running
tacaswell Nov 21, 2024
b2a3a99
CI: skip motorsim tests on CI
tacaswell Nov 21, 2024
9cce944
DOC: fix bad markup
tacaswell Nov 21, 2024
25fe830
Merge pull request #1221 from tacaswell/ci/skip_busted_docker
jwlodek Nov 21, 2024
1040e2d
DOC: add key missing 'in'
tacaswell Nov 25, 2024
0ead9f7
ENH: add ability to control component names are mangled
tacaswell Nov 25, 2024
fb49ef8
MNT: try to avoid segfaults
tacaswell Nov 25, 2024
38c35ef
CI: pin back pyepics to try and avoid segfaults
tacaswell Nov 25, 2024
789c39f
REL: v1.10.0
mrakitin Dec 3, 2024
2b62a7a
CI: update release process
mrakitin Dec 4, 2024
c936ab6
CI: uncomment the release steps block (for GH and PyPI)
mrakitin Dec 4, 2024
b76f3bc
Merge pull request #1224 from mrakitin/ci-update-release-process
tacaswell Dec 4, 2024
3c974dc
REL: v1.10.1
mrakitin Dec 4, 2024
902d299
Merge pull request #1222 from tacaswell/enh/control_child_name_mangling
tacaswell Dec 4, 2024
9264700
Add description for missing pyepics or caproto installation
thomashopkins32 Dec 10, 2024
1093e6b
Change description and add to other methods not implemented
thomashopkins32 Dec 10, 2024
a15af88
Fix black formatting
thomashopkins32 Dec 10, 2024
848488e
Revert change from wrong black version
thomashopkins32 Dec 10, 2024
1e5f037
Merge pull request #1226 from thomashopkins32/fix_pyepics_error_handling
tacaswell Dec 11, 2024
7259b95
FIX: do not leak the book-keeping float sub-class out of __init__
tacaswell Jan 28, 2025
6387083
STY: upgrade config and fix broken flake8 dependency for pre-commit
mrakitin Jan 28, 2025
4a14425
Merge pull request #1231 from tacaswell/fix/dflt_type_leak
mrakitin Feb 7, 2025
17d1878
Added long name to OphydObject and Signal
cjtitus Apr 10, 2024
6294195
fixed long_name setter
cjtitus Apr 10, 2024
ab56513
STY: Ran Black formatter
cjtitus Apr 10, 2024
b89ea5f
long_name added to signal class
cjtitus Jul 15, 2024
9777b7c
Propagating Long Name through components, test for name propagation a…
cjtitus Aug 1, 2024
067c382
STY: Fixed comma
cjtitus Aug 1, 2024
14849ca
Finished rebase
cjtitus Feb 11, 2025
52b6264
Fixed all merge conflicts with rebase, removed describe from classes …
cjtitus Feb 11, 2025
57f1093
Removed odd duplication of long_name in device, test_device.py passing
cjtitus Feb 11, 2025
8e36f8c
STY: Added extra line for flake8
cjtitus Feb 11, 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
37 changes: 24 additions & 13 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Lint
run: pip install --user .[dev] && tox -e pre-commit
Expand All @@ -22,7 +22,7 @@ jobs:
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # So we get history for version numbers

Expand All @@ -32,7 +32,7 @@ jobs:
run: SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct) pipx run build --sdist --wheel

- name: Upload Wheel and Sdist as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
Expand All @@ -46,30 +46,39 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
prerelease: [false]
# Add one more job that runs on prereleases
include:
- python-version: "3.12"
prerelease: true
runs-on: ubuntu-latest
env:
TEST_CL: pyepics

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # So we get history for version number

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: pip install --upgrade setuptools && pip install -e .[dev] && pipdeptree

- name: Install prereleases of certain dependencies.
run: pip install --upgrade --pre bluesky event-model
if: ${{ matrix.prerelease }}

- name: Start IOCs in containers.
run: |
source ${GITHUB_WORKSPACE}/scripts/epics_exports.sh
source ${GITHUB_WORKSPACE}/scripts/epics_docker.sh

- name: Test with pytest
run: pytest -k "${TEST_CL}"
run: pytest -k "${TEST_CL}" -m "not motorsim" --strict-markers

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
Expand All @@ -80,10 +89,15 @@ jobs:
release:
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
# upload to PyPI and make a release on every tag
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Github Release
# We pin to the SHA, not the tag, for security reasons.
Expand All @@ -96,9 +110,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
# The PYPI_PASSWORD must be a pypi token with the "pypi-" prefix with sufficient permissions to upload this package
# https://pypi.org/help/#apitoken
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: pipx run twine upload dist/*
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ jobs:
TOX_DIRECT: 1

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0 # So we get history for version numbers

- name: Install Packages
run: sudo apt-get install graphviz

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -35,7 +35,7 @@ jobs:
run: tox -e docs

- name: Upload built docs as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: docs
path: build
Expand All @@ -44,7 +44,7 @@ jobs:
run: echo "REPOSITORY_NAME=${GITHUB_REPOSITORY#*/}" >> $GITHUB_ENV

- name: Deploy documentation to blueskyproject.io.
if: github.repository_owner == 'bluesky' && github.ref_name == 'master'
if: github.repository_owner == 'bluesky' && github.ref_name == 'main'
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
.eggs/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
Expand All @@ -10,14 +10,14 @@ repos:
hooks:
- id: black
name: Run black
stages: [commit]
stages: [pre-commit]
language: system
entry: black --check --diff
types: [python]

- id: flake8
name: Run flake8
stages: [commit]
stages: [pre-commit]
language: system
entry: flake8
types: [python]
30 changes: 30 additions & 0 deletions docs/user/reference/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,36 @@
Release History
=================

1.10.1 (2024-12-04)
===================

Fixes
-----

* Fix CI to release the package on PyPI


1.10.0 (2024-12-03)
===================

Added
-----

* ``count`` parameter to Signal.get (same as pv.get)
* ``.locate()`` method to EpicsMotor, returning setpoint and readback
* ``dtype`` and ``shape`` keywords can be specified in Signal constructor to avoid type inference
* ``describe()`` returns ``dtype_numpy``, if available

Fixes
-----

* Allow write path template on FileStoreBase to include ``.``
* Enforce FileStoreBase root path to be absolute
* Fixed fraction in ADTriggerStatus to match docs
* Status objects do not create threads when timeout is None
* Enforce configured Component.trigger_value is used for acquisition signal


1.9.0 (2023-09-15)
==================

Expand Down
16 changes: 12 additions & 4 deletions ophyd/_dummy_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,27 @@ def setup(logger):


def caget(*args, **kwargs):
raise NotImplementedError
raise NotImplementedError(
"Dummy control layer in-use. Try installing either pyepics or caproto."
)


def caput(*args, **kwargs):
raise NotImplementedError
raise NotImplementedError(
"Dummy control layer in-use. Try installing either pyepics or caproto."
)


def get_pv(*args, **kwargs):
raise NotImplementedError
raise NotImplementedError(
"Dummy control layer in-use. Try installing either pyepics or caproto."
)


def release_pvs(*args, **kwargs):
raise NotImplementedError
raise NotImplementedError(
"Dummy control layer in-use. Try installing either pyepics or caproto."
)


def get_dispatcher():
Expand Down
4 changes: 4 additions & 0 deletions ophyd/_pyepics_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

from ._dispatch import EventDispatcher, _CallbackThread, wrap_callback

# suspect attempt to monkey-patch printf is causing segfaults
if hasattr(ca, "WITH_CA_MESSAGES"):
ca.WITH_CA_MESSAGES = True

_min_pyepics = "3.4.2"

if parse(epics.__version__) < parse(_min_pyepics):
Expand Down
11 changes: 10 additions & 1 deletion ophyd/areadetector/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@

from ..device import Component, Device, DynamicDeviceComponent
from ..ophydobj import Kind, OphydObject
from ..signal import ArrayAttributeSignal, DerivedSignal, EpicsSignal, EpicsSignalRO
from ..signal import (
UNSET_VALUE,
ArrayAttributeSignal,
DerivedSignal,
EpicsSignal,
EpicsSignalRO,
)
from . import docs


Expand Down Expand Up @@ -92,6 +98,9 @@ def __init__(
if isinstance(num_dimensions, str):
num_dimensions = getattr(parent, num_dimensions)
self._num_dimensions = num_dimensions
kwargs.setdefault("value", UNSET_VALUE)
kwargs.setdefault("dtype", None)
kwargs.setdefault("shape", shape)
super().__init__(derived_from=derived_from, parent=parent, **kwargs)

@property
Expand Down
17 changes: 12 additions & 5 deletions ophyd/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def maybe_add_prefix(self, instance, kw, suffix):
suffix from.

kw : str
The key of associated with the suffix. If this key is
The key of associated with the suffix. If this key is in
self.add_prefix than prepend the prefix to the suffix and
return, else just return the suffix.

Expand All @@ -253,10 +253,16 @@ def create_component(self, instance):
"Instantiate the object described by this Component for a Device"
kwargs = self.kwargs.copy()
kwargs.update(
name=f"{instance.name}_{self.attr}",
name=f"{instance.name}{instance._child_name_separator}{self.attr}",
kind=instance._component_kinds[self.attr],
attr_name=self.attr,
)
if issubclass(self.cls, Device):
kwargs.setdefault("child_name_separator", instance._child_name_separator)

_long_name = kwargs.get("long_name", self.attr)
_parent_long_name = getattr(instance, "long_name", instance.name)
kwargs["long_name"] = f"{_parent_long_name} {_long_name}"

for kw, val in list(kwargs.items()):
kwargs[kw] = self.maybe_add_prefix(instance, kw, val)
Expand Down Expand Up @@ -839,10 +845,11 @@ def __init__(
read_attrs=None,
configuration_attrs=None,
parent=None,
child_name_separator="_",
**kwargs,
):
self._destroyed = False

self._child_name_separator = child_name_separator
# Store EpicsSignal objects (only created once they are accessed)
self._signals = {}

Expand Down Expand Up @@ -1457,7 +1464,8 @@ def done_acquisition(**ignored_kwargs):
# has finished
self._done_acquiring()

acq_signal.put(1, wait=False, callback=done_acquisition)
trigger_value = self._sig_attrs[acq_signal.attr_name].trigger_value
acq_signal.put(trigger_value, wait=False, callback=done_acquisition)
return status

def stop(self, *, success=False):
Expand Down Expand Up @@ -1785,7 +1793,6 @@ def wrapped(self, *args, **kwargs):
def _wait_for_connection_context(value, doc):
@contextlib.contextmanager
def wrapped(dev):

orig = dev.lazy_wait_for_connection
dev.lazy_wait_for_connection = value
try:
Expand Down
26 changes: 23 additions & 3 deletions ophyd/ophydobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class IFBase(IntFlag, boundary=KEEP):
...

except ImportError:

IFBase = IntFlag


Expand Down Expand Up @@ -148,7 +147,16 @@ class OphydObject:
__any_instantiated = False
subscriptions: ClassVar[FrozenSet[str]] = frozenset()

def __init__(self, *, name=None, attr_name="", parent=None, labels=None, kind=None):
def __init__(
self,
*,
name=None,
attr_name="",
parent=None,
labels=None,
kind=None,
long_name=None,
):
if labels is None:
labels = set()
self._ophyd_labels_ = set(labels)
Expand All @@ -166,7 +174,7 @@ def __init__(self, *, name=None, attr_name="", parent=None, labels=None, kind=No
raise ValueError("name must be a string.")
self._name = name
self._parent = parent

self._long_name = long_name
# dictionary of wrapped callbacks
self._callbacks = {k: {} for k in self.subscriptions}
# this is to maintain api on clear_sub
Expand Down Expand Up @@ -331,6 +339,18 @@ def name(self):
def name(self, name):
self._name = name

@property
def long_name(self):
"""name of the device"""
if self._long_name is not None:
return self._long_name
else:
return self._name

@long_name.setter
def long_name(self, name):
self._long_name = name

@property
def attr_name(self):
return self._attr_name
Expand Down
2 changes: 1 addition & 1 deletion ophyd/quadem.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class QuadEM(SingleTrigger, DetectorBase):
position_offset_calc_y = Cpt(EpicsSignal, "ComputePosOffsetY")

position_scale_x = Cpt(EpicsSignal, "PositionScaleX")
position_scale_Y = Cpt(EpicsSignal, "PositionScaleY")
position_scale_y = Cpt(EpicsSignal, "PositionScaleY")

image = Cpt(ImagePlugin, "image1:")
current1 = Cpt(StatsPlugin, "Current1:")
Expand Down
Loading
Loading