Skip to content

Commit

Permalink
AD HDF plugin should set directory creation value before path (#497)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwlodek authored Jul 31, 2024
1 parent 43ada09 commit 8273a2e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/ophyd_async/epics/adcore/_hdf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@ def __init__(
async def open(self, multiplier: int = 1) -> Dict[str, DataKey]:
self._file = None
info = self._path_provider(device_name=self.hdf.name)
file_path = info.directory_path

# Set the directory creation depth first, since dir creation callback happens
# when directory path PV is processed.
await self.hdf.create_directory.set(info.create_dir_depth)

await asyncio.gather(
self.hdf.num_extra_dims.set(0),
self.hdf.lazy_open.set(True),
self.hdf.swmr_mode.set(True),
# See https://github.com/bluesky/ophyd-async/issues/122
self.hdf.file_path.set(file_path),
self.hdf.file_path.set(info.directory_path),
self.hdf.file_name.set(info.filename),
self.hdf.file_template.set("%s/%s.h5"),
self.hdf.create_directory.set(info.create_dir_depth),
self.hdf.file_write_mode.set(FileWriteMode.stream),
# Never use custom xml layout file but use the one defined
# in the source code file NDFileHDF5LayoutXML.cpp
Expand All @@ -69,7 +72,7 @@ async def open(self, multiplier: int = 1) -> Dict[str, DataKey]:

assert (
await self.hdf.file_path_exists.get_value()
), f"File path {file_path} for hdf plugin does not exist"
), f"File path {info.directory_path} for hdf plugin does not exist"

# Overwrite num_capture to go forever
await self.hdf.num_capture.set(0)
Expand Down

0 comments on commit 8273a2e

Please sign in to comment.