ophyd-async 0.3a1__py3-none-any.whl → 0.3a2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. ophyd_async/__init__.py +1 -4
  2. ophyd_async/_version.py +1 -1
  3. ophyd_async/core/__init__.py +12 -2
  4. ophyd_async/core/_providers.py +3 -1
  5. ophyd_async/core/detector.py +65 -38
  6. ophyd_async/core/device.py +8 -0
  7. ophyd_async/core/flyer.py +10 -19
  8. ophyd_async/core/signal.py +36 -17
  9. ophyd_async/core/signal_backend.py +5 -2
  10. ophyd_async/core/sim_signal_backend.py +28 -16
  11. ophyd_async/core/standard_readable.py +4 -2
  12. ophyd_async/core/utils.py +18 -1
  13. ophyd_async/epics/_backend/_aioca.py +13 -11
  14. ophyd_async/epics/_backend/_p4p.py +19 -16
  15. ophyd_async/epics/_backend/common.py +16 -11
  16. ophyd_async/epics/areadetector/__init__.py +4 -0
  17. ophyd_async/epics/areadetector/aravis.py +69 -0
  18. ophyd_async/epics/areadetector/controllers/aravis_controller.py +73 -0
  19. ophyd_async/epics/areadetector/controllers/pilatus_controller.py +36 -24
  20. ophyd_async/epics/areadetector/drivers/aravis_driver.py +154 -0
  21. ophyd_async/epics/areadetector/drivers/pilatus_driver.py +4 -4
  22. ophyd_async/epics/areadetector/pilatus.py +50 -0
  23. ophyd_async/epics/areadetector/writers/_hdffile.py +4 -4
  24. ophyd_async/epics/areadetector/writers/hdf_writer.py +6 -1
  25. ophyd_async/epics/demo/__init__.py +33 -3
  26. ophyd_async/epics/motion/motor.py +20 -14
  27. ophyd_async/epics/pvi/__init__.py +3 -0
  28. ophyd_async/epics/pvi/pvi.py +318 -0
  29. ophyd_async/epics/signal/signal.py +26 -9
  30. ophyd_async/panda/__init__.py +17 -6
  31. ophyd_async/panda/_common_blocks.py +49 -0
  32. ophyd_async/panda/_hdf_panda.py +48 -0
  33. ophyd_async/panda/{panda_controller.py → _panda_controller.py} +3 -7
  34. ophyd_async/panda/_trigger.py +39 -0
  35. ophyd_async/panda/writers/__init__.py +3 -0
  36. ophyd_async/panda/writers/_hdf_writer.py +220 -0
  37. ophyd_async/panda/writers/_panda_hdf_file.py +58 -0
  38. ophyd_async/planstubs/__init__.py +5 -0
  39. ophyd_async/planstubs/prepare_trigger_and_dets.py +57 -0
  40. ophyd_async/protocols.py +73 -0
  41. ophyd_async/sim/__init__.py +11 -0
  42. ophyd_async/sim/demo/__init__.py +3 -0
  43. ophyd_async/sim/demo/sim_motor.py +116 -0
  44. ophyd_async/sim/pattern_generator.py +318 -0
  45. ophyd_async/sim/sim_pattern_detector_control.py +55 -0
  46. ophyd_async/sim/sim_pattern_detector_writer.py +34 -0
  47. ophyd_async/sim/sim_pattern_generator.py +37 -0
  48. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a2.dist-info}/METADATA +19 -75
  49. ophyd_async-0.3a2.dist-info/RECORD +76 -0
  50. ophyd_async/epics/pvi.py +0 -70
  51. ophyd_async/panda/panda.py +0 -241
  52. ophyd_async-0.3a1.dist-info/RECORD +0 -56
  53. /ophyd_async/panda/{table.py → _table.py} +0 -0
  54. /ophyd_async/panda/{utils.py → _utils.py} +0 -0
  55. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a2.dist-info}/LICENSE +0 -0
  56. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a2.dist-info}/WHEEL +0 -0
  57. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a2.dist-info}/entry_points.txt +0 -0
  58. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,49 @@
