diff --git a/apstools/devices/__init__.py b/apstools/devices/__init__.py index ae8598863..70c5b8e05 100644 --- a/apstools/devices/__init__.py +++ b/apstools/devices/__init__.py @@ -18,6 +18,10 @@ from .aps_machine import ApsMachineParametersDevice from .aps_undulator import PlanarUndulator +from .aps_undulator import Revolver_Undulator +from .aps_undulator import STI_Undulator +from .aps_undulator import Undulator2M +from .aps_undulator import Undulator4M from .area_detector_support import AD_EpicsFileNameMixin from .area_detector_support import AD_FrameType_schemes diff --git a/apstools/devices/aps_undulator.py b/apstools/devices/aps_undulator.py index 62974fc2b..9bf43607c 100644 --- a/apstools/devices/aps_undulator.py +++ b/apstools/devices/aps_undulator.py @@ -7,6 +7,11 @@ ~PlanarUndulator ~Revolver_Undulator ~STI_Undulator + ~Undulator2M + ~Undulator4M + +.. note:: The ``ApsUndulator`` and ``ApsUndulatorDual`` device support + classes have been removed. These devices are not used in the APS-U era. """ import logging @@ -166,7 +171,7 @@ class Revolver_Undulator(ID_Spectrum_Mixin, ID_Controls_Mixin, ID_Misc_Mixin, De class STI_Undulator(PlanarUndulator): """APS Planar Undulator built by STI Optronics. - .. index:: + .. index:: Ophyd Device; PlanarUndulator Ophyd Device; STI_Undulator @@ -178,6 +183,44 @@ class STI_Undulator(PlanarUndulator): """ +class Undulator2M(ID_Spectrum_Mixin, ID_Controls_Mixin, ID_Misc_Mixin, Device): + """APS 2M Undulator. + + .. index:: + Ophyd Device; PlanarUndulator + Ophyd Device; Undulator2M + + APS Use: 1ID, downstream. + + EXAMPLE:: + + undulator = Undulator2M("S01ID:DSID:", name="undulator") + """ + + # PVs not found + busy = None + magnet = None + version_plc = None + version_hpmu = None + + done = Component(EpicsSignalRO, "BusyM.VAL", kind="omitted") + done_value = 0 + + +class Undulator4M(Undulator2M): + """APS 4M Undulator. + + .. index:: + Ophyd Device; PlanarUndulator + Ophyd Device; Undulator4M + + APS Use: 11ID, downstream & upstream. + + EXAMPLE:: + + undulator = Undulator4M("S11ID:DSID:", name="undulator") + """ + # ----------------------------------------------------------------------------- # :author: Pete R. Jemian # :email: jemian@anl.gov diff --git a/apstools/devices/tests/test_aps_undulator.py b/apstools/devices/tests/test_aps_undulator.py index 66c535cdf..5fd831531 100644 --- a/apstools/devices/tests/test_aps_undulator.py +++ b/apstools/devices/tests/test_aps_undulator.py @@ -2,22 +2,36 @@ from ophyd.sim import instantiate_fake_device from ..aps_undulator import PlanarUndulator +from ..aps_undulator import Revolver_Undulator +from ..aps_undulator import STI_Undulator +from ..aps_undulator import Undulator2M +from ..aps_undulator import Undulator4M -@pytest.fixture() -def undulator(): - undulator = instantiate_fake_device(PlanarUndulator, prefix="PSS:255ID:", name="undulator") - return undulator +TEST_PV_PREFIX = "TEST:PREFIX:" +TEST_CASES = [ + [PlanarUndulator, TEST_PV_PREFIX], + [Revolver_Undulator, TEST_PV_PREFIX], + [STI_Undulator, TEST_PV_PREFIX], + [Undulator2M, TEST_PV_PREFIX], + [Undulator4M, TEST_PV_PREFIX], +] -def test_set_energy(undulator): +@pytest.mark.parametrize("klass, prefix", TEST_CASES) +def test_set_energy(klass, prefix): + undulator = instantiate_fake_device(klass, prefix=prefix, name="undulator") + assert undulator.start_button.get() == 0 undulator.energy.set(5) assert undulator.energy.setpoint.get() == 5 assert undulator.start_button.get() == 1 -def test_stop_energy(undulator): +@pytest.mark.parametrize("klass, prefix", TEST_CASES) +def test_stop_energy(klass, prefix): + undulator = instantiate_fake_device(klass, prefix=prefix, name="undulator") + assert undulator.stop_button.get() == 0 undulator.stop() assert undulator.stop_button.get() == 1 diff --git a/apstools/tests/__init__.py b/apstools/tests/__init__.py index cb6fd7e48..8537f1d44 100644 --- a/apstools/tests/__init__.py +++ b/apstools/tests/__init__.py @@ -9,7 +9,7 @@ IOC_GP = "gp:" # general purpose IOC: motors, scalers, slits, ... IOC_AD = "ad:" # ADSimDetector IOC -MASTER_TIMEOUT = 3 +MASTER_TIMEOUT = 10 MAX_TESTING_RETRIES = 3 SHORT_DELAY_FOR_EPICS_IOC_DATABASE_PROCESSING = 2.0 / 60 # two 60Hz clock cycles diff --git a/docs/source/api/_devices.rst b/docs/source/api/_devices.rst index 98aeed6d3..667b11a0e 100644 --- a/docs/source/api/_devices.rst +++ b/docs/source/api/_devices.rst @@ -18,6 +18,7 @@ See these categories: * :ref:`devices.aps_support` * :ref:`devices.area_detector` * :ref:`devices.flyers` +* :ref:`devices.insertion_devices` * :ref:`devices.motors` * :ref:`devices.scalers` * :ref:`devices.shutters` @@ -104,6 +105,22 @@ Fly Scan Support ``ScalerMotorFlyer()`` support withdrawn pending issue #763. +.. _devices.insertion_devices: + +Insertion Devices ++++++++++++++++++ + +.. autosummary:: + + ~apstools.devices.aps_undulator.PlanarUndulator + ~apstools.devices.aps_undulator.Revolver_Undulator + ~apstools.devices.aps_undulator.STI_Undulator + ~apstools.devices.aps_undulator.Undulator2M + ~apstools.devices.aps_undulator.Undulator4M + +.. note:: The ``ApsUndulator`` and ``ApsUndulatorDual`` device support + classes have been removed. These devices are not used in the APS-U era. + .. _devices.motors: Motors, Positioners, Axes, ...