Skip to content

Commit

Permalink
Merge pull request #1031 from BCDA-APS/1009-deprecate-EpicsMotorLimit…
Browse files Browse the repository at this point in the history
…sMixin

EpicsMotorLimitsMixin superseded by ophyd.EpicsMotor
  • Loading branch information
prjemian authored Oct 25, 2024
2 parents 084fcb5 + 5d8a1a9 commit 78901d1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ describe future plans.

- Use 'NeXus_release' file attribute in 'nxwriter' callback.

Deprecations
------------

- 'EpicsMotorLimitsMixin' features are now part of 'ophyd.EpicsMotor'.

1.7.0
******

Expand Down
1 change: 0 additions & 1 deletion apstools/devices/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@

from .motor_mixins import EpicsMotorDialMixin
from .motor_mixins import EpicsMotorEnableMixin
from .motor_mixins import EpicsMotorLimitsMixin
from .motor_mixins import EpicsMotorRawMixin
from .motor_mixins import EpicsMotorResolutionMixin
from .motor_mixins import EpicsMotorServoMixin
Expand Down
1 change: 0 additions & 1 deletion apstools/devices/description_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class EpicsMotorWithDescription(EpicsDescriptionMixin, EpicsMotor):
class EpicsMotorWithMore(
EpicsDescriptionMixin,
EpicsMotorLimitsMixin,
EpicsMotorDialMixin,
EpicsMotorRawMixin,
EpicsMotor
Expand Down
28 changes: 13 additions & 15 deletions apstools/devices/motor_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
~EpicsMotorDialMixin
~EpicsMotorEnableMixin
~EpicsMotorLimitsMixin
~EpicsMotorRawMixin
~EpicsMotorResolutionMixin
~EpicsMotorServoMixin
"""

import warnings

from bluesky import plan_stubs as bps
from ophyd import Component
from ophyd import EpicsSignal
Expand Down Expand Up @@ -85,27 +86,24 @@ def disable_motor(self):
class EpicsMotorLimitsMixin(DeviceMixinBase):
"""
add motor record HLM & LLM fields & compatibility get_lim() and set_lim()
.. caution:: Deprecated. Now part of 'ophyd.EpicsMotor' class.
Will be removed in a future release of apstools.
.. index:: Ophyd Device Mixin; EpicsMotorLimitsMixin
EXAMPLE::
from ophyd import EpicsMotor
from apstools.devices import EpicsMotorLimitsMixin
class myEpicsMotor(EpicsMotorLimitsMixin, EpicsMotor): pass
m1 = myEpicsMotor('xxx:m1', name='m1')
lo = m1.get_lim(-1)
hi = m1.get_lim(1)
m1.set_lim(-25, -5)
print(m1.get_lim(-1), m1.get_lim(1))
m1.set_lim(lo, hi)
..
index:: Ophyd Device Mixin; EpicsMotorLimitsMixin
"""

soft_limit_lo = Component(EpicsSignal, ".LLM", kind="omitted")
soft_limit_hi = Component(EpicsSignal, ".HLM", kind="omitted")

def __init__(self, *args, **kwargs):
# fmt: off
warnings.warn(
"'EpicsMotorLimitsMixin' class is deprecated."
" These features are now part of 'ophyd.EpicsMotor'."
)
# fmt: on
super().__init__(*args, **kwargs)

def cb_limit_changed(value, old_value, **kwargs):
Expand Down
1 change: 0 additions & 1 deletion docs/source/api/_devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ Motors, Positioners, Axes, ...
~apstools.devices.description_mixin.EpicsDescriptionMixin
~apstools.devices.motor_mixins.EpicsMotorDialMixin
~apstools.devices.motor_mixins.EpicsMotorEnableMixin
~apstools.devices.motor_mixins.EpicsMotorLimitsMixin
~apstools.devices.motor_mixins.EpicsMotorRawMixin
~apstools.devices.motor_mixins.EpicsMotorResolutionMixin
~apstools.devices.motor_mixins.EpicsMotorServoMixin
Expand Down

0 comments on commit 78901d1

Please sign in to comment.