1
+ from __future__ import annotations
2
+
3
+ from enum import Enum
4
+
5
+ from ophyd_async.core import Device, DeviceVector, SignalR, SignalRW
6
+ from ophyd_async.panda._table import SeqTable
7
+
8
+
9
+ class DataBlock(Device):
10
+ # In future we may decide to make hdf_* optional
11
+ hdf_directory: SignalRW[str]
12
+ hdf_file_name: SignalRW[str]
13
+ num_capture: SignalRW[int]
14
+ num_captured: SignalR[int]
15
+ capture: SignalRW[bool]
16
+ flush_period: SignalRW[float]
17
+
18
+
19
+ class PulseBlock(Device):
20
+ delay: SignalRW[float]
21
+ width: SignalRW[float]
22
+
23
+
24
+ class TimeUnits(str, Enum):
25
+ min = "min"
26
+ s = "s"
27
+ ms = "ms"
28
+ us = "us"
29
+
30
+
31
+ class SeqBlock(Device):
32
+ table: SignalRW[SeqTable]
33
+ active: SignalRW[bool]
34
+ repeats: SignalRW[int]
35
+ prescale: SignalRW[float]
36
+ prescale_units: SignalRW[TimeUnits]
37
+ enable: SignalRW[str]
38
+
39
+
40
+ class PcapBlock(Device):
41
+ active: SignalR[bool]
42
+ arm: SignalRW[bool]
43
+
44
+
45
+ class CommonPandaBlocks(Device):
46
+ pulse: DeviceVector[PulseBlock]
47
+ seq: DeviceVector[SeqBlock]
48
+ pcap: PcapBlock
49
+ data: DataBlock
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Sequence
4
+
5
+ from ophyd_async.core import (
6
+ DEFAULT_TIMEOUT,
7
+ DirectoryProvider,
8
+ SignalR,
9
+ StandardDetector,
10
+ )
11
+ from ophyd_async.epics.pvi import create_children_from_annotations, fill_pvi_entries
12
+
13
+ from ._common_blocks import CommonPandaBlocks
14
+ from ._panda_controller import PandaPcapController
15
+ from .writers._hdf_writer import PandaHDFWriter
16
+
17
+
18
+ class HDFPanda(CommonPandaBlocks, StandardDetector):
19
+ def __init__(
20
+ self,
21
+ prefix: str,
22
+ directory_provider: DirectoryProvider,
23
+ config_sigs: Sequence[SignalR] = (),
24
+ name: str = "",
25
+ ):
26
+ self._prefix = prefix
27
+
28
+ create_children_from_annotations(self)
29
+ controller = PandaPcapController(pcap=self.pcap)
30
+ writer = PandaHDFWriter(
31
+ prefix=prefix,
32
+ directory_provider=directory_provider,
33
+ name_provider=lambda: name,
34
+ panda_device=self,
35
+ )
36
+ super().__init__(
37
+ controller=controller,
38
+ writer=writer,
39
+ config_sigs=config_sigs,
40
+ name=name,
41
+ writer_timeout=DEFAULT_TIMEOUT,
42
+ )
43
+
44
+ async def connect(
45
+ self, sim: bool = False, timeout: float = DEFAULT_TIMEOUT
46
+ ) -> None:
47
+ await fill_pvi_entries(self, self._prefix + "PVI", timeout=timeout, sim=sim)
48
+ await super().connect(sim=sim, timeout=timeout)
@@ -7,15 +7,11 @@ from ophyd_async.core import (
7
7
  DetectorTrigger,
8
8
  wait_for_value,
9
9
  )
10
-
11
- from .panda import PcapBlock
10
+ from ophyd_async.panda import PcapBlock
12
11
 
13
12
 
14
13
  class PandaPcapController(DetectorControl):
