ophyd-async 0.3a1__py3-none-any.whl → 0.3a3__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 (69) hide show
  1. ophyd_async/__init__.py +1 -4
  2. ophyd_async/_version.py +1 -1
  3. ophyd_async/core/__init__.py +23 -3
  4. ophyd_async/core/_providers.py +3 -1
  5. ophyd_async/core/detector.py +72 -46
  6. ophyd_async/core/device.py +8 -0
  7. ophyd_async/core/flyer.py +12 -21
  8. ophyd_async/core/signal.py +134 -20
  9. ophyd_async/core/signal_backend.py +6 -3
  10. ophyd_async/core/sim_signal_backend.py +32 -20
  11. ophyd_async/core/standard_readable.py +212 -23
  12. ophyd_async/core/utils.py +18 -1
  13. ophyd_async/epics/_backend/_aioca.py +17 -15
  14. ophyd_async/epics/_backend/_p4p.py +34 -25
  15. ophyd_async/epics/_backend/common.py +16 -11
  16. ophyd_async/epics/areadetector/__init__.py +8 -0
  17. ophyd_async/epics/areadetector/aravis.py +67 -0
  18. ophyd_async/epics/areadetector/controllers/__init__.py +2 -1
  19. ophyd_async/epics/areadetector/controllers/aravis_controller.py +73 -0
  20. ophyd_async/epics/areadetector/controllers/kinetix_controller.py +49 -0
  21. ophyd_async/epics/areadetector/controllers/pilatus_controller.py +36 -24
  22. ophyd_async/epics/areadetector/controllers/vimba_controller.py +66 -0
  23. ophyd_async/epics/areadetector/drivers/__init__.py +6 -0
  24. ophyd_async/epics/areadetector/drivers/aravis_driver.py +154 -0
  25. ophyd_async/epics/areadetector/drivers/kinetix_driver.py +24 -0
  26. ophyd_async/epics/areadetector/drivers/pilatus_driver.py +4 -4
  27. ophyd_async/epics/areadetector/drivers/vimba_driver.py +58 -0
  28. ophyd_async/epics/areadetector/kinetix.py +46 -0
  29. ophyd_async/epics/areadetector/pilatus.py +45 -0
  30. ophyd_async/epics/areadetector/single_trigger_det.py +14 -6
  31. ophyd_async/epics/areadetector/vimba.py +43 -0
  32. ophyd_async/epics/areadetector/writers/_hdffile.py +4 -4
  33. ophyd_async/epics/areadetector/writers/hdf_writer.py +12 -4
  34. ophyd_async/epics/areadetector/writers/nd_file_hdf.py +1 -0
  35. ophyd_async/epics/demo/__init__.py +45 -18
  36. ophyd_async/epics/motion/motor.py +24 -19
  37. ophyd_async/epics/pvi/__init__.py +3 -0
  38. ophyd_async/epics/pvi/pvi.py +318 -0
  39. ophyd_async/epics/signal/signal.py +26 -9
  40. ophyd_async/log.py +130 -0
  41. ophyd_async/panda/__init__.py +17 -6
  42. ophyd_async/panda/_common_blocks.py +49 -0
  43. ophyd_async/panda/_hdf_panda.py +48 -0
  44. ophyd_async/panda/{panda_controller.py → _panda_controller.py} +3 -7
  45. ophyd_async/panda/_trigger.py +39 -0
  46. ophyd_async/panda/writers/__init__.py +3 -0
  47. ophyd_async/panda/writers/_hdf_writer.py +220 -0
  48. ophyd_async/panda/writers/_panda_hdf_file.py +58 -0
  49. ophyd_async/planstubs/__init__.py +5 -0
  50. ophyd_async/planstubs/prepare_trigger_and_dets.py +57 -0
  51. ophyd_async/protocols.py +96 -0
  52. ophyd_async/sim/__init__.py +11 -0
  53. ophyd_async/sim/demo/__init__.py +3 -0
  54. ophyd_async/sim/demo/sim_motor.py +118 -0
  55. ophyd_async/sim/pattern_generator.py +318 -0
  56. ophyd_async/sim/sim_pattern_detector_control.py +55 -0
  57. ophyd_async/sim/sim_pattern_detector_writer.py +34 -0
  58. ophyd_async/sim/sim_pattern_generator.py +37 -0
  59. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a3.dist-info}/METADATA +30 -69
  60. ophyd_async-0.3a3.dist-info/RECORD +83 -0
  61. ophyd_async/epics/pvi.py +0 -70
  62. ophyd_async/panda/panda.py +0 -241
  63. ophyd_async-0.3a1.dist-info/RECORD +0 -56
  64. /ophyd_async/panda/{table.py → _table.py} +0 -0
  65. /ophyd_async/panda/{utils.py → _utils.py} +0 -0
  66. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a3.dist-info}/LICENSE +0 -0
  67. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a3.dist-info}/WHEEL +0 -0
  68. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a3.dist-info}/entry_points.txt +0 -0
  69. {ophyd_async-0.3a1.dist-info → ophyd_async-0.3a3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,83 @@
1
+ ophyd_async/__init__.py,sha256=v-rRiDOgZ3sQSMQKq0vgUQZvpeOkoHFXissAx6Ktg84,61
2
+ ophyd_async/__main__.py,sha256=G-Zcv_G9zK7Nhx6o5L5w-wyhMxdl_WgyMELu8IMFqAE,328
3
+ ophyd_async/_version.py,sha256=hJ-uDF6qfItINzjClbnbKB7a1O2myzhQQHmhtpj1sL0,408
4
+ ophyd_async/log.py,sha256=DbMjt0bkfUOLHIinZYt0Q0FHZmCXXi5x8y0uFiEmqoQ,3587
5
+ ophyd_async/protocols.py,sha256=48jqS78KAMvy6LmenL21ARoTAD8oOL9YdVmIlI0E0VA,2890
6
+ ophyd_async/core/__init__.py,sha256=3GBJlwSkAH_zv4KhKLsxFxGPUuyOoJj2fTSbG6vOd6w,2496
7
+ ophyd_async/core/_providers.py,sha256=LrlTMPHKXWOPVkpAOw-pqBq0kip-c3C9ZZPoFfiaV4M,2212
8
+ ophyd_async/core/async_status.py,sha256=-sfIf7VhwAP25kSVwKZjAIYOTROpfnh2jgkDw5_afSU,2801
9
+ ophyd_async/core/detector.py,sha256=OkdaaJnj2v8DKF4k7VsTo8ReAvIzyFjBqbqdiYf7FBE,11179
10
+ ophyd_async/core/device.py,sha256=Bm8u1wEN6PuJgCgis_msVRvfrO1_RumxAIMPag8k-cI,5813
11
+ ophyd_async/core/device_save_loader.py,sha256=RXA3dPUPihAR2ZGDStlGiA-TAsr_xqL0snsCjMsMnfA,9138
12
+ ophyd_async/core/flyer.py,sha256=LfO3EQTW2zMeNqZh8TLXvE92E30Duds2RXskRYAdJ_4,2299
13
+ ophyd_async/core/signal.py,sha256=S91oRS6E9zNNMV-Mpa7wqTt24IfFI22Vui9MhDQdxys,14523
14
+ ophyd_async/core/signal_backend.py,sha256=qDdWz8X4CWStuYknxcj4G76BLq4TzrAIyZO1NOEq9ao,1519
15
+ ophyd_async/core/sim_signal_backend.py,sha256=jpCIp-93HraG_rbL1C2CYbZqyQMUpT1fnT4WX24Ihno,6057
16
+ ophyd_async/core/standard_readable.py,sha256=uVG3vs3s7-Kzg5dRCtT4I2mhZPqwVGYy2dxNmaOpDVU,8980
17
+ ophyd_async/core/utils.py,sha256=AVF5e42CVG_GaLoHJSI82iC4KAO60fb9fEJMISHBCNM,5043
18
+ ophyd_async/epics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
+ ophyd_async/epics/_backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ ophyd_async/epics/_backend/_aioca.py,sha256=91BynQ2sXgK6WvjzgOmaxH7oHBNBHFVfpX3dOt4jo8o,8775
21
+ ophyd_async/epics/_backend/_p4p.py,sha256=9TEDa1VzDwuOgPKl3jYOXQ9ysd60_Ri2ymepwdgZjNk,12202
22
+ ophyd_async/epics/_backend/common.py,sha256=o0heeQEM7aP-QYCicwOEtNHs5c5OD6raR-5cTs9yRX0,840
23
+ ophyd_async/epics/areadetector/__init__.py,sha256=zz6T9nLSBExYjllJGUVFWGsS7m3C680UHbWIjBl9Fn8,556
24
+ ophyd_async/epics/areadetector/aravis.py,sha256=ujO82hYZ5D5GIaBhz0JNC2G5uVSgowY8xxsY2tunzi4,2277
25
+ ophyd_async/epics/areadetector/kinetix.py,sha256=7rE2MLnz9DEmeiN9pCekDfpXuZ2DErnMajRp_9eoLZY,1359
26
+ ophyd_async/epics/areadetector/pilatus.py,sha256=ki-BOBCEIiUD2wAtmujBIB1eX-nbXB4yMLJK_Q3opRM,1398
27
+ ophyd_async/epics/areadetector/single_trigger_det.py,sha256=U92dqhioIfnve3jtCThq9gXBCdEzzqzY4ezk6rZV19g,1182
28
+ ophyd_async/epics/areadetector/utils.py,sha256=dez54oElIkGMnhSM9qghToUB1opSqjdWTV2vhHCgRMA,3133
29
+ ophyd_async/epics/areadetector/vimba.py,sha256=IxG8KLzfb84iLtzf6ZoX9JikqZLP49lwkWu33bkDV9Y,1291
30
+ ophyd_async/epics/areadetector/controllers/__init__.py,sha256=af58ci7X2z2s_FyUwR3IGQrws8q4TKcBw7vFyIS5FoI,217
31
+ ophyd_async/epics/areadetector/controllers/ad_sim_controller.py,sha256=mthZ6WxajMEgUKptq3bnkIctbLhjzTagV66i1auB8cg,1587
32
+ ophyd_async/epics/areadetector/controllers/aravis_controller.py,sha256=vRiSexnFzijG8eEwowMAFIe730xFNMmgjjbXQVi4zrc,2394
33
+ ophyd_async/epics/areadetector/controllers/kinetix_controller.py,sha256=9QmydX85QOXfQL_UX49M9EQ2b2hUZPVzLxgGQn-A9Oc,1611
34
+ ophyd_async/epics/areadetector/controllers/pilatus_controller.py,sha256=cd1CKkaXlwkpQ0I1VL7nN0U8R4VweTsa08WhvHYI4nY,2243
35
+ ophyd_async/epics/areadetector/controllers/vimba_controller.py,sha256=Eh4Hr9rWgq1mKvE93JzgixntjPHxF3_07GTFqiOdZqE,2123
36
+ ophyd_async/epics/areadetector/drivers/__init__.py,sha256=-Ib0Lz4fFQQmB7K0uFxMDvAerkLxadMQERH7lNAvrs4,495
37
+ ophyd_async/epics/areadetector/drivers/ad_base.py,sha256=ikfyNcZwJa5ah52DckjrBzkMMT_eDY1smM4XWfb6A6E,3689
38
+ ophyd_async/epics/areadetector/drivers/aravis_driver.py,sha256=Z96xXKfGJbLYehyy0wmP3mCW5lVRmdypmX-9U8cYbD8,5607
39
+ ophyd_async/epics/areadetector/drivers/kinetix_driver.py,sha256=OPl42jZcUPs0l3iUr8Cgr3yswWcZ5MJEqhNS9LKv8Jg,640
40
+ ophyd_async/epics/areadetector/drivers/pilatus_driver.py,sha256=fc3vNHqop9oLg-fvaU-diQNEV5U1qzA9vX2T8Hwy_E8,478
41
+ ophyd_async/epics/areadetector/drivers/vimba_driver.py,sha256=jAoQJQV1fOwF-hwi-Y9YLYUuE00bhQ-tc8t7-K5-8VI,1546
42
+ ophyd_async/epics/areadetector/writers/__init__.py,sha256=tpPcrYd1hs8WS7C0gmCnR2EBwjE5RzCljI7WwZ2V_LM,191
43
+ ophyd_async/epics/areadetector/writers/_hdfdataset.py,sha256=E0C9VgsPyY35h7k0mvcIhjsIVNavApLxizqNWlM388w,167
44
+ ophyd_async/epics/areadetector/writers/_hdffile.py,sha256=YtUgOKX53m0TaFEGBW671qXqNuuEKxEyLV5Ein1fjvo,1799
45
+ ophyd_async/epics/areadetector/writers/hdf_writer.py,sha256=e7EbusP3Ell-2npdLtDWcZ_kDIRidUwHeqcbeMx4mlU,5427
46
+ ophyd_async/epics/areadetector/writers/nd_file_hdf.py,sha256=-wfaAJf7pPVHWJ5fEYX8ZR0tIq9-MjZAn_2MjXClL9I,1626
47
+ ophyd_async/epics/areadetector/writers/nd_plugin.py,sha256=l0yBBEazviyFsWJv_4_sfGn_YM_Iyd0_SlMdAmUlXDU,871
48
+ ophyd_async/epics/demo/__init__.py,sha256=D-jYrorqa5C3gLzIi2Hkn8f8uaE9wb5S-WX3YYuHV48,6052
49
+ ophyd_async/epics/demo/demo_ad_sim_detector.py,sha256=06y65yvaqXvL2rDocjYyLz9kTVzuwV-LeuPhEfExdOA,944
50
+ ophyd_async/epics/demo/mover.db,sha256=RFz0rxZue689Wh1sWTZwWeFMUrH04ttPq2u5xJH_Fp4,998
51
+ ophyd_async/epics/demo/sensor.db,sha256=AVtiydrdtwAz2EFurO2Ult9SSRtre3r0akOBbL98LT0,554
52
+ ophyd_async/epics/motion/__init__.py,sha256=tnmVRIwKa9PdN_xonJdAUD04UpEceh-hoD7XI62yDB0,46
53
+ ophyd_async/epics/motion/motor.py,sha256=_670QAtrD4ZJI41inTOPEBEPxWviJH1iflI1-KLHz30,3745
54
+ ophyd_async/epics/pvi/__init__.py,sha256=TbOQNY4enQWgtr1T7x129vpo2p7FIFlr8cyZqqv5Lk4,158
55
+ ophyd_async/epics/pvi/pvi.py,sha256=hpn7GeO0xk_-UDoy42LIsi0adER9IZO3HPP2iu6Nmu4,11320
56
+ ophyd_async/epics/signal/__init__.py,sha256=wb93RTqvSbGKVFQj8OHykbVLGLmwKHU72oi5xYu2UaY,188
57
+ ophyd_async/epics/signal/_epics_transport.py,sha256=DEIL0iYUAWssysVEgWGu1fHSM1l-ATV2kjUgPtDN9LY,858
58
+ ophyd_async/epics/signal/signal.py,sha256=M8ZVG_zLdYJfroCRX-u_w8c3yIhswSRw8e3RkW2szio,3166
59
+ ophyd_async/panda/__init__.py,sha256=ZaD1nRgGKAGFGdpP1WWF-FnX3wcGuYqqq0QRZbaSBYQ,692
60
+ ophyd_async/panda/_common_blocks.py,sha256=n0PPc1rar43oDSIA-yNubTc8fR5YCW1tyjQU58whsg0,1038
61
+ ophyd_async/panda/_hdf_panda.py,sha256=zZxIdNIXHwjlZA-HTezQNfcCh98P2Pst6Pcld92rPLM,1414
62
+ ophyd_async/panda/_panda_controller.py,sha256=dIqcjmaIHVrki8UXSoDx46kk6I2Lhpe2o3sXNg5f-RQ,1238
63
+ ophyd_async/panda/_table.py,sha256=dLoRP4zYNOkD_s0Vkp2wVYAwkjVG8nNdf8-FaXOTfPo,5655
64
+ ophyd_async/panda/_trigger.py,sha256=tBH8uq_4o1ASG9yofVxq3tjf5v8LPzniDTRL4yjramI,1195
65
+ ophyd_async/panda/_utils.py,sha256=VHW5kPVISyEkmse_qQcyisBkkEwMO6GG2Ago-CH1AFA,487
66
+ ophyd_async/panda/writers/__init__.py,sha256=xy7BguVQG4HNIDBfKPjMj0KQo1tptC9LbCpEuMcVGaM,70
67
+ ophyd_async/panda/writers/_hdf_writer.py,sha256=_KlawqQHuWXLCvhGg1N6S4dQ8LhM88NbHsbXryxPvPA,7617
68
+ ophyd_async/panda/writers/_panda_hdf_file.py,sha256=42iHaTax4JjOBpNC7d4nkNL9SM14OTnFPTIcXv2jg-4,1759
69
+ ophyd_async/planstubs/__init__.py,sha256=G9B80_d87lnOThUsGbAYPqzMw9xDelq2TbS7dkB692o,188
70
+ ophyd_async/planstubs/prepare_trigger_and_dets.py,sha256=0c4XDAxVkSanyDKtaMda0VgPEbk2jM0geVzAx707DhI,1772
71
+ ophyd_async/sim/__init__.py,sha256=ScjH1g7FMo5yPACfJRZE6xGBWCHU4bKDzNQk1tqObnA,366
72
+ ophyd_async/sim/pattern_generator.py,sha256=cnHL9PEDrN1BTomLhGgPTWTnQIswNuYpU8AE9I1wi3g,10634
73
+ ophyd_async/sim/sim_pattern_detector_control.py,sha256=Ypz8IuRYAY2J243IhVbNyGr_Z-XtpJZ1qxma6NR3TgM,1838
74
+ ophyd_async/sim/sim_pattern_detector_writer.py,sha256=ESpcVyHd1TP7Cojznv2hJAwLinu3XbgAiVKfX12FCII,1237
75
+ ophyd_async/sim/sim_pattern_generator.py,sha256=fbcwWxTPYKLK33OzIY15vGylnonOO8HIudz1y_56GZU,1336
76
+ ophyd_async/sim/demo/__init__.py,sha256=9mxKpslrL89cfSj4g3og8Br3O--pMj3hhWZS-Xu6kyA,56
77
+ ophyd_async/sim/demo/sim_motor.py,sha256=uiMPV76JkFEVJkejECdpUNBygauaoPp11Ynb0N1TrD0,4075
78
+ ophyd_async-0.3a3.dist-info/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
79
+ ophyd_async-0.3a3.dist-info/METADATA,sha256=Iw5ewVCui6t0KJzvVsbZbiMKu8V4WOwoNAFQ4fQtd1w,6301
80
+ ophyd_async-0.3a3.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
81
+ ophyd_async-0.3a3.dist-info/entry_points.txt,sha256=O0YNJTEufO0w9BozXi-JurTy2U1_o0ypeCgJLQ727Jk,58
82
+ ophyd_async-0.3a3.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
83
+ ophyd_async-0.3a3.dist-info/RECORD,,
ophyd_async/epics/pvi.py DELETED
@@ -1,70 +0,0 @@
1
- from typing import Callable, Dict, FrozenSet, Optional, Type, TypedDict, TypeVar
2
-
3
- from ophyd_async.core.signal import Signal
4
- from ophyd_async.core.signal_backend import SignalBackend
5
- from ophyd_async.core.utils import DEFAULT_TIMEOUT
6
- from ophyd_async.epics._backend._p4p import PvaSignalBackend
7
- from ophyd_async.epics.signal.signal import (
8
- epics_signal_r,
9
- epics_signal_rw,
10
- epics_signal_w,
11
- epics_signal_x,
12
- )
13
-
14
- T = TypeVar("T")
15
-
16
-
17
- _pvi_mapping: Dict[FrozenSet[str], Callable[..., Signal]] = {
18
- frozenset({"r", "w"}): lambda dtype, read_pv, write_pv: epics_signal_rw(
19
- dtype, read_pv, write_pv
20
- ),
21
- frozenset({"rw"}): lambda dtype, read_pv, write_pv: epics_signal_rw(
22
- dtype, read_pv, write_pv
23
- ),
24
- frozenset({"r"}): lambda dtype, read_pv, _: epics_signal_r(dtype, read_pv),
25
- frozenset({"w"}): lambda dtype, _, write_pv: epics_signal_w(dtype, write_pv),
26
- frozenset({"x"}): lambda _, __, write_pv: epics_signal_x(write_pv),
27
- }
28
-
29
-
30
- class PVIEntry(TypedDict, total=False):
31
- d: str
32
- r: str
33
- rw: str
34
- w: str
35
- x: str
36
-
37
-
38
- async def pvi_get(
39
- read_pv: str, timeout: float = DEFAULT_TIMEOUT
40
- ) -> Dict[str, PVIEntry]:
41
- """Makes a PvaSignalBackend purely to connect to PVI information.
42
-
43
- This backend is simply thrown away at the end of this method. This is useful
44
- because the backend handles a CancelledError exception that gets thrown on
45
- timeout, and therefore can be used for error reporting."""
46
- backend: SignalBackend = PvaSignalBackend(None, read_pv, read_pv)
47
- await backend.connect(timeout=timeout)
48
- d: Dict[str, Dict[str, Dict[str, str]]] = await backend.get_value()
49
- pv_info = d.get("pvi") or {}
50
- result = {}
51
-
52
- for attr_name, attr_info in pv_info.items():
53
- result[attr_name] = PVIEntry(**attr_info) # type: ignore
54
-
55
- return result
56
-
57
-
58
- def make_signal(signal_pvi: PVIEntry, dtype: Optional[Type[T]] = None) -> Signal[T]:
59
- """Make a signal.
60
-
61
- This assumes datatype is None so it can be used to create dynamic signals.
62
- """
63
- operations = frozenset(signal_pvi.keys())
64
- pvs = [signal_pvi[i] for i in operations] # type: ignore
65
- signal_factory = _pvi_mapping[operations]
66
-
67
- write_pv = "pva://" + pvs[0]
68
- read_pv = write_pv if len(pvs) < 2 else "pva://" + pvs[1]
69
-
70
- return signal_factory(dtype, read_pv, write_pv)
@@ -1,241 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import re
4
- from typing import Dict, Optional, Tuple, cast, get_args, get_origin, get_type_hints
5
-
6
- from ophyd_async.core import (
7
- DEFAULT_TIMEOUT,
8
- Device,
9
- DeviceVector,
10
- Signal,
11
- SignalBackend,
12
- SignalR,
13
- SignalRW,
14
- SignalX,
15
- SimSignalBackend,
16
- )
17
- from ophyd_async.epics.pvi import PVIEntry, make_signal, pvi_get
18
- from ophyd_async.panda.table import SeqTable
19
-
20
-
21
- class PulseBlock(Device):
22
- delay: SignalRW[float]
23
- width: SignalRW[float]
24
-
25
-
26
- class SeqBlock(Device):
27
- table: SignalRW[SeqTable]
28
- active: SignalRW[bool]
29
-
30
-
31
- class PcapBlock(Device):
32
- active: SignalR[bool]
33
- arm: SignalRW[bool]
34
-
35
-
36
- def _block_name_number(block_name: str) -> Tuple[str, Optional[int]]:
37
- """Maps a panda block name to a block and number.
38
-
39
- There are exceptions to this rule; some blocks like pcap do not contain numbers.
40
- Other blocks may contain numbers and letters, but no numbers at the end.
41
-
42
- Such block names will only return the block name, and not a number.
43
-
44
- If this function returns both a block name and number, it should be instantiated
45
- into a device vector."""
46
- m = re.match("^([0-9a-z_-]*)([0-9]+)$", block_name)
47
- if m is not None:
48
- name, num = m.groups()
49
- return name, int(num or 1) # just to pass type checks.
50
-
51
- return block_name, None
52
-
53
-
54
- def _remove_inconsistent_blocks(pvi_info: Optional[Dict[str, PVIEntry]]) -> None:
55
- """Remove blocks from pvi information.
56
-
57
- This is needed because some pandas have 'pcap' and 'pcap1' blocks, which are
58
- inconsistent with the assumption that pandas should only have a 'pcap' block,
59
- for example.
60
-
61
- """
62
- if pvi_info is None:
63
- return
64
- pvi_keys = set(pvi_info.keys())
65
- for k in pvi_keys:
66
- kn = re.sub(r"\d*$", "", k)
67
- if kn and k != kn and kn in pvi_keys:
68
- del pvi_info[k]
69
-
70
-
71
- class PandA(Device):
72
- pulse: DeviceVector[PulseBlock]
73
- seq: DeviceVector[SeqBlock]
74
- pcap: PcapBlock
75
-
76
- def __init__(self, prefix: str, name: str = "") -> None:
77
- super().__init__(name)
78
- self._prefix = prefix
79
-
80
- def verify_block(self, name: str, num: Optional[int]):
81
- """Given a block name and number, return information about a block."""
82
- anno = get_type_hints(self, globalns=globals()).get(name)
83
-
84
- block: Device = Device()
85
-
86
- if anno:
87
- type_args = get_args(anno)
88
- block = type_args[0]() if type_args else anno()
89
-
90
- if not type_args:
91
- assert num is None, f"Only expected one {name} block, got {num}"
92
-
93
- return block
94
-
95
- async def _make_block(
96
- self,
97
- name: str,
98
- num: Optional[int],
99
- block_pv: str,
100
- sim: bool = False,
101
- timeout: float = DEFAULT_TIMEOUT,
102
- ):
103
- """Makes a block given a block name containing relevant signals.
104
-
105
- Loops through the signals in the block (found using type hints), if not in
106
- sim mode then does a pvi call, and identifies this signal from the pvi call.
107
- """
108
- block = self.verify_block(name, num)
109
-
110
- field_annos = get_type_hints(block, globalns=globals())
111
- block_pvi = await pvi_get(block_pv, timeout=timeout) if not sim else None
112
-
113
- # finds which fields this class actually has, e.g. delay, width...
114
- for sig_name, sig_type in field_annos.items():
115
- origin = get_origin(sig_type)
116
- args = get_args(sig_type)
117
-
118
- # if not in sim mode,
119
- if block_pvi:
120
- # try to get this block in the pvi.
121
- entry: Optional[PVIEntry] = block_pvi.get(sig_name)
122
- if entry is None:
123
- raise Exception(
124
- f"{self.__class__.__name__} has a {name} block containing a/"
125
- + f"an {sig_name} signal which has not been retrieved by PVI."
126
- )
127
-
128
- signal: Signal = make_signal(entry, args[0] if len(args) > 0 else None)
129
-
130
- else:
131
- backend: SignalBackend = SimSignalBackend(
132
- args[0] if len(args) > 0 else None, block_pv
133
- )
134
- signal = SignalX(backend) if not origin else origin(backend)
135
-
136
- setattr(block, sig_name, signal)
137
-
138
- # checks for any extra pvi information not contained in this class
139
- if block_pvi:
140
- for attr, attr_pvi in block_pvi.items():
141
- if not hasattr(block, attr):
142
- # makes any extra signals
143
- setattr(block, attr, make_signal(attr_pvi))
144
-
145
- return block
146
-
147
- async def _make_untyped_block(
148
- self, block_pv: str, timeout: float = DEFAULT_TIMEOUT
149
- ):
150
- """Populates a block using PVI information.
151
-
152
- This block is not typed as part of the PandA interface but needs to be
153
- included dynamically anyway.
154
- """
155
- block = Device()
156
- block_pvi: Dict[str, PVIEntry] = await pvi_get(block_pv, timeout=timeout)
157
-
158
- for signal_name, signal_pvi in block_pvi.items():
159
- setattr(block, signal_name, make_signal(signal_pvi))
160
-
161
- return block
162
-
163
- # TODO redo to set_panda_block? confusing name
164
- def set_attribute(self, name: str, num: Optional[int], block: Device):
165
- """Set a block on the panda.
166
-
167
- Need to be able to set device vectors on the panda as well, e.g. if num is not
168
- None, need to be able to make a new device vector and start populating it...
169
- """
170
- anno = get_type_hints(self, globalns=globals()).get(name)
171
-
172
- # if it's an annotated device vector, or it isn't but we've got a number then
173
- # make a DeviceVector on the class
174
- if get_origin(anno) == DeviceVector or (not anno and num is not None):
175
- self.__dict__.setdefault(name, DeviceVector())[num] = block
176
- else:
177
- setattr(self, name, block)
178
-
179
- async def connect(
180
- self, sim: bool = False, timeout: float = DEFAULT_TIMEOUT
181
- ) -> None:
182
- """Initialises all blocks and connects them.
183
-
184
- First, checks for pvi information. If it exists, make all blocks from this.
185
- Then, checks that all required blocks in the PandA have been made.
186
-
187
- If there's no pvi information, that's because we're in sim mode. In that case,
188
- makes all required blocks.
189
- """
190
- pvi_info = (
191
- await pvi_get(self._prefix + "PVI", timeout=timeout) if not sim else None
192
- )
193
- _remove_inconsistent_blocks(pvi_info)
194
-
195
- hints = {
196
- attr_name: attr_type
197
- for attr_name, attr_type in get_type_hints(self, globalns=globals()).items()
198
- if not attr_name.startswith("_")
199
- }
200
-
201
- # create all the blocks pvi says it should have,
202
- if pvi_info:
203
- pvi_info = cast(Dict[str, PVIEntry], pvi_info)
204
- for block_name, block_pvi in pvi_info.items():
205
- name, num = _block_name_number(block_name)
206
-
207
- if name in hints:
208
- block = await self._make_block(
209
- name, num, block_pvi["d"], timeout=timeout
210
- )
211
- else:
212
- block = await self._make_untyped_block(
213
- block_pvi["d"], timeout=timeout
214
- )
215
-
216
- self.set_attribute(name, num, block)
217
-
218
- # then check if the ones defined in this class are in the pvi info
219
- # make them if there is no pvi info, i.e. sim mode.
220
- for block_name in hints.keys():
221
- if pvi_info is not None:
222
- pvi_name = block_name
223
-
224
- if get_origin(hints[block_name]) == DeviceVector:
225
- pvi_name += "1"
226
-
227
- entry: Optional[PVIEntry] = pvi_info.get(pvi_name)
228
-
229
- assert entry, f"Expected PandA to contain {block_name} block."
230
- assert list(entry) == [
231
- "d"
232
- ], f"Expected PandA to only contain blocks, got {entry}"
233
- else:
234
- num = 1 if get_origin(hints[block_name]) == DeviceVector else None
235
- block = await self._make_block(
236
- block_name, num, "sim://", sim=sim, timeout=timeout
237
- )
238
- self.set_attribute(block_name, num, block)
239
-
240
- self.set_name(self.name)
241
- await super().connect(sim)
@@ -1,56 +0,0 @@
1
- ophyd_async/__init__.py,sha256=WJoRU7gO-hRzyf7a-C952zF6-7zwPjP7qZ1Qu5GTUC8,124
2
- ophyd_async/__main__.py,sha256=G-Zcv_G9zK7Nhx6o5L5w-wyhMxdl_WgyMELu8IMFqAE,328
3
- ophyd_async/_version.py,sha256=nSi77MfFtahju9XLwmhCTVsEygz__it8HHOvmBHSgKI,408
4
- ophyd_async/core/__init__.py,sha256=Vy0m53wHwRSQ8FVeqzyZ5c6qdWIkkLA4vmEwbdk7iqc,2121
5
- ophyd_async/core/_providers.py,sha256=HJbXQGocNxGDr5fv13zOkONXN1JqCfqJ3P0pR_sIy1Y,2137
6
- ophyd_async/core/async_status.py,sha256=-sfIf7VhwAP25kSVwKZjAIYOTROpfnh2jgkDw5_afSU,2801
7
- ophyd_async/core/detector.py,sha256=-KttT_gPniRB5xalfh5xj2aH5nLV6KoDVLlXaM-d0rw,9989
8
- ophyd_async/core/device.py,sha256=Ai5FRThlDeXnzKwTuVlmD8RFzlF_cq88Y6xcEiHOTho,5545
9
- ophyd_async/core/device_save_loader.py,sha256=RXA3dPUPihAR2ZGDStlGiA-TAsr_xqL0snsCjMsMnfA,9138
10
- ophyd_async/core/flyer.py,sha256=PBfxH9XMYqhFzNFqR2H6U_FxY2L5Un5mUD_3GMDZvdo,2780
11
- ophyd_async/core/signal.py,sha256=PgoUzcmMaQczoBSlHDA4AmRKoDwoDH9uNmF_5DgJa6k,11800
12
- ophyd_async/core/signal_backend.py,sha256=hwrDrwJK9rzOW4fsN_T2RFdCHhYwSFkR325i5L0lHE8,1363
13
- ophyd_async/core/sim_signal_backend.py,sha256=h7if2Oqr4jNOLfQoD_sqJOZd3uyTNHpfn1oJ4apug84,5590
14
- ophyd_async/core/standard_readable.py,sha256=9cBetIYttAho-7wOB3T1YgSJy0iWEFTAdn9jZkrGvLA,2560
15
- ophyd_async/core/utils.py,sha256=10cGVTR73oa_05ZVfdNzdTlr3-s1VHxvgtT1PD5LJ8Q,4585
16
- ophyd_async/epics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- ophyd_async/epics/pvi.py,sha256=BGhAXLyY2Z2e3ujyJ2ObnW19hogGvTZbHZY6Iq_nQeU,2331
18
- ophyd_async/epics/_backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- ophyd_async/epics/_backend/_aioca.py,sha256=0PmpDNohm52461plfrxirLJsyhZXgYIDJv12Y6zfQ0A,8731
20
- ophyd_async/epics/_backend/_p4p.py,sha256=aikjxQUgBRqNmMNMzOx3-N0rPdn-D1E8P5vQwvmYIgM,11970
21
- ophyd_async/epics/_backend/common.py,sha256=3zxGLNcBtss6WUGAwfAjxWnUF4YbFbYvpOUmoFJaG5Y,753
22
- ophyd_async/epics/areadetector/__init__.py,sha256=oEOzL7gEVVSULeT2WkFrva8lUKeX0zmQD0tmwFz6L24,325
23
- ophyd_async/epics/areadetector/single_trigger_det.py,sha256=q5mG-OUVagIjvXLb28lsrGj4eUSoH2pNW2rT4rQR8fA,1206
24
- ophyd_async/epics/areadetector/utils.py,sha256=dez54oElIkGMnhSM9qghToUB1opSqjdWTV2vhHCgRMA,3133
25
- ophyd_async/epics/areadetector/controllers/__init__.py,sha256=UG2-M5d2ykp2T8isQJCbAsGZF1aH0BtC_OPlzzPTjnA,149
26
- ophyd_async/epics/areadetector/controllers/ad_sim_controller.py,sha256=mthZ6WxajMEgUKptq3bnkIctbLhjzTagV66i1auB8cg,1587
27
- ophyd_async/epics/areadetector/controllers/pilatus_controller.py,sha256=TSWry-eWfDl4LqafMH75aVqYTrsdmSEbBzCLDUcR2aY,1552
28
- ophyd_async/epics/areadetector/drivers/__init__.py,sha256=AOpIEYfoBhG9Nc4-SId99v4PpyEh4_RBXfNaqiXlwUI,315
29
- ophyd_async/epics/areadetector/drivers/ad_base.py,sha256=ikfyNcZwJa5ah52DckjrBzkMMT_eDY1smM4XWfb6A6E,3689
30
- ophyd_async/epics/areadetector/drivers/pilatus_driver.py,sha256=cn5WNz913UOnOttw2bssjV2Bo3p9SuJma3ckRyCdvw8,442
31
- ophyd_async/epics/areadetector/writers/__init__.py,sha256=tpPcrYd1hs8WS7C0gmCnR2EBwjE5RzCljI7WwZ2V_LM,191
32
- ophyd_async/epics/areadetector/writers/_hdfdataset.py,sha256=E0C9VgsPyY35h7k0mvcIhjsIVNavApLxizqNWlM388w,167
33
- ophyd_async/epics/areadetector/writers/_hdffile.py,sha256=Zh7nWzK9-q0ASCi88tLAFUuWRL_rbz8XTNzKXwRmi88,1797
34
- ophyd_async/epics/areadetector/writers/hdf_writer.py,sha256=lJHP1CzpXYH82GcgEA-D4qI27Uj1_W8pAVgexFSXmgk,5011
35
- ophyd_async/epics/areadetector/writers/nd_file_hdf.py,sha256=rutCstILCGGwhP5pH_2lWM2QUcZ88-uxx5dTZIJUMWQ,1562
36
- ophyd_async/epics/areadetector/writers/nd_plugin.py,sha256=l0yBBEazviyFsWJv_4_sfGn_YM_Iyd0_SlMdAmUlXDU,871
37
- ophyd_async/epics/demo/__init__.py,sha256=DbVO4ufJWjQnZteilW8SBs5A8DN-Xajn0YibM0q8UkE,5500
38
- ophyd_async/epics/demo/demo_ad_sim_detector.py,sha256=06y65yvaqXvL2rDocjYyLz9kTVzuwV-LeuPhEfExdOA,944
39
- ophyd_async/epics/demo/mover.db,sha256=RFz0rxZue689Wh1sWTZwWeFMUrH04ttPq2u5xJH_Fp4,998
40
- ophyd_async/epics/demo/sensor.db,sha256=AVtiydrdtwAz2EFurO2Ult9SSRtre3r0akOBbL98LT0,554
41
- ophyd_async/epics/motion/__init__.py,sha256=tnmVRIwKa9PdN_xonJdAUD04UpEceh-hoD7XI62yDB0,46
42
- ophyd_async/epics/motion/motor.py,sha256=lQcA3PSPxA6XOnk8y5VuJGnKTq2VjkcO6ldCrssGr3M,3392
43
- ophyd_async/epics/signal/__init__.py,sha256=wb93RTqvSbGKVFQj8OHykbVLGLmwKHU72oi5xYu2UaY,188
44
- ophyd_async/epics/signal/_epics_transport.py,sha256=DEIL0iYUAWssysVEgWGu1fHSM1l-ATV2kjUgPtDN9LY,858
45
- ophyd_async/epics/signal/signal.py,sha256=7GnGa4CgFgTwyHeh4wYOJ2GEWwdXsC6vHD3z9LsaHaM,2543
46
- ophyd_async/panda/__init__.py,sha256=rVM7PdHnON5h0Hcpz_49N5bVfcNmSH5V6ApdaGcBSno,533
47
- ophyd_async/panda/panda.py,sha256=f_bEYUn7HwMCfVsZxPJ43e4Mo9FQrluHh7_vOHErwYE,8335
48
- ophyd_async/panda/panda_controller.py,sha256=CK9TTXAGXne31C3HZfBo_grk9pIM1y9Lyo0lms37dLY,1236
49
- ophyd_async/panda/table.py,sha256=dLoRP4zYNOkD_s0Vkp2wVYAwkjVG8nNdf8-FaXOTfPo,5655
50
- ophyd_async/panda/utils.py,sha256=VHW5kPVISyEkmse_qQcyisBkkEwMO6GG2Ago-CH1AFA,487
51
- ophyd_async-0.3a1.dist-info/LICENSE,sha256=pU5shZcsvWgz701EbT7yjFZ8rMvZcWgRH54CRt8ld_c,1517
52
- ophyd_async-0.3a1.dist-info/METADATA,sha256=Ypyn4I7_5JESeLA3lNZUyld4MB3vNrWGw_bpTnYvq0g,7208
53
- ophyd_async-0.3a1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
54
- ophyd_async-0.3a1.dist-info/entry_points.txt,sha256=O0YNJTEufO0w9BozXi-JurTy2U1_o0ypeCgJLQ727Jk,58
55
- ophyd_async-0.3a1.dist-info/top_level.txt,sha256=-hjorMsv5Rmjo3qrgqhjpal1N6kW5vMxZO3lD4iEaXs,12
56
- ophyd_async-0.3a1.dist-info/RECORD,,
File without changes
File without changes