Skip to content

Commit

Permalink
DAQ-5039 working-ish version for p38
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondJoseph committed Mar 18, 2024
1 parent d6e050b commit ffe01bd
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 34 deletions.
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ classifiers = [
description = "Ophyd devices and other utils that could be used across DLS beamlines"
dependencies = [
"ophyd",
"ophyd_async@git+https://github.com/bluesky/ophyd-async",
"bluesky",
"ophyd_async @ file://dls_sw/p38/software/blueapi/devices_only/ophyd_async",
"bluesky @ file://dls_sw/p38/software/blueapi/devices_only/bluesky",
"pyepics",
"dataclasses-json",
"pillow",
"zocalo",
"requests",
"graypy",
"pydantic<2.0",
"opencv-python-headless", # For pin-tip detection.
"aioca", # Required for CA support with ophyd-async.
"p4p", # Required for PVA support with ophyd-async.
"opencv-python-headless", # For pin-tip detection.
"aioca", # Required for CA support with ophyd-async.
"p4p", # Required for PVA support with ophyd-async.
"numpy",
]

Expand Down
14 changes: 9 additions & 5 deletions src/dodal/beamlines/beamline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,12 @@ def _wait_for_connection(
device.wait_for_connection(timeout=timeout)
elif isinstance(device, OphydV2Device):
call_in_bluesky_event_loop(
v2_device_wait_for_connection(coros=device.connect(sim=sim)),
timeout=timeout,
v2_device_wait_for_connection(
coros=device.connect(
sim=sim,
timeout=timeout,
)
),
)
else:
raise TypeError(
Expand Down Expand Up @@ -130,7 +134,7 @@ def set_directory_provider(provider: DirectoryProvider):

def get_directory_provider() -> DirectoryProvider:
if DIRECTORY_PROVIDER is None:
set_directory_provider(
StaticDirectoryProvider(tempfile.NamedTemporaryFile().name, "")
)
provider = StaticDirectoryProvider(tempfile.NamedTemporaryFile().name, "")
set_directory_provider(provider)
return provider
return DIRECTORY_PROVIDER
40 changes: 20 additions & 20 deletions src/dodal/beamlines/p38.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# from ophyd_async.panda import PandA
from ophyd_async.panda import PandA

from dodal.beamlines.beamline_utils import device_instantiation, get_directory_provider
from dodal.beamlines.beamline_utils import set_beamline as set_utils_beamline
Expand All @@ -7,7 +7,7 @@
from dodal.devices.areadetector.adaravis import SumHDFAravisDetector

# from dodal.devices.linkam3 import Linkam3
# from dodal.devices.tetramm import TetrammDetector
from dodal.devices.tetramm import TetrammDetector
from dodal.log import set_beamline as set_log_beamline
from dodal.utils import get_beamline_name

Expand Down Expand Up @@ -77,26 +77,26 @@ def d12(


# FIXME: Times out
# def tetramm(
# wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
# ) -> TetrammDetector:
# return device_instantiation(
# TetrammDetector,
# "tetramm",
# "-EA-XBPM-01:",
# wait_for_connection,
# fake_with_ophyd_sim,
# directory_provider=get_directory_provider(),
# )
def tetramm(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> TetrammDetector:
return device_instantiation(
TetrammDetector,
"tetramm",
"-EA-XBPM-01:",
wait_for_connection,
fake_with_ophyd_sim,
directory_provider=get_directory_provider(),
)


# FIXME: Currently disconnected
# def panda1(
# wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
# ) -> PandA:
# return device_instantiation(
# PandA, "panda1", "-EA-PANDA-01:", wait_for_connection, fake_with_ophyd_sim
# )
def panda1(
wait_for_connection: bool = True, fake_with_ophyd_sim: bool = False
) -> PandA:
"Panda-01: Running as a python soft-ioc in Kubernetes. Hooked up to the TetrAMM"
return device_instantiation(
PandA, "panda1", "-EA-PANDA-01:", wait_for_connection, fake_with_ophyd_sim
)


# FIXME: Times out
Expand Down
8 changes: 4 additions & 4 deletions src/dodal/devices/tetramm.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def __init__(
):
self._prefix = prefix
self.range = ad_rw(TetrammRange, prefix + "Range")
self.sample_time = ad_r(float, prefix + "SampleTime")
# self.sample_time = ad_r(float, prefix + "SampleTime")

self.values_per_reading = ad_rw(int, prefix + "ValuesPerRead")
self.averaging_time = ad_rw(float, prefix + "AveragingTime")
self.to_average = ad_r(int, prefix + "NumAverage")
self.averaged = ad_r(int, prefix + "NumAveraged")
# self.to_average = ad_r(int, prefix + "NumAverage")
# self.averaged = ad_r(int, prefix + "NumAveraged")

self.acquire = ad_rw(bool, prefix + "Acquire")

Expand Down Expand Up @@ -273,7 +273,7 @@ def __init__(
[
self.drv.values_per_reading,
self.drv.averaging_time,
self.drv.sample_time,
# self.drv.sample_time,
],
name,
)
Expand Down

0 comments on commit ffe01bd

Please sign in to comment.