15
- def __init__(
16
- self,
17
- pcap: PcapBlock,
18
- ) -> None:
14
+ def __init__(self, pcap: PcapBlock) -> None:
19
15
  self.pcap = pcap
20
16
 
21
17
  def get_deadtime(self, exposure: float) -> float:
@@ -35,7 +31,7 @@ class PandaPcapController(DetectorControl):
35
31
  await wait_for_value(self.pcap.active, True, timeout=1)
36
32
  return AsyncStatus(wait_for_value(self.pcap.active, False, timeout=None))
37
33
 
38
- async def disarm(self):
34
+ async def disarm(self) -> AsyncStatus:
39
35
  await asyncio.gather(self.pcap.arm.set(False))
40
36
  await wait_for_value(self.pcap.active, False, timeout=1)
41
37
  return AsyncStatus(wait_for_value(self.pcap.active, False, timeout=None))
@@ -0,0 +1,39 @@
1
+ import asyncio
2
+ from dataclasses import dataclass
3
+
4
+ from ophyd_async.core import TriggerLogic, wait_for_value
5
+ from ophyd_async.panda import SeqBlock, SeqTable, TimeUnits
6
+
7
+
8
+ @dataclass
9
+ class SeqTableInfo:
10
+ sequence_table: SeqTable
11
+ repeats: int
12
+ prescale_as_us: float = 1 # microseconds
13
+
14
+
15
+ class StaticSeqTableTriggerLogic(TriggerLogic[SeqTableInfo]):
16
+ def __init__(self, seq: SeqBlock) -> None:
17
+ self.seq = seq
18
+
19
+ async def prepare(self, value: SeqTableInfo):
20
+ await asyncio.gather(
21
+ self.seq.prescale_units.set(TimeUnits.us),
22
+ self.seq.enable.set("ZERO"),
23
+ )
24
+ await asyncio.gather(
25
+ self.seq.prescale.set(value.prescale_as_us),
26
+ self.seq.repeats.set(value.repeats),
27
+ self.seq.table.set(value.sequence_table),
28
+ )
29
+
30
+ async def kickoff(self) -> None:
31
+ await self.seq.enable.set("ONE")
32
+ await wait_for_value(self.seq.active, True, timeout=1)
33
+
34
+ async def complete(self) -> None:
35
+ await wait_for_value(self.seq.active, False, timeout=None)
36
+
37
+ async def stop(self):
38
+ await self.seq.enable.set("ZERO")
39
+ await wait_for_value(self.seq.active, False, timeout=1)
@@ -0,0 +1,3 @@
1
+ from ._hdf_writer import PandaHDFWriter
2
+
3
+ __all__ = ["PandaHDFWriter"]
@@ -0,0 +1,220 @@
1
+ import asyncio
2
+ from dataclasses import dataclass
3
+ from enum import Enum
4
+ from pathlib import Path
5
+ from typing import Any, AsyncGenerator, AsyncIterator, Dict, List, Optional
6
+
7
+ from bluesky.protocols import Descriptor, StreamAsset
8
+ from p4p.client.thread import Context
9
+
10
+ from ophyd_async.core import (
11
+ DEFAULT_TIMEOUT,
12
+ DetectorWriter,
13
+ Device,
14
+ DirectoryProvider,
15
+ NameProvider,
16
+ SignalR,
17
+ wait_for_value,
18
+ )
19
+ from ophyd_async.core.signal import observe_value
20
+ from ophyd_async.panda import CommonPandaBlocks
21
+
22
+ from ._panda_hdf_file import _HDFDataset, _HDFFile
23
+
24
+
25
+ class Capture(str, Enum):
26
+ # Capture signals for the HDF Panda
27
+ No = "No"
28
+ Value = "Value"
29
+ Diff = "Diff"
30
+ Sum = "Sum"
31
+ Mean = "Mean"
32
+ Min = "Min"
33
+ Max = "Max"
34
+ MinMax = "Min Max"
35
+ MinMaxMean = "Min Max Mean"
36
+
37
+
38
+ def get_capture_signals(
39
+ block: Device, path_prefix: Optional[str] = ""
40
+ ) -> Dict[str, SignalR]:
41
+ """Get dict mapping a capture signal's name to the signal itself"""
42
+ if not path_prefix:
43
+ path_prefix = ""
44
+ signals: Dict[str, SignalR[Any]] = {}
45
+ for attr_name, attr in block.children():
46
+ # Capture signals end in _capture, but num_capture is a red herring
47
+ if attr_name == "num_capture":
48
+ continue
49
+ dot_path = f"{path_prefix}{attr_name}"
50
+ if isinstance(attr, SignalR) and attr_name.endswith("_capture"):
51
+ signals[dot_path] = attr
52
+ attr_signals = get_capture_signals(attr, path_prefix=dot_path + ".")
53
+ signals.update(attr_signals)
54
+ return signals
55
+
56
+
57
+ @dataclass
58
+ class CaptureSignalWrapper:
59
+ signal: SignalR
60
+ capture_type: Capture
61
+
62
+
63
+ # This should return a dictionary which contains a dict, containing the Capture
64
+ # signal object, and the value of that signal
65
+ async def get_signals_marked_for_capture(
66
+ capture_signals: Dict[str, SignalR],
67
+ ) -> Dict[str, CaptureSignalWrapper]:
68
+ # Read signals to see if they should be captured
69
+ do_read = [signal.get_value() for signal in capture_signals.values()]
70
+
71
+ signal_values = await asyncio.gather(*do_read)
72
+
73
+ assert len(signal_values) == len(
74
+ capture_signals
75
+ ), "Length of read signals are different to length of signals"
76
+
77
+ signals_to_capture: Dict[str, CaptureSignalWrapper] = {}
78
+ for signal_path, signal_object, signal_value in zip(
79
+ capture_signals.keys(), capture_signals.values(), signal_values
80
+ ):
81
+ signal_path = signal_path.replace("_capture", "")
82
+ if (signal_value.value in iter(Capture)) and (signal_value.value != Capture.No):
83
+ signals_to_capture[signal_path] = CaptureSignalWrapper(
84
+ signal_object,
85
+ signal_value.value,
86
+ )
87
+
88
+ return signals_to_capture
89
+
90
+
91
+ class PandaHDFWriter(DetectorWriter):
92
+ _ctxt: Optional[Context] = None
93
+
94
+ def __init__(
95
+ self,
96
+ prefix: str,
97
+ directory_provider: DirectoryProvider,
98
+ name_provider: NameProvider,
99
+ panda_device: CommonPandaBlocks,
100
+ ) -> None:
101
+ self.panda_device = panda_device
102
+ self._prefix = prefix
103
+ self._directory_provider = directory_provider
104
+ self._name_provider = name_provider
105
+ self._datasets: List[_HDFDataset] = []
106
+ self._file: Optional[_HDFFile] = None
107
+ self._multiplier = 1
108
+
109
+ # Triggered on PCAP arm
110
+ async def open(self, multiplier: int = 1) -> Dict[str, Descriptor]:
111
+ """Retrieve and get descriptor of all PandA signals marked for capture"""
112
+
113
+ # Get capture PVs by looking at panda. Gives mapping of dotted attribute path
114
+ # to Signal object
115
+ self.capture_signals = get_capture_signals(self.panda_device)
116
+
117
+ # Ensure flushes are immediate
118
+ await self.panda_device.data.flush_period.set(0)
119
+
120
+ to_capture = await get_signals_marked_for_capture(self.capture_signals)
121
+ self._file = None
122
+ info = self._directory_provider()
123
+ # Set the initial values
124
+ await asyncio.gather(
125
+ self.panda_device.data.hdf_directory.set(
126
+ str(info.root / info.resource_dir)
127
+ ),
128
+ self.panda_device.data.hdf_file_name.set(
129
+ f"{info.prefix}{self.panda_device.name}{info.suffix}",
130
+ ),
131
+ self.panda_device.data.num_capture.set(0),
132
+ )
133
+
134
+ # Wait for it to start, stashing the status that tells us when it finishes
135
+ await self.panda_device.data.capture.set(True)
136
+ name = self._name_provider()
137
+ if multiplier > 1:
138
+ raise ValueError(
139
+ "All PandA datasets should be scalar, multiplier should be 1"
140
+ )
141
+ self._datasets = []
142
+ for attribute_path, capture_signal in to_capture.items():
143
+ split_path = attribute_path.split(".")
144
+ signal_name = split_path[-1]
145
+ # Get block names from numbered blocks, eg INENC[1]
146
+ block_name = (
147
+ f"{split_path[-3]}{split_path[-2]}"
148
+ if split_path[-2].isnumeric()
149
+ else split_path[-2]
150
+ )
151
+
152
+ for suffix in str(capture_signal.capture_type).split(" "):
153
+ self._datasets.append(
154
+ _HDFDataset(
155
+ name,
156
+ block_name,
157
+ f"{name}-{block_name}-{signal_name}-{suffix}",
158
+ f"{block_name}-{signal_name}".upper() + f"-{suffix}",
159
+ [1],
160
+ multiplier=1,
161
+ )
162
+ )
163
+
164
+ describe = {
165
+ ds.name: Descriptor(
166
+ source=self.panda_device.data.hdf_directory.source,
167
+ shape=ds.shape,
168
+ dtype="array" if ds.shape != [1] else "number",
169
+ external="STREAM:",
170
+ )
171
+ for ds in self._datasets
172
+ }
173
+ return describe
174
+
175
+ # Next few functions are exactly the same as AD writer. Could move as default
176
+ # StandardDetector behavior
177
+ async def wait_for_index(
178
+ self, index: int, timeout: Optional[float] = DEFAULT_TIMEOUT
179
+ ):
180
+ def matcher(value: int) -> bool:
181
+ return value >= index
182
+
183
+ matcher.__name__ = f"index_at_least_{index}"
184
+ await wait_for_value(
185
+ self.panda_device.data.num_captured, matcher, timeout=timeout
186
+ )
187
+
188
+ async def get_indices_written(self) -> int:
189
+ return await self.panda_device.data.num_captured.get_value()
190
+
191
+ async def observe_indices_written(
192
+ self, timeout=DEFAULT_TIMEOUT
193
+ ) -> AsyncGenerator[int, None]:
194
+ """Wait until a specific index is ready to be collected"""
195
+ async for num_captured in observe_value(
196
+ self.panda_device.data.num_captured, timeout
197
+ ):
198
+ yield num_captured // self._multiplier
199
+
200
+ async def collect_stream_docs(
201
+ self, indices_written: int
202
+ ) -> AsyncIterator[StreamAsset]:
203
+ # TODO: fail if we get dropped frames
204
+ if indices_written:
205
+ if not self._file:
206
+ self._file = _HDFFile(
207
+ self._directory_provider(),
208
+ Path(await self.panda_device.data.hdf_file_name.get_value()),
209
+ self._datasets,
210
+ )
211
+ for doc in self._file.stream_resources():
212
+ yield "stream_resource", doc
213
+ for doc in self._file.stream_data(indices_written):
214
+ yield "stream_datum", doc
215
+
216
+ # Could put this function as default for StandardDetector
217
+ async def close(self):
218
+ await self.panda_device.data.capture.set(
219
+ False, wait=True, timeout=DEFAULT_TIMEOUT
220
+ )
@@ -0,0 +1,58 @@
1
+ from dataclasses import dataclass
2
+ from pathlib import Path
3
+ from typing import Iterator, List
4
+
5
+ from event_model import StreamDatum, StreamResource, compose_stream_resource
6
+
7
+ from ophyd_async.core import DirectoryInfo
8
+
9
+
10
+ @dataclass
11
+ class _HDFDataset:
12
+ device_name: str
13
+ block: str
14
+ name: str
15
+ path: str
16
+ shape: List[int]
17
+ multiplier: int
18
+
19
+
20
+ class _HDFFile:
21
+ def __init__(
22
+ self,
23
+ directory_info: DirectoryInfo,
24
+ full_file_name: Path,
25
+ datasets: List[_HDFDataset],
26
+ ) -> None:
27
+ self._last_emitted = 0
28
+ self._bundles = [
29
+ compose_stream_resource(
30
+ spec="AD_HDF5_SWMR_SLICE",
31
+ root=str(directory_info.root),
32
+ data_key=ds.name,
33
+ resource_path=(f"{str(directory_info.root)}/{full_file_name}"),
34
+ resource_kwargs={
35
+ "name": ds.name,
36
+ "block": ds.block,
37
+ "path": ds.path,
38
+ "multiplier": ds.multiplier,
39
+ "timestamps": "/entry/instrument/NDAttributes/NDArrayTimeStamp",
40
+ },
41
+ )
42
+ for ds in datasets
43
+ ]
44
+
45
+ def stream_resources(self) -> Iterator[StreamResource]:
46
+ for bundle in self._bundles:
47
+ yield bundle.stream_resource_doc
48
+
49
+ def stream_data(self, indices_written: int) -> Iterator[StreamDatum]:
50
+ # Indices are relative to resource
51
+ if indices_written > self._last_emitted:
52
+ indices = {
53
+ "start": self._last_emitted,
54
+ "stop": indices_written,
55
+ }
56
+ self._last_emitted = indices_written
57
+ for bundle in self._bundles:
58
+ yield bundle.compose_stream_datum(indices)
@@ -0,0 +1,5 @@
1
+ from .prepare_trigger_and_dets import (
2
+ prepare_static_seq_table_flyer_and_detectors_with_same_trigger,
3
+ )
4
+
5
+ __all__ = ["prepare_static_seq_table_flyer_and_detectors_with_same_trigger"]
@@ -0,0 +1,57 @@
1
+ from typing import List
2
+
3
+ import bluesky.plan_stubs as bps
4
+
5
+ from ophyd_async.core.detector import DetectorTrigger, StandardDetector, TriggerInfo
6
+ from ophyd_async.core.flyer import HardwareTriggeredFlyable
7
+ from ophyd_async.core.utils import in_micros
8
+ from ophyd_async.panda._table import SeqTable, SeqTableRow, seq_table_from_rows
9
+ from ophyd_async.panda._trigger import SeqTableInfo
10
+
11
+
12
+ def prepare_static_seq_table_flyer_and_detectors_with_same_trigger(
13
+ flyer: HardwareTriggeredFlyable[SeqTableInfo],
14
+ detectors: List[StandardDetector],
15
+ num: int,
16
+ width: float,
17
+ deadtime: float,
18
+ shutter_time: float,
19
+ repeats: int = 1,
20
+ period: float = 0.0,
21
+ ):
22
+ trigger_info = TriggerInfo(
23
+ num=num * repeats,
24
+ trigger=DetectorTrigger.constant_gate,
25
+ deadtime=deadtime,
26
+ livetime=width,
27
+ )
28
+
29
+ trigger_time = num * (width + deadtime)
30
+ pre_delay = max(period - 2 * shutter_time - trigger_time, 0)
31
+
32
+ table: SeqTable = seq_table_from_rows(
33
+ # Wait for pre-delay then open shutter
34
+ SeqTableRow(
35
+ time1=in_micros(pre_delay),
36
+ time2=in_micros(shutter_time),
37
+ outa2=True,
38
+ ),
39
+ # Keeping shutter open, do N triggers
40
+ SeqTableRow(
41
+ repeats=num,
42
+ time1=in_micros(width),
43
+ outa1=True,
44
+ outb1=True,
45
+ time2=in_micros(deadtime),
46
+ outa2=True,
47
+ ),
48
+ # Add the shutter close
49
+ SeqTableRow(time2=in_micros(shutter_time)),
50
+ )
51
+
52
+ table_info = SeqTableInfo(table, repeats)
53
+
54
+ for det in detectors:
55
+ yield from bps.prepare(det, trigger_info, wait=False, group="prep")
56
+ yield from bps.prepare(flyer, table_info, wait=False, group="prep")
57
+ yield from bps.wait(group="prep")
@@ -0,0 +1,73 @@
1
+ from abc import abstractmethod
2
+ from typing import Dict, Protocol, runtime_checkable
3
+
4
+ from bluesky.protocols import Descriptor, HasName, Reading
5
+
6
+
7
+ @runtime_checkable
8
+ class AsyncReadable(HasName, Protocol):
9
+ @abstractmethod
10
+ async def read(self) -> Dict[str, Reading]:
11
+ """Return an OrderedDict mapping string field name(s) to dictionaries
12
+ of values and timestamps and optional per-point metadata.
13
+
14
+ Example return value:
15
+
16
+ .. code-block:: python
17
+
18
+ OrderedDict(('channel1',
19
+ {'value': 5, 'timestamp': 1472493713.271991}),
20
+ ('channel2',
21
+ {'value': 16, 'timestamp': 1472493713.539238}))
22
+ """
23
+ ...
24
+
25
+ @abstractmethod
26
+ async def describe(self) -> Dict[str, Descriptor]:
27
+ """Return an OrderedDict with exactly the same keys as the ``read``
28
+ method, here mapped to per-scan metadata about each field.
29
+
30
+ Example return value:
31
+
32
+ .. code-block:: python
33
+
34
+ OrderedDict(('channel1',
35
+ {'source': 'XF23-ID:SOME_PV_NAME',
36
+ 'dtype': 'number',
37
+ 'shape': []}),
38
+ ('channel2',
39
+ {'source': 'XF23-ID:SOME_PV_NAME',
40
+ 'dtype': 'number',
41
+ 'shape': []}))
42
+ """
43
+ ...
44
+
45
+
46
+ @runtime_checkable
47
+ class AsyncConfigurable(Protocol):
48
+ @abstractmethod
49
+ async def read_configuration(self) -> Dict[str, Reading]:
50
+ """Same API as ``read`` but for slow-changing fields related to configuration.
51
+ e.g., exposure time. These will typically be read only once per run.
52
+ """
53
+ ...
54
+
55
+ @abstractmethod
56
+ async def describe_configuration(self) -> Dict[str, Descriptor]:
57
+ """Same API as ``describe``, but corresponding to the keys in
58
+ ``read_configuration``.
59
+ """
60
+ ...
61
+
62
+
63
+ @runtime_checkable
64
+ class AsyncPausable(Protocol):
65
+ @abstractmethod
66
+ async def pause(self) -> None:
67
+ """Perform device-specific work when the RunEngine pauses."""
68
+ ...
69
+
70
+ @abstractmethod
71
+ async def resume(self) -> None:
72
+ """Perform device-specific work when the RunEngine resumes after a pause."""
73
+ ...
@@ -0,0 +1,11 @@
1
+ from .pattern_generator import PatternGenerator
2
+ from .sim_pattern_detector_control import SimPatternDetectorControl
3
+ from .sim_pattern_detector_writer import SimPatternDetectorWriter
4
+ from .sim_pattern_generator import SimPatternDetector
5
+
6
+ __all__ = [
7
+ "PatternGenerator",
8
+ "SimPatternDetectorControl",
9
+ "SimPatternDetectorWriter",
10
+ "SimPatternDetector",
11
+ ]
@@ -0,0 +1,3 @@
1
+ from .sim_motor import SimMotor
2
+
3
+ __all__ = ["SimMotor"]