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

XRF viewer display to work with new ophyd-async Xspress device #333

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
18 changes: 4 additions & 14 deletions src/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import haven
from haven.catalog import Catalog
from haven.devices import Xspress3Detector
from haven.devices.aps import ApsMachine
from haven.devices.area_detector import AravisDetector
from haven.devices.beamline_manager import BeamlineManager, IOCManager
Expand All @@ -27,8 +28,6 @@
from haven.devices.shutter import PssShutter
from haven.devices.slits import ApertureSlits, BladeSlits
from haven.devices.xia_pfcu import PFCUFilter, PFCUFilterBank, PFCUShutter
from haven.devices.xspress import Xspress3Detector
from haven.devices.xspress import add_mcas as add_xspress_mcas

top_dir = Path(__file__).parent.resolve()
haven_dir = top_dir / "haven"
Expand Down Expand Up @@ -159,19 +158,10 @@ def dxp(sim_registry):
yield vortex


class Xspress3Vortex(Xspress3Detector):
mcas = DCpt(
add_xspress_mcas(range_=[0, 1, 2, 3]),
kind=Kind.normal | Kind.hinted,
default_read_attrs=[f"mca{i}" for i in [0, 1, 2, 3]],
default_configuration_attrs=[f"mca{i}" for i in [0, 1, 2, 3]],
)


@pytest.fixture()
def xspress(sim_registry):
FakeXspress = make_fake_device(Xspress3Vortex)
vortex = FakeXspress(name="vortex_me4", labels={"xrf_detectors"})
async def xspress(sim_registry):
vortex = Xspress3Detector(name="vortex_me4", prefix="255id_vortex:", elements=4)
await vortex.connect(mock=True)
sim_registry.register(vortex)
yield vortex

Expand Down
5 changes: 3 additions & 2 deletions src/firefly/pydm_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def add_listener(self, channel):
super().add_listener(channel)
# If the channel is used for writing to PVs, hook it up to the 'put' methods.
if channel.value_signal is not None:
for type_ in [str, int, float, np.ndarray]:
for type_ in [str, int, float, bool, np.ndarray]:
try:
channel.value_signal[type_].connect(self.put_value)
except KeyError:
Expand Down Expand Up @@ -140,6 +140,7 @@ def close(self):
@asyncSlot(int)
@asyncSlot(float)
@asyncSlot(str)
@asyncSlot(bool)
@asyncSlot(np.ndarray)
async def put_value(self, new_value):
if self.is_triggerable:
Expand Down Expand Up @@ -172,5 +173,5 @@ def connection_class(channel, address, protocol):
elif is_vanilla_ophyd:
return HavenConnection(channel, address, protocol)
else:
msg = f"Signal must be ophyd or ophyd_async signal. Got {type(sig)}."
msg = f"Signal for {address=} must be ophyd or ophyd_async signal. Got {type(sig)=}."
raise UnknownOphydSignal(msg)
Loading