1212 PathProvider ,
1313 SignalR ,
1414 SignalRW ,
15+ SignalW ,
1516 StrictEnum ,
1617 observe_value ,
17- set_and_wait_for_value ,
18+ set_and_wait_for_other_value ,
1819)
1920from ophyd_async .fastcs .core import fastcs_connector
2021
@@ -29,17 +30,18 @@ class OdinNode(Device):
2930
3031
3132class OdinHdfIO (Device ):
32- capture : SignalRW [Writing ]
33- num_captured : SignalR [int ]
34- num_to_capture : SignalRW [int ]
35- image_height : SignalRW [int ]
36- image_width : SignalRW [int ]
37- num_row_chunks : SignalRW [int ]
38- num_col_chunks : SignalRW [int ]
39- num_frames_chunks : SignalRW [int ]
40- file_path : SignalRW [str ]
41- file_name : SignalRW [str ]
42- data_type : SignalRW [str ]
33+ writing : SignalR [Writing ]
34+ config_hdf_write : SignalW [Writing ]
35+ frames_written : SignalR [int ]
36+ config_hdf_frames : SignalRW [int ]
37+ dataset_data_dims_0 : SignalRW [int ]
38+ dataset_data_dims_1 : SignalRW [int ]
39+ dataset_data_chunks_0 : SignalRW [int ]
40+ dataset_data_chunks_1 : SignalRW [int ]
41+ dataset_data_chunks_2 : SignalRW [int ]
42+ config_hdf_file_path : SignalRW [str ]
43+ config_hdf_file_prefix : SignalRW [str ]
44+ dataset_data_datatype : SignalRW [str ]
4345 nodes = DeviceVector [OdinNode ]
4446
4547 def __init__ (self , uri : str , name : str = "" ):
@@ -62,26 +64,27 @@ async def open(self, multiplier: int = 1) -> dict[str, DataKey]:
6264 info = self ._path_provider (device_name = self ._name_provider ())
6365
6466 await asyncio .gather (
65- self ._drv .file_path .set (str (info .directory_path )),
66- self ._drv .file_name .set (info .filename ),
67- self ._drv .data_type .set (
67+ self ._drv .config_hdf_file_path .set (str (info .directory_path )),
68+ self ._drv .config_hdf_file_prefix .set (info .filename ),
69+ self ._drv .dataset_data_datatype .set (
6870 "uint16"
6971 ), # TODO: Get from eiger https://github.com/bluesky/ophyd-async/issues/529
70- self ._drv .num_to_capture .set (0 ),
72+ self ._drv .config_hdf_frames .set (0 ),
7173 )
7274
73- await self ._drv .capture .set (Writing .ON )
75+ await self ._drv .config_hdf_write .set (Writing .ON )
7476
7577 return await self ._describe ()
7678
7779 async def _describe (self ) -> dict [str , DataKey ]:
7880 data_shape = await asyncio .gather (
79- self ._drv .image_height .get_value (), self ._drv .image_width .get_value ()
81+ self ._drv .dataset_data_dims_0 .get_value (),
82+ self ._drv .dataset_data_dims_1 .get_value (),
8083 )
8184
8285 return {
8386 "data" : DataKey (
84- source = self ._drv .file_name .source ,
87+ source = self ._drv .config_hdf_file_prefix .source ,
8588 shape = list (data_shape ),
8689 dtype = "array" ,
8790 # TODO: Use correct type based on eiger https://github.com/bluesky/ophyd-async/issues/529
@@ -93,15 +96,17 @@ async def _describe(self) -> dict[str, DataKey]:
9396 async def observe_indices_written (
9497 self , timeout : float
9598 ) -> AsyncGenerator [int , None ]:
96- async for num_captured in observe_value (self ._drv .num_captured , timeout ):
99+ async for num_captured in observe_value (self ._drv .frames_written , timeout ):
97100 yield num_captured
98101
99102 async def get_indices_written (self ) -> int :
100- return await self ._drv .num_captured .get_value ()
103+ return await self ._drv .frames_written .get_value ()
101104
102105 def collect_stream_docs (self , indices_written : int ) -> AsyncIterator [StreamAsset ]:
103106 # TODO: Correctly return stream https://github.com/bluesky/ophyd-async/issues/530
104107 raise NotImplementedError ()
105108
106109 async def close (self ) -> None :
107- await set_and_wait_for_value (self ._drv .capture , Writing .OFF )
110+ await set_and_wait_for_other_value (
111+ self ._drv .config_hdf_write , Writing .OFF , self ._drv .writing , Writing .OFF
112+ )
0 commit comments