From a01012a15723e0b32cd3181410c3a73ef8ae805d Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 12 Oct 2021 19:22:26 -0500 Subject: [PATCH 1/3] ENH #462 --- apstools/_devices/xia_pf4.py | 104 ++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/apstools/_devices/xia_pf4.py b/apstools/_devices/xia_pf4.py index de97e0960..9cf915ea9 100644 --- a/apstools/_devices/xia_pf4.py +++ b/apstools/_devices/xia_pf4.py @@ -4,18 +4,120 @@ .. autosummary:: + ~Pf4FilterSingle + ~Pf4FilterDual + ~Pf4FilterTriple + ~Pf4FilterCommon + ~Pf4FilterBank ~DualPf4FilterBox """ +__all__ = """ + DualPf4FilterBox + Pf4FilterBank + Pf4FilterCommon + Pf4FilterDual + Pf4FilterSingle + Pf4FilterTriple +""".split() + from ophyd import Component from ophyd import Device from ophyd import EpicsSignal from ophyd import EpicsSignalRO +from ophyd import FormattedComponent + + +class Pf4FilterBank(Device): + """ + A single module of XIA PF4 filters (4-blades). + + .. index:: Ophyd Device; Pf4FilterBank + + EXAMPLES:: + + + pf4B = Pf4FilterBank("ioc:pf4:", name="pf4B", bank="B") + + # -or- + + class MyTriplePf4(Pf4FilterCommon): + A = Component(Pf4FilterBank, "", bank="A") + B = Component(Pf4FilterBank, "", bank="B") + C = Component(Pf4FilterBank, "", bank="C") + + pf4 = MyTriplePf4("ioc:pf4:", name="pf4") + """ + + fPos = FormattedComponent(EpicsSignal, "{prefix}fPos{_bank}", kind="config") + control = FormattedComponent( + EpicsSignalRO, "{prefix}bank{_bank}", string=True, kind="config" + ) + bits = FormattedComponent(EpicsSignalRO, "{prefix}bitFlag{_bank}", kind="config") + transmission = FormattedComponent( + EpicsSignalRO, "{prefix}trans{_bank}", kind="config" + ) + + def __init__(self, prefix, bank=None, **kwargs): + self._bank = bank + super().__init__(prefix, **kwargs) + + +class Pf4FilterCommon(Device): + """ + XIA PF4 filters - common support. + + .. index:: Ophyd Device; Pf4FilterCommon + + Use ``Pf4FilterCommon`` to build support for a configuration + of PF4 filters (such as 3 or 4 filter banks). + + EXAMPLE:: + + class MyTriplePf4(Pf4FilterCommon): + A = Component(Pf4FilterBank, "", bank="A") + B = Component(Pf4FilterBank, "", bank="B") + C = Component(Pf4FilterBank, "", bank="C") + + pf4 = MyTriplePf4("ioc:pf4:", name="pf4") + """ + + transmission = Component(EpicsSignalRO, "trans", kind="hinted") + inverse_transmission = Component(EpicsSignalRO, "invTrans", kind="normal") + + thickness_Al_mm = Component(EpicsSignalRO, "filterAl", kind="config") + thickness_Ti_mm = Component(EpicsSignalRO, "filterTi", kind="config") + thickness_glass_mm = Component(EpicsSignalRO, "filterGlass", kind="config") + + energy_keV_local = Component(EpicsSignal, "E:local", kind="config") + energy_keV_mono = Component(EpicsSignal, "displayEnergy", kind="config") + + mode = Component(EpicsSignal, "useMono", string=True, kind="config") + + +class Pf4FilterSingle(Pf4FilterCommon): + """XIA PF4 Filter: one set of 4 filters (A).""" + + A = Component(Pf4FilterBank, "", bank="A") + + +class Pf4FilterDual(Pf4FilterSingle): + """XIA PF4 Filter: two sets of 4 filters (A, B).""" + + B = Component(Pf4FilterBank, "", bank="B") + + +class Pf4FilterTriple(Pf4FilterDual): + """XIA PF4 Filter: three sets of 4 filters (A, B, C).""" + + C = Component(Pf4FilterBank, "", bank="C") class DualPf4FilterBox(Device): """ - Dual Xia PF4 filter boxes using support from synApps (using Al, Ti foils) + LEGACY (use Pf4FilterDual now): Dual (Al, Ti) Xia PF4 filter boxes + + Support from synApps (using Al, Ti foils) .. index:: Ophyd Device; DualPf4FilterBox From 8801623802234a0a49f82e34c197a1e33d80f1eb Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 12 Oct 2021 19:25:13 -0500 Subject: [PATCH 2/3] MNT #462 importable --- apstools/_devices/__init__.py | 54 +++++++++++++++++++++++++++++++++++ apstools/devices.py | 44 ++++------------------------ 2 files changed, 60 insertions(+), 38 deletions(-) diff --git a/apstools/_devices/__init__.py b/apstools/_devices/__init__.py index 26bf33afc..5d345207b 100644 --- a/apstools/_devices/__init__.py +++ b/apstools/_devices/__init__.py @@ -1,3 +1,52 @@ +__all__ = """ + AD_EpicsHdf5FileName + AD_EpicsJpegFileName + AD_FrameType_schemes + AD_plugin_primed + AD_prime_plugin + AD_prime_plugin2 + ApsBssUserInfoDevice + ApsCycleComputedRO + ApsCycleDM + ApsMachineParametersDevice + ApsPssShutter + ApsPssShutterWithStatus + ApsUndulator + ApsUndulatorDual + AxisTunerException + AxisTunerMixin + DeviceMixinBase + DualPf4FilterBox + EpicsDescriptionMixin + EpicsMotorDialMixin + EpicsMotorEnableMixin + EpicsMotorLimitsMixin + EpicsMotorRawMixin + EpicsMotorResolutionMixin + EpicsMotorServoMixin + EpicsMotorShutter + EpicsOnOffShutter + KohzuSeqCtl_Monochromator + OneSignalShutter + Pf4FilterBank + Pf4FilterCommon + Pf4FilterDual + Pf4FilterSingle + Pf4FilterTriple + PTC10AioChannel + PTC10PositionerMixin + PTC10RtdChannel + PTC10TcChannel + PVPositionerSoftDone + SCALER_AUTOCOUNT_MODE + ShutterBase + SimulatedApsPssShutterWithStatus + SRS570_PreAmplifier + Struck3820 + TrackingSignal + use_EPICS_scaler_channels +""".split() + from .aps_bss_user import ApsBssUserInfoDevice from .aps_cycle import ApsCycleComputedRO from .aps_cycle import ApsCycleDM @@ -39,3 +88,8 @@ from .struck3820 import Struck3820 from .tracking_signal import TrackingSignal from .xia_pf4 import DualPf4FilterBox +from .xia_pf4 import Pf4FilterBank +from .xia_pf4 import Pf4FilterCommon +from .xia_pf4 import Pf4FilterDual +from .xia_pf4 import Pf4FilterSingle +from .xia_pf4 import Pf4FilterTriple diff --git a/apstools/devices.py b/apstools/devices.py index d978636fb..0df453c49 100644 --- a/apstools/devices.py +++ b/apstools/devices.py @@ -66,6 +66,11 @@ .. autosummary:: ~apstools._devices.aps_bss_user.ApsBssUserInfoDevice + ~apstools._devices.xia_pf4.Pf4FilterSingle + ~apstools._devices.xia_pf4.Pf4FilterDual + ~apstools._devices.xia_pf4.Pf4FilterTriple + ~apstools._devices.xia_pf4.Pf4FilterBank + ~apstools._devices.xia_pf4.Pf4FilterCommon ~apstools._devices.xia_pf4.DualPf4FilterBox ~apstools._devices.description_mixin.EpicsDescriptionMixin ~apstools._devices.kohzu_monochromator.KohzuSeqCtl_Monochromator @@ -107,44 +112,7 @@ from bluesky import plan_stubs as bps # pull up submodule features for: from apstools.devices import XYZ -from ._devices.aps_bss_user import ApsBssUserInfoDevice -from ._devices.aps_cycle import ApsCycleComputedRO -from ._devices.aps_cycle import ApsCycleDM -from ._devices.aps_machine import ApsMachineParametersDevice -from ._devices.aps_machine import ApsOperatorMessagesDevice -from ._devices.area_detector_support import AD_FrameType_schemes -from ._devices.area_detector_support import AD_plugin_primed -from ._devices.area_detector_support import AD_prime_plugin -from ._devices.area_detector_support import AD_prime_plugin2 -from ._devices.area_detector_support import AD_EpicsHdf5FileName -from ._devices.area_detector_support import AD_EpicsJpegFileName -from ._devices.axis_tuner import AxisTunerException -from ._devices.axis_tuner import AxisTunerMixin -from ._devices.description_mixin import EpicsDescriptionMixin -from ._devices.kohzu_monochromator import KohzuSeqCtl_Monochromator -from ._devices.mixin_base import DeviceMixinBase -from ._devices.motor_mixins import EpicsMotorDialMixin -from ._devices.motor_mixins import EpicsMotorEnableMixin -from ._devices.motor_mixins import EpicsMotorLimitsMixin -from ._devices.motor_mixins import EpicsMotorRawMixin -from ._devices.motor_mixins import EpicsMotorResolutionMixin -from ._devices.motor_mixins import EpicsMotorServoMixin -from ._devices.ptc10_controller import PTC10AioChannel -from ._devices.ptc10_controller import PTC10RtdChannel -from ._devices.ptc10_controller import PTC10TcChannel -from ._devices.ptc10_controller import PTC10PositionerMixin -from ._devices.scaler_support import SCALER_AUTOCOUNT_MODE -from ._devices.scaler_support import use_EPICS_scaler_channels -from ._devices.shutters import ApsPssShutter -from ._devices.shutters import ApsPssShutterWithStatus -from ._devices.shutters import EpicsMotorShutter -from ._devices.shutters import EpicsOnOffShutter -from ._devices.shutters import OneSignalShutter -from ._devices.shutters import ShutterBase -from ._devices.shutters import SimulatedApsPssShutterWithStatus -from ._devices.struck3820 import Struck3820 -from ._devices.tracking_signal import TrackingSignal -from ._devices.xia_pf4 import DualPf4FilterBox +from ._devices import * from .synApps import * From 547e8bd3b1eacde7a002ef967c470e8c2842195b Mon Sep 17 00:00:00 2001 From: Pete R Jemian Date: Tue, 12 Oct 2021 19:25:44 -0500 Subject: [PATCH 3/3] DOC #462 URLs to synApps databases --- apstools/_devices/xia_pf4.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apstools/_devices/xia_pf4.py b/apstools/_devices/xia_pf4.py index 9cf915ea9..912f2ce84 100644 --- a/apstools/_devices/xia_pf4.py +++ b/apstools/_devices/xia_pf4.py @@ -47,6 +47,8 @@ class MyTriplePf4(Pf4FilterCommon): C = Component(Pf4FilterBank, "", bank="C") pf4 = MyTriplePf4("ioc:pf4:", name="pf4") + + :see: https://github.com/epics-modules/optics/blob/master/opticsApp/Db/pf4bank.db """ fPos = FormattedComponent(EpicsSignal, "{prefix}fPos{_bank}", kind="config") @@ -80,6 +82,8 @@ class MyTriplePf4(Pf4FilterCommon): C = Component(Pf4FilterBank, "", bank="C") pf4 = MyTriplePf4("ioc:pf4:", name="pf4") + + :see: https://github.com/epics-modules/optics/blob/master/opticsApp/Db/pf4common.db """ transmission = Component(EpicsSignalRO, "trans", kind="hinted")