Skip to content

Commit

Permalink
add Capture mode signal to Panda DataBlock (bluesky#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsouter authored Oct 10, 2024
1 parent 1559aa0 commit 72c61ad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/ophyd_async/fastcs/panda/_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
from ._table import DatasetTable, SeqTable


class CaptureMode(str, Enum):
FIRST_N = "FIRST_N"
LAST_N = "LAST_N"
FOREVER = "FOREVER"


class DataBlock(Device):
# In future we may decide to make hdf_* optional
hdf_directory: SignalRW[str]
Expand All @@ -15,6 +21,7 @@ class DataBlock(Device):
num_captured: SignalR[int]
create_directory: SignalRW[int]
directory_exists: SignalR[bool]
capture_mode: SignalRW[CaptureMode]
capture: SignalRW[bool]
flush_period: SignalRW[float]
datasets: SignalR[DatasetTable]
Expand Down
4 changes: 2 additions & 2 deletions src/ophyd_async/fastcs/panda/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
wait_for_value,
)

from ._block import DataBlock
from ._block import CaptureMode, DataBlock


class PandaHDFWriter(DetectorWriter):
Expand Down Expand Up @@ -58,7 +58,7 @@ async def open(self, multiplier: int = 1) -> dict[str, DataKey]:
self.panda_data_block.hdf_file_name.set(
f"{info.filename}.h5",
),
self.panda_data_block.num_capture.set(0),
self.panda_data_block.capture_mode.set(CaptureMode.FOREVER),
)

# Make sure that directory exists or has been created.
Expand Down
1 change: 1 addition & 0 deletions tests/fastcs/panda/test_panda_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def check_equal_with_seq_tables(actual, expected):
}
assert parsed_yaml[1] == {
"data.capture": False,
"data.capture_mode": "FIRST_N",
"data.create_directory": 0,
"data.flush_period": 0.0,
"data.hdf_directory": "",
Expand Down

0 comments on commit 72c61ad

Please sign in to comment.