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

update the XIA PF4 filter support #558

Merged
merged 3 commits into from
Oct 13, 2021
Merged
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
54 changes: 54 additions & 0 deletions apstools/_devices/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
108 changes: 107 additions & 1 deletion apstools/_devices/xia_pf4.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,124 @@

.. 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")

:see: https://github.com/epics-modules/optics/blob/master/opticsApp/Db/pf4bank.db
"""

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")

:see: https://github.com/epics-modules/optics/blob/master/opticsApp/Db/pf4common.db
"""

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

Expand Down
44 changes: 6 additions & 38 deletions apstools/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 *


Expand Down