Skip to content

Commit

Permalink
Resolving issues preventing connection with areaDetector device (blue…
Browse files Browse the repository at this point in the history
…sky#514)

* Resolving incorrectly named PV issue

* Remove DOUBLE enum option for ADBaseDataTypes

* Make sure dir_path signal is set as string

* Adjust tests to reflect update
  • Loading branch information
jwlodek authored Aug 9, 2024
1 parent 5ac94e2 commit d1c4e3c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ophyd_async/epics/adcore/_core_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, prefix: str, name: str = "") -> None:
self.acquire = epics_signal_rw_rbv(bool, prefix + "Acquire")
self.array_size_x = epics_signal_r(int, prefix + "ArraySizeX_RBV")
self.array_size_y = epics_signal_r(int, prefix + "ArraySizeY_RBV")
self.nd_data_type = epics_signal_r(ADBaseDataType, prefix + "NDDataType_RBV")
self.data_type = epics_signal_r(ADBaseDataType, prefix + "DataType_RBV")
self.array_counter = epics_signal_rw_rbv(int, prefix + "ArrayCounter")
# There is no _RBV for this one
self.wait_for_plugins = epics_signal_rw(bool, prefix + "WaitForPlugins")
Expand Down
2 changes: 1 addition & 1 deletion src/ophyd_async/epics/adcore/_core_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def __call__(self) -> tuple:
shape = await asyncio.gather(
self._driver.array_size_y.get_value(),
self._driver.array_size_x.get_value(),
self._driver.nd_data_type.get_value(),
self._driver.data_type.get_value(),
)
return shape

Expand Down
2 changes: 1 addition & 1 deletion src/ophyd_async/epics/adcore/_hdf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ async def open(self, multiplier: int = 1) -> Dict[str, DataKey]:
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(info.directory_path),
self.hdf.file_path.set(str(info.directory_path)),
self.hdf.file_name.set(info.filename),
self.hdf.file_template.set("%s/%s.h5"),
self.hdf.file_write_mode.set(FileWriteMode.stream),
Expand Down
1 change: 0 additions & 1 deletion src/ophyd_async/epics/adcore/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ADBaseDataType(str, Enum):
UInt64 = "UInt64"
Float32 = "Float32"
Float64 = "Float64"
Double = "DOUBLE"


def convert_ad_dtype_to_np(ad_dtype: ADBaseDataType) -> str:
Expand Down
11 changes: 5 additions & 6 deletions tests/epics/adsimdetector/test_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,11 @@ async def test_two_detectors_step(
info_a = writer_a._path_provider(device_name=writer_a.hdf.name)
info_b = writer_b._path_provider(device_name=writer_b.hdf.name)

assert await writer_a.hdf.file_path.get_value() == info_a.directory_path
assert await writer_a.hdf.file_path.get_value() == str(info_a.directory_path)
file_name_a = await writer_a.hdf.file_name.get_value()
assert file_name_a == info_a.filename

assert await writer_b.hdf.file_path.get_value() == info_b.directory_path
assert await writer_b.hdf.file_path.get_value() == str(info_b.directory_path)
file_name_b = await writer_b.hdf.file_name.get_value()
assert file_name_b == info_b.filename

Expand Down Expand Up @@ -258,10 +258,9 @@ async def test_detector_writes_to_file(

RE(count_sim([single_detector], times=3))

assert (
await cast(adcore.ADHDFWriter, single_detector.writer).hdf.file_path.get_value()
== tmp_path
)
assert await cast(
adcore.ADHDFWriter, single_detector.writer
).hdf.file_path.get_value() == str(tmp_path)

descriptor_index = names.index("descriptor")

Expand Down

0 comments on commit d1c4e3c

Please sign in to comment.