-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
made a new class for the PandA hdf writer and adjusted
PandAController
Also made it possible to pre-intialise blocks so that the controller can have the same pcap device as the post init panda.
- Loading branch information
1 parent
955168b
commit b22337f
Showing
16 changed files
with
363 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .pvi import PVIEntry, fill_pvi_entries | ||
from .pvi import PVIEntry, fill_pvi_entries, pre_initialize_blocks | ||
|
||
__all__ = ["PVIEntry", "fill_pvi_entries"] | ||
__all__ = ["PVIEntry", "fill_pvi_entries", "pre_initialize_blocks"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from __future__ import annotations | ||
|
||
from enum import Enum | ||
|
||
from ophyd_async.core import Device, DeviceVector, SignalR, SignalRW | ||
from ophyd_async.panda.table import SeqTable | ||
|
||
|
||
class DataBlock(Device): | ||
hdf_directory: SignalRW[str] | ||
hdf_file_name: SignalRW[str] | ||
num_capture: SignalRW[int] | ||
num_captured: SignalR[int] | ||
capture: SignalRW[bool] | ||
flush_period: SignalRW[float] | ||
|
||
|
||
class PulseBlock(Device): | ||
delay: SignalRW[float] | ||
width: SignalRW[float] | ||
|
||
|
||
class TimeUnits(str, Enum): | ||
min = "min" | ||
s = "s" | ||
ms = "ms" | ||
us = "us" | ||
|
||
|
||
class SeqBlock(Device): | ||
table: SignalRW[SeqTable] | ||
active: SignalRW[bool] | ||
repeats: SignalRW[int] | ||
prescale: SignalRW[float] | ||
prescale_units: SignalRW[TimeUnits] | ||
enable: SignalRW[str] | ||
|
||
|
||
class PcapBlock(Device): | ||
active: SignalR[bool] | ||
arm: SignalRW[bool] | ||
|
||
|
||
class CommonPandaBlocks(Device): | ||
pulse: DeviceVector[PulseBlock] | ||
seq: DeviceVector[SeqBlock] | ||
pcap: PcapBlock | ||
|
||
# In future we may decide not to have a datablock | ||
data: DataBlock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Sequence | ||
|
||
from ophyd_async.core import ( | ||
DEFAULT_TIMEOUT, | ||
DirectoryProvider, | ||
SignalR, | ||
StandardDetector, | ||
) | ||
from ophyd_async.epics.pvi import fill_pvi_entries, pre_initialize_blocks | ||
|
||
from .common_panda import CommonPandaBlocks | ||
from .panda_controller import PandaPcapController | ||
from .writers.hdf_writer import PandaHDFWriter | ||
|
||
|
||
class HDFPanda(CommonPandaBlocks, StandardDetector): | ||
def __init__( | ||
self, | ||
prefix: str, | ||
directory_provider: DirectoryProvider, | ||
config_sigs: Sequence[SignalR] = (), | ||
name: str = "", | ||
): | ||
self._prefix = prefix | ||
self.set_name(name) | ||
|
||
pre_initialize_blocks(self, included_optional_fields=("data",)) | ||
controller = PandaPcapController(pcap=self.pcap) | ||
writer = PandaHDFWriter( | ||
prefix=prefix, | ||
directory_provider=directory_provider, | ||
name_provider=lambda: name, | ||
panda_device=self, | ||
) | ||
super().__init__( | ||
controller=controller, | ||
writer=writer, | ||
config_sigs=config_sigs, | ||
name=name, | ||
writer_timeout=DEFAULT_TIMEOUT, | ||
) | ||
|
||
async def connect( | ||
self, sim: bool = False, timeout: float = DEFAULT_TIMEOUT | ||
) -> None: | ||
await fill_pvi_entries(self, self._prefix + "PVI", timeout=timeout, sim=sim) | ||
await super().connect(sim=sim, timeout=timeout) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.