From 6d761e2ab0cf23b99b6e96881694854dffe4442c Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Mon, 16 Feb 2026 11:48:32 +0000 Subject: [PATCH 1/7] removed set_path_provider --- src/dodal/beamlines/p51.py | 43 ++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index 0ea32369ef..9daa087b2e 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -1,16 +1,14 @@ +from functools import cache from pathlib import Path +from ophyd_async.core import PathProvider from ophyd_async.epics.motor import Motor from ophyd_async.epics.pmac import PmacIO from ophyd_async.fastcs.panda import HDFPanda -from dodal.common.beamlines.beamline_utils import ( - device_factory, - get_path_provider, - set_path_provider, -) from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline -from dodal.common.visit import RemoteDirectoryServiceClient, StaticVisitPathProvider +from dodal.common.visit import StaticVisitPathProvider +from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit from dodal.devices.xspress3.xspress3 import Xspress3 from dodal.log import set_beamline as set_log_beamline @@ -21,19 +19,17 @@ set_log_beamline(BL) set_utils_beamline(BL) +devices = DeviceManager() -# Currently we must hard-code the visit, determining the visit at runtime requires -# infrastructure that is still WIP. -# Communication with GDA is also WIP so for now we determine an arbitrary scan number -# locally and write the commissioning directory. The scan number is not guaranteed to -# be unique and the data is at risk - this configuration is for testing only. -set_path_provider( - StaticVisitPathProvider( + +@devices.fixture +@cache +def path_provider() -> PathProvider: + return StaticVisitPathProvider( BL, Path("/dls/p51/data/2026/cm44254-1/tmp"), - client=RemoteDirectoryServiceClient("http://i20-1-control:8088/api"), ) -) + """ NOTE: Due to the CA gateway machine being switched off, PVs are not available remotely @@ -43,19 +39,19 @@ """ -@device_factory() +@devices.factory() def turbo_slit() -> TurboSlit: """Turboslit for selecting energy from the polychromator.""" return TurboSlit(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:") -@device_factory() +@devices.factory() def turbo_slit_x() -> Motor: """Turbo slit x motor.""" return Motor(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:XFINE") -@device_factory() +@devices.factory() def turbo_slit_pmac() -> PmacIO: """PMac controller using running fly scans with trajectory.""" motor = turbo_slit_x() @@ -66,26 +62,27 @@ def turbo_slit_pmac() -> PmacIO: ) -@device_factory() +@devices.factory() def panda() -> HDFPanda: return HDFPanda( - f"{PREFIX.beamline_prefix}-EA-PANDA-02:", path_provider=get_path_provider() + f"{PREFIX.beamline_prefix}-EA-PANDA-02:", + path_provider=path_provider(), ) # Use mock device until motors are reconnected on the beamline -@device_factory(mock=True) +@devices.factory(mock=True) def alignment_x() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:X") # Use mock device until motors are reconnected on the beamline -@device_factory(mock=True) +@devices.factory(mock=True) def alignment_y() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:Y") -@device_factory(skip=True) +@devices.factory(skip=True) def xspress3() -> Xspress3: """16 channels Xspress3 detector.""" return Xspress3( From ae44680758bd836f39c27d34aa33c2fb9d8e29bc Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Mon, 16 Feb 2026 14:12:12 +0000 Subject: [PATCH 2/7] modified Panda path provider --- src/dodal/beamlines/p51.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index 9daa087b2e..de75fe1799 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -7,7 +7,7 @@ from ophyd_async.fastcs.panda import HDFPanda from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline -from dodal.common.visit import StaticVisitPathProvider +from dodal.common.visit import RemoteDirectoryServiceClient, StaticVisitPathProvider from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit from dodal.devices.xspress3.xspress3 import Xspress3 @@ -28,6 +28,7 @@ def path_provider() -> PathProvider: return StaticVisitPathProvider( BL, Path("/dls/p51/data/2026/cm44254-1/tmp"), + client=RemoteDirectoryServiceClient("http://i20-1-control:8088/api"), ) @@ -63,10 +64,10 @@ def turbo_slit_pmac() -> PmacIO: @devices.factory() -def panda() -> HDFPanda: +def panda(path_provider: PathProvider) -> HDFPanda: return HDFPanda( f"{PREFIX.beamline_prefix}-EA-PANDA-02:", - path_provider=path_provider(), + path_provider=path_provider, ) From 92ebd74a4097b8384e5206caa1610e9935045176 Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Mon, 16 Feb 2026 15:55:01 +0000 Subject: [PATCH 3/7] reverted device manager implementation --- src/dodal/beamlines/p51.py | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index de75fe1799..f927ed12f0 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -6,9 +6,9 @@ from ophyd_async.epics.pmac import PmacIO from ophyd_async.fastcs.panda import HDFPanda +from dodal.common.beamlines.beamline_utils import device_factory from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline from dodal.common.visit import RemoteDirectoryServiceClient, StaticVisitPathProvider -from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit from dodal.devices.xspress3.xspress3 import Xspress3 from dodal.log import set_beamline as set_log_beamline @@ -19,10 +19,7 @@ set_log_beamline(BL) set_utils_beamline(BL) -devices = DeviceManager() - -@devices.fixture @cache def path_provider() -> PathProvider: return StaticVisitPathProvider( @@ -40,19 +37,19 @@ def path_provider() -> PathProvider: """ -@devices.factory() +@device_factory() def turbo_slit() -> TurboSlit: """Turboslit for selecting energy from the polychromator.""" return TurboSlit(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:") -@devices.factory() +@device_factory() def turbo_slit_x() -> Motor: """Turbo slit x motor.""" return Motor(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:XFINE") -@devices.factory() +@device_factory() def turbo_slit_pmac() -> PmacIO: """PMac controller using running fly scans with trajectory.""" motor = turbo_slit_x() @@ -63,27 +60,27 @@ def turbo_slit_pmac() -> PmacIO: ) -@devices.factory() -def panda(path_provider: PathProvider) -> HDFPanda: +@device_factory() +def panda() -> HDFPanda: return HDFPanda( f"{PREFIX.beamline_prefix}-EA-PANDA-02:", - path_provider=path_provider, + path_provider=path_provider(), ) # Use mock device until motors are reconnected on the beamline -@devices.factory(mock=True) +@device_factory(mock=True) def alignment_x() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:X") # Use mock device until motors are reconnected on the beamline -@devices.factory(mock=True) +@device_factory(mock=True) def alignment_y() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:Y") -@devices.factory(skip=True) +@device_factory(skip=True) def xspress3() -> Xspress3: """16 channels Xspress3 detector.""" return Xspress3( From c3233b31a00349e933eec3e5045dfe20d920b461 Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Tue, 17 Feb 2026 16:44:36 +0000 Subject: [PATCH 4/7] Revert "reverted device manager implementation" This reverts commit 92ebd74a4097b8384e5206caa1610e9935045176. --- src/dodal/beamlines/p51.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index f927ed12f0..de75fe1799 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -6,9 +6,9 @@ from ophyd_async.epics.pmac import PmacIO from ophyd_async.fastcs.panda import HDFPanda -from dodal.common.beamlines.beamline_utils import device_factory from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline from dodal.common.visit import RemoteDirectoryServiceClient, StaticVisitPathProvider +from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit from dodal.devices.xspress3.xspress3 import Xspress3 from dodal.log import set_beamline as set_log_beamline @@ -19,7 +19,10 @@ set_log_beamline(BL) set_utils_beamline(BL) +devices = DeviceManager() + +@devices.fixture @cache def path_provider() -> PathProvider: return StaticVisitPathProvider( @@ -37,19 +40,19 @@ def path_provider() -> PathProvider: """ -@device_factory() +@devices.factory() def turbo_slit() -> TurboSlit: """Turboslit for selecting energy from the polychromator.""" return TurboSlit(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:") -@device_factory() +@devices.factory() def turbo_slit_x() -> Motor: """Turbo slit x motor.""" return Motor(f"{PREFIX.beamline_prefix}-OP-PCHRO-01:TS:XFINE") -@device_factory() +@devices.factory() def turbo_slit_pmac() -> PmacIO: """PMac controller using running fly scans with trajectory.""" motor = turbo_slit_x() @@ -60,27 +63,27 @@ def turbo_slit_pmac() -> PmacIO: ) -@device_factory() -def panda() -> HDFPanda: +@devices.factory() +def panda(path_provider: PathProvider) -> HDFPanda: return HDFPanda( f"{PREFIX.beamline_prefix}-EA-PANDA-02:", - path_provider=path_provider(), + path_provider=path_provider, ) # Use mock device until motors are reconnected on the beamline -@device_factory(mock=True) +@devices.factory(mock=True) def alignment_x() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:X") # Use mock device until motors are reconnected on the beamline -@device_factory(mock=True) +@devices.factory(mock=True) def alignment_y() -> Motor: return Motor(f"{PREFIX.beamline_prefix}-MO-STAGE-01:Y") -@device_factory(skip=True) +@devices.factory(skip=True) def xspress3() -> Xspress3: """16 channels Xspress3 detector.""" return Xspress3( From 833ac76f2661ce2a9f844c4421ef318992f721f3 Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Tue, 17 Feb 2026 16:45:44 +0000 Subject: [PATCH 5/7] using path provider --- src/dodal/beamlines/p51.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index de75fe1799..076351b090 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -7,7 +7,7 @@ from ophyd_async.fastcs.panda import HDFPanda from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline -from dodal.common.visit import RemoteDirectoryServiceClient, StaticVisitPathProvider +from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit from dodal.devices.xspress3.xspress3 import Xspress3 @@ -27,8 +27,8 @@ def path_provider() -> PathProvider: return StaticVisitPathProvider( BL, - Path("/dls/p51/data/2026/cm44254-1/tmp"), - client=RemoteDirectoryServiceClient("http://i20-1-control:8088/api"), + Path("/dls/p51/data/2026/cm44254-1"), + client=LocalDirectoryServiceClient(), ) From d6d5e8f5f3853f649e4224517e936d1954b4db0f Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Wed, 18 Feb 2026 10:07:44 +0000 Subject: [PATCH 6/7] static path provider trial I --- src/dodal/beamlines/p51.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index 076351b090..63d9baa272 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -7,6 +7,9 @@ from ophyd_async.fastcs.panda import HDFPanda from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline +from dodal.common.beamlines.beamline_utils import ( + set_path_provider, +) from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit @@ -27,11 +30,19 @@ def path_provider() -> PathProvider: return StaticVisitPathProvider( BL, - Path("/dls/p51/data/2026/cm44254-1"), + Path("/dls/p51/data/2026/cm44254-1/tmp"), client=LocalDirectoryServiceClient(), ) +set_path_provider( + StaticVisitPathProvider( + BL, + Path("/dls/p51/data/2026/cm44254-1/tmp"), + client=LocalDirectoryServiceClient(), + ) +) + """ NOTE: Due to the CA gateway machine being switched off, PVs are not available remotely and you need to be on the beamline network to access them. From 213cc89471c0fece033df205278c2aa6f8975256 Mon Sep 17 00:00:00 2001 From: Subu Ghimire <254926418+subughimire420@users.noreply.github.com> Date: Wed, 18 Feb 2026 10:30:22 +0000 Subject: [PATCH 7/7] Revert "static path provider trial I" This reverts commit d6d5e8f5f3853f649e4224517e936d1954b4db0f. --- src/dodal/beamlines/p51.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/dodal/beamlines/p51.py b/src/dodal/beamlines/p51.py index 63d9baa272..076351b090 100644 --- a/src/dodal/beamlines/p51.py +++ b/src/dodal/beamlines/p51.py @@ -7,9 +7,6 @@ from ophyd_async.fastcs.panda import HDFPanda from dodal.common.beamlines.beamline_utils import set_beamline as set_utils_beamline -from dodal.common.beamlines.beamline_utils import ( - set_path_provider, -) from dodal.common.visit import LocalDirectoryServiceClient, StaticVisitPathProvider from dodal.device_manager import DeviceManager from dodal.devices.turbo_slit import TurboSlit @@ -30,19 +27,11 @@ def path_provider() -> PathProvider: return StaticVisitPathProvider( BL, - Path("/dls/p51/data/2026/cm44254-1/tmp"), + Path("/dls/p51/data/2026/cm44254-1"), client=LocalDirectoryServiceClient(), ) -set_path_provider( - StaticVisitPathProvider( - BL, - Path("/dls/p51/data/2026/cm44254-1/tmp"), - client=LocalDirectoryServiceClient(), - ) -) - """ NOTE: Due to the CA gateway machine being switched off, PVs are not available remotely and you need to be on the beamline network to access them.