ophyd-async 0.3a6__tar.gz → 0.3.1__tar.gz

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 (200) hide show
  1. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/PKG-INFO +2 -2
  2. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/README.md +1 -1
  3. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/write-tests-for-devices.rst +5 -0
  4. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/_version.py +2 -2
  5. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/__init__.py +3 -5
  6. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/detector.py +15 -10
  7. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/device_save_loader.py +1 -23
  8. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/mock_signal_backend.py +5 -8
  9. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/mock_signal_utils.py +25 -11
  10. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/signal.py +34 -13
  11. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/signal_backend.py +1 -1
  12. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/standard_readable.py +2 -0
  13. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/_backend/_aioca.py +93 -18
  14. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/_backend/_p4p.py +81 -16
  15. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/_backend/common.py +24 -1
  16. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/pilatus_controller.py +18 -5
  17. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/pilatus_driver.py +2 -2
  18. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/pilatus.py +21 -4
  19. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/pvi/pvi.py +26 -6
  20. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_hdf_panda.py +0 -1
  21. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/plan_stubs/fly.py +4 -0
  22. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/sim_pattern_generator.py +0 -2
  23. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/PKG-INFO +2 -2
  24. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/SOURCES.txt +2 -1
  25. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_device_save_loader.py +99 -1
  26. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_flyer.py +0 -2
  27. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_mock_signal_backend.py +32 -27
  28. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_signal.py +31 -0
  29. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_standard_readable.py +12 -1
  30. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_controllers.py +26 -16
  31. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_pilatus.py +48 -6
  32. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_scans.py +5 -3
  33. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/demo/test_demo.py +24 -0
  34. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/test_pvi.py +58 -0
  35. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/test_records.db +28 -0
  36. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/test_signals.py +330 -82
  37. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/plan_stubs/test_fly.py +45 -5
  38. ophyd_async-0.3.1/tests/test_data/test_yaml_save.yml +22 -0
  39. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.codecov.yml +0 -0
  40. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.copier-answers.yml +0 -0
  41. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.devcontainer/devcontainer.json +0 -0
  42. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.git-blame-ignore-revs +0 -0
  43. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/CONTRIBUTING.md +0 -0
  44. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/actions/install_requirements/action.yml +0 -0
  45. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/dependabot.yml +0 -0
  46. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/pages/index.html +0 -0
  47. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/pages/make_switcher.py +0 -0
  48. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_check.yml +0 -0
  49. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_dist.yml +0 -0
  50. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_docs.yml +0 -0
  51. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_pypi.yml +0 -0
  52. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_release.yml +0 -0
  53. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_test.yml +0 -0
  54. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/_tox.yml +0 -0
  55. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/ci.yml +0 -0
  56. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.github/workflows/periodic.yml +0 -0
  57. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.gitignore +0 -0
  58. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.mailmap +0 -0
  59. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/.pre-commit-config.yaml +0 -0
  60. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/Dockerfile +0 -0
  61. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/LICENSE +0 -0
  62. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/_templates/README +0 -0
  63. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/_templates/custom-class-template.rst +0 -0
  64. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/_templates/custom-module-template.rst +0 -0
  65. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/conf.py +0 -0
  66. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/examples/epics_demo.py +0 -0
  67. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/examples/foo_detector.py +0 -0
  68. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0001-record-architecture-decisions.md +0 -0
  69. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0002-switched-to-python-copier-template.md +0 -0
  70. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0003-ophyd-async-migration.rst +0 -0
  71. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0004-repository-structure.rst +0 -0
  72. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0005-respect-black-line-length.rst +0 -0
  73. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/0006-procedural-device-definitions.rst +0 -0
  74. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions/COPYME +0 -0
  75. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/decisions.md +0 -0
  76. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/design-goals.rst +0 -0
  77. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/event-loop-choice.rst +0 -0
  78. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations/flyscanning.rst +0 -0
  79. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/explanations.md +0 -0
  80. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/genindex.rst +0 -0
  81. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/choose-interfaces-for-devices.md +0 -0
  82. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/compound-devices.rst +0 -0
  83. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/contribute.md +0 -0
  84. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/make-a-simple-device.rst +0 -0
  85. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to/make-a-standard-detector.rst +0 -0
  86. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/how-to.md +0 -0
  87. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/images/bluesky_ophyd_epics_devices_logo.svg +0 -0
  88. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/images/bluesky_ophyd_logo.svg +0 -0
  89. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/images/ophyd_favicon.svg +0 -0
  90. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/index.md +0 -0
  91. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/reference/api.rst +0 -0
  92. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/reference.md +0 -0
  93. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/tutorials/installation.md +0 -0
  94. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/tutorials/using-existing-devices.rst +0 -0
  95. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/docs/tutorials.md +0 -0
  96. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/pyproject.toml +0 -0
  97. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/setup.cfg +0 -0
  98. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/__init__.py +0 -0
  99. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/__main__.py +0 -0
  100. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/_providers.py +0 -0
  101. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/async_status.py +0 -0
  102. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/device.py +0 -0
  103. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/flyer.py +0 -0
  104. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/soft_signal_backend.py +0 -0
  105. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/core/utils.py +0 -0
  106. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/__init__.py +0 -0
  107. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/_backend/__init__.py +0 -0
  108. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/__init__.py +0 -0
  109. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/aravis.py +0 -0
  110. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/__init__.py +0 -0
  111. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/ad_sim_controller.py +0 -0
  112. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/aravis_controller.py +0 -0
  113. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/kinetix_controller.py +0 -0
  114. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/controllers/vimba_controller.py +0 -0
  115. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/__init__.py +0 -0
  116. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/ad_base.py +0 -0
  117. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/aravis_driver.py +0 -0
  118. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/kinetix_driver.py +0 -0
  119. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/drivers/vimba_driver.py +0 -0
  120. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/kinetix.py +0 -0
  121. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/single_trigger_det.py +0 -0
  122. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/utils.py +0 -0
  123. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/vimba.py +0 -0
  124. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/__init__.py +0 -0
  125. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/_hdfdataset.py +0 -0
  126. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/_hdffile.py +0 -0
  127. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/hdf_writer.py +0 -0
  128. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/nd_file_hdf.py +0 -0
  129. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/areadetector/writers/nd_plugin.py +0 -0
  130. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/demo/__init__.py +0 -0
  131. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/demo/demo_ad_sim_detector.py +0 -0
  132. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/demo/mover.db +0 -0
  133. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/demo/sensor.db +0 -0
  134. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/motion/__init__.py +0 -0
  135. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/motion/motor.py +0 -0
  136. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/pvi/__init__.py +0 -0
  137. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/signal/__init__.py +0 -0
  138. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/signal/_epics_transport.py +0 -0
  139. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/epics/signal/signal.py +0 -0
  140. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/log.py +0 -0
  141. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/__init__.py +0 -0
  142. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_common_blocks.py +0 -0
  143. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_panda_controller.py +0 -0
  144. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_table.py +0 -0
  145. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_trigger.py +0 -0
  146. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/_utils.py +0 -0
  147. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/writers/__init__.py +0 -0
  148. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/writers/_hdf_writer.py +0 -0
  149. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/panda/writers/_panda_hdf_file.py +0 -0
  150. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/plan_stubs/__init__.py +0 -0
  151. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/plan_stubs/ensure_connected.py +0 -0
  152. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/protocols.py +0 -0
  153. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/__init__.py +0 -0
  154. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/demo/__init__.py +0 -0
  155. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/demo/sim_motor.py +0 -0
  156. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/pattern_generator.py +0 -0
  157. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/sim_pattern_detector_control.py +0 -0
  158. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async/sim/sim_pattern_detector_writer.py +0 -0
  159. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/dependency_links.txt +0 -0
  160. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/entry_points.txt +0 -0
  161. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/requires.txt +0 -0
  162. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/src/ophyd_async.egg-info/top_level.txt +0 -0
  163. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/conftest.py +0 -0
  164. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_async_status.py +0 -0
  165. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_device.py +0 -0
  166. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_device_collector.py +0 -0
  167. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_soft_signal_backend.py +0 -0
  168. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_utils.py +0 -0
  169. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/core/test_watchable_async_status.py +0 -0
  170. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/_backend/test_common.py +0 -0
  171. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/__init__.py +0 -0
  172. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_aravis.py +0 -0
  173. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_drivers.py +0 -0
  174. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_kinetix.py +0 -0
  175. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_single_trigger_det.py +0 -0
  176. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_utils.py +0 -0
  177. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_vimba.py +0 -0
  178. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/areadetector/test_writers.py +0 -0
  179. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/demo/test_demo_ad_sim_detector.py +0 -0
  180. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/motion/__init__.py +0 -0
  181. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/epics/motion/test_motor.py +0 -0
  182. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/db/panda.db +0 -0
  183. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_hdf_panda.py +0 -0
  184. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_panda_connect.py +0 -0
  185. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_panda_controller.py +0 -0
  186. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_panda_utils.py +0 -0
  187. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_table.py +0 -0
  188. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_trigger.py +0 -0
  189. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/panda/test_writer.py +0 -0
  190. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/protocols/test_protocols.py +0 -0
  191. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/__init__.py +0 -0
  192. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/conftest.py +0 -0
  193. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/demo/__init__.py +0 -0
  194. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/demo/test_sim_motor.py +0 -0
  195. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/test_pattern_generator.py +0 -0
  196. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/test_sim_detector.py +0 -0
  197. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/test_sim_writer.py +0 -0
  198. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/sim/test_streaming_plan.py +0 -0
  199. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/test_cli.py +0 -0
  200. {ophyd_async-0.3a6 → ophyd_async-0.3.1}/tests/test_log.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ophyd-async
3
- Version: 0.3a6
3
+ Version: 0.3.1
4
4
  Summary: Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango
5
5
  Author-email: Tom Cobb <tom.cobb@diamond.ac.uk>
6
6
  License: BSD 3-Clause License
@@ -96,7 +96,7 @@ Requires-Dist: types-pyyaml; extra == "dev"
96
96
 
97
97
  # ophyd-async
98
98
 
99
- Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango
99
+ Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango.
100
100
 
101
101
  | Source | <https://github.com/bluesky/ophyd-async> |
102
102
  | :-----------: | :-----------------------------------------------: |
@@ -5,7 +5,7 @@
5
5
 
6
6
  # ophyd-async
7
7
 
8
- Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango
8
+ Asynchronous Bluesky hardware abstraction code, compatible with control systems like EPICS and Tango.
9
9
 
10
10
  | Source | <https://github.com/bluesky/ophyd-async> |
11
11
  | :-----------: | :-----------------------------------------------: |
@@ -41,6 +41,11 @@ In addition this example also utilizes helper functions like ``assert_reading``
41
41
  :pyobject: test_sensor_reading_shows_value
42
42
 
43
43
 
44
+ Given that the mock signal holds a ``unittest.mock.Mock`` object you can retrieve this object and assert that the device has been set correctly using ``get_mock_put``. You are also free to use any other behaviour that ``unittest.mock.Mock`` provides, such as in this example which sets the parent of the mock to allow ordering across signals to be asserted:
45
+
46
+ .. literalinclude:: ../../tests/epics/demo/test_demo.py
47
+ :pyobject: test_retrieve_mock_and_assert
48
+
44
49
  There are several other test utility functions:
45
50
 
46
51
  Use ``callback_on_mock_put``, for hooking in logic when a mock value changes (e.g. because someone puts to it). This can be called directly, or used as a context, with the callbacks ending after exit.
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '0.3a6'
16
- __version_tuple__ = version_tuple = (0, 3)
15
+ __version__ = version = '0.3.1'
16
+ __version_tuple__ = version_tuple = (0, 3, 1)
@@ -24,12 +24,10 @@ from .device_save_loader import (
24
24
  walk_rw_signals,
25
25
  )
26
26
  from .flyer import HardwareTriggeredFlyable, TriggerLogic
27
- from .mock_signal_backend import (
28
- MockSignalBackend,
29
- )
27
+ from .mock_signal_backend import MockSignalBackend
30
28
  from .mock_signal_utils import (
31
- assert_mock_put_called_with,
32
29
  callback_on_mock_put,
30
+ get_mock_put,
33
31
  mock_puts_blocked,
34
32
  reset_mock_put_calls,
35
33
  set_mock_put_proceeds,
@@ -70,7 +68,7 @@ from .utils import (
70
68
  )
71
69
 
72
70
  __all__ = [
73
- "assert_mock_put_called_with",
71
+ "get_mock_put",
74
72
  "callback_on_mock_put",
75
73
  "mock_puts_blocked",
76
74
  "set_mock_values",
@@ -63,6 +63,8 @@ class TriggerInfo:
63
63
  deadtime: float
64
64
  #: What is the maximum high time of the triggers
65
65
  livetime: float
66
+ #: What is the maximum timeout on waiting for a frame
67
+ frame_timeout: float | None = None
66
68
 
67
69
 
68
70
  class DetectorControl(ABC):
@@ -162,7 +164,6 @@ class StandardDetector(
162
164
  writer: DetectorWriter,
163
165
  config_sigs: Sequence[AsyncReadable] = (),
164
166
  name: str = "",
165
- writer_timeout: float = DEFAULT_TIMEOUT,
166
167
  ) -> None:
167
168
  """
168
169
  Constructor
@@ -173,16 +174,11 @@ class StandardDetector(
173
174
  config_sigs: Signals to read when describe and read
174
175
  configuration are called. Defaults to ().
175
176
  name: Device name. Defaults to "".
176
- writer_timeout: Timeout for frame writing to start, if the
177
- timeout is reached, ophyd-async assumes the detector
178
- has a problem and raises an error.
179
- Defaults to DEFAULT_TIMEOUT.
180
177
  """
181
178
  self._controller = controller
182
179
  self._writer = writer
183
180
  self._describe: Dict[str, DataKey] = {}
184
181
  self._config_sigs = list(config_sigs)
185
- self._frame_writing_timeout = writer_timeout
186
182
  # For prepare
187
183
  self._arm_status: Optional[AsyncStatus] = None
188
184
  self._trigger_info: Optional[TriggerInfo] = None
@@ -245,17 +241,21 @@ class StandardDetector(
245
241
 
246
242
  @AsyncStatus.wrap
247
243
  async def trigger(self) -> None:
244
+ # set default trigger_info
245
+ self._trigger_info = TriggerInfo(
246
+ num=1, trigger=DetectorTrigger.internal, deadtime=0.0, livetime=0.0
247
+ )
248
248
  # Arm the detector and wait for it to finish.
249
249
  indices_written = await self.writer.get_indices_written()
250
250
  written_status = await self.controller.arm(
251
- num=1,
252
- trigger=DetectorTrigger.internal,
251
+ num=self._trigger_info.num,
252
+ trigger=self._trigger_info.trigger,
253
253
  )
254
254
  await written_status
255
255
  end_observation = indices_written + 1
256
256
 
257
257
  async for index in self.writer.observe_indices_written(
258
- self._frame_writing_timeout
258
+ DEFAULT_TIMEOUT + self._trigger_info.livetime + self._trigger_info.deadtime
259
259
  ):
260
260
  if index >= end_observation:
261
261
  break
@@ -309,7 +309,12 @@ class StandardDetector(
309
309
  assert self._arm_status, "Prepare not run"
310
310
  assert self._trigger_info
311
311
  async for index in self.writer.observe_indices_written(
312
- self._frame_writing_timeout
312
+ self._trigger_info.frame_timeout
313
+ or (
314
+ DEFAULT_TIMEOUT
315
+ + self._trigger_info.livetime
316
+ + self._trigger_info.deadtime
317
+ )
313
318
  ):
314
319
  yield WatcherUpdate(
315
320
  name=self.name,
@@ -1,6 +1,5 @@
1
1
  from enum import Enum
2
- from functools import partial
3
- from typing import Any, Callable, Dict, Generator, List, Optional, Sequence, Union
2
+ from typing import Any, Callable, Dict, Generator, List, Optional, Sequence
4
3
 
5
4
  import numpy as np
6
5
  import numpy.typing as npt
@@ -8,13 +7,10 @@ import yaml
8
7
  from bluesky.plan_stubs import abs_set, wait
9
8
  from bluesky.protocols import Location
10
9
  from bluesky.utils import Msg
11
- from epicscorelibs.ca.dbr import ca_array, ca_float, ca_int, ca_str
12
10
 
13
11
  from .device import Device
14
12
  from .signal import SignalRW
15
13
 
16
- CaType = Union[ca_float, ca_int, ca_str, ca_array]
17
-
18
14
 
19
15
  def ndarray_representer(dumper: yaml.Dumper, array: npt.NDArray[Any]) -> yaml.Node:
20
16
  return dumper.represent_sequence(
@@ -22,19 +18,6 @@ def ndarray_representer(dumper: yaml.Dumper, array: npt.NDArray[Any]) -> yaml.No
22
18
  )
23
19
 
24
20
 
25
- def ca_dbr_representer(dumper: yaml.Dumper, value: CaType) -> yaml.Node:
26
- # if it's an array, just call ndarray_representer...
27
- represent_array = partial(ndarray_representer, dumper)
28
-
29
- representers: Dict[CaType, Callable[[CaType], yaml.Node]] = {
30
- ca_float: dumper.represent_float,
31
- ca_int: dumper.represent_int,
32
- ca_str: dumper.represent_str,
33
- ca_array: represent_array,
34
- }
35
- return representers[type(value)](value)
36
-
37
-
38
21
  class OphydDumper(yaml.Dumper):
39
22
  def represent_data(self, data: Any) -> Any:
40
23
  if isinstance(data, Enum):
@@ -152,11 +135,6 @@ def save_to_yaml(phases: Sequence[Dict[str, Any]], save_path: str) -> None:
152
135
 
153
136
  yaml.add_representer(np.ndarray, ndarray_representer, Dumper=yaml.Dumper)
154
137
 
155
- yaml.add_representer(ca_float, ca_dbr_representer, Dumper=yaml.Dumper)
156
- yaml.add_representer(ca_int, ca_dbr_representer, Dumper=yaml.Dumper)
157
- yaml.add_representer(ca_str, ca_dbr_representer, Dumper=yaml.Dumper)
158
- yaml.add_representer(ca_array, ca_dbr_representer, Dumper=yaml.Dumper)
159
-
160
138
  with open(save_path, "w") as file:
161
139
  yaml.dump(phases, file, Dumper=OphydDumper, default_flow_style=False)
162
140
 
@@ -1,6 +1,6 @@
1
1
  import asyncio
2
2
  from functools import cached_property
3
- from typing import Optional, Type
3
+ from typing import Callable, Optional, Type
4
4
  from unittest.mock import Mock
5
5
 
6
6
  from bluesky.protocols import Descriptor, Reading
@@ -10,7 +10,7 @@ from ophyd_async.core.soft_signal_backend import SoftSignalBackend
10
10
  from ophyd_async.core.utils import DEFAULT_TIMEOUT, ReadingValueCallback, T
11
11
 
12
12
 
13
- class MockSignalBackend(SignalBackend):
13
+ class MockSignalBackend(SignalBackend[T]):
14
14
  def __init__(
15
15
  self,
16
16
  datatype: Optional[Type[T]] = None,
@@ -31,11 +31,11 @@ class MockSignalBackend(SignalBackend):
31
31
 
32
32
  if not isinstance(self.initial_backend, SoftSignalBackend):
33
33
  # If the backend is a hard signal backend, or not provided,
34
- # then we create a soft signal to mimick it
34
+ # then we create a soft signal to mimic it
35
35
 
36
36
  self.soft_backend = SoftSignalBackend(datatype=datatype)
37
37
  else:
38
- self.soft_backend = initial_backend
38
+ self.soft_backend = self.initial_backend
39
39
 
40
40
  def source(self, name: str) -> str:
41
41
  if self.initial_backend:
@@ -47,7 +47,7 @@ class MockSignalBackend(SignalBackend):
47
47
 
48
48
  @cached_property
49
49
  def put_mock(self) -> Mock:
50
- return Mock(name="put")
50
+ return Mock(name="put", spec=Callable)
51
51
 
52
52
  @cached_property
53
53
  def put_proceeds(self) -> asyncio.Event:
@@ -65,9 +65,6 @@ class MockSignalBackend(SignalBackend):
65
65
  def set_value(self, value: T):
66
66
  self.soft_backend.set_value(value)
67
67
 
68
- async def get_descriptor(self, source: str) -> Descriptor:
69
- return await self.soft_backend.get_descriptor(source)
70
-
71
68
  async def get_reading(self) -> Reading:
72
69
  return await self.soft_backend.get_reading()
73
70
 
@@ -1,6 +1,6 @@
1
1
  from contextlib import asynccontextmanager, contextmanager
2
- from typing import Any, Callable, Iterable, Iterator, List
3
- from unittest.mock import ANY, Mock
2
+ from typing import Any, Callable, Iterable
3
+ from unittest.mock import Mock
4
4
 
5
5
  from ophyd_async.core.signal import Signal
6
6
  from ophyd_async.core.utils import T
@@ -22,7 +22,7 @@ def set_mock_value(signal: Signal[T], value: T):
22
22
  backend.set_value(value)
23
23
 
24
24
 
25
- def set_mock_put_proceeds(signal: Signal[T], proceeds: bool):
25
+ def set_mock_put_proceeds(signal: Signal, proceeds: bool):
26
26
  """Allow or block a put with wait=True from proceeding"""
27
27
  backend = _get_mock_signal_backend(signal)
28
28
 
@@ -33,7 +33,7 @@ def set_mock_put_proceeds(signal: Signal[T], proceeds: bool):
33
33
 
34
34
 
35
35
  @asynccontextmanager
36
- async def mock_puts_blocked(*signals: List[Signal]):
36
+ async def mock_puts_blocked(*signals: Signal):
37
37
  for signal in signals:
38
38
  set_mock_put_proceeds(signal, False)
39
39
  yield
@@ -41,9 +41,9 @@ async def mock_puts_blocked(*signals: List[Signal]):
41
41
  set_mock_put_proceeds(signal, True)
42
42
 
43
43
 
44
- def assert_mock_put_called_with(signal: Signal, value: Any, wait=ANY, timeout=ANY):
45
- backend = _get_mock_signal_backend(signal)
46
- backend.put_mock.assert_called_with(value, wait=wait, timeout=timeout)
44
+ def get_mock_put(signal: Signal) -> Mock:
45
+ """Get the mock associated with the put call on the signal."""
46
+ return _get_mock_signal_backend(signal).put_mock
47
47
 
48
48
 
49
49
  def reset_mock_put_calls(signal: Signal):
@@ -79,15 +79,29 @@ class _SetValuesIterator:
79
79
  return next_value
80
80
 
81
81
  def __del__(self):
82
- if self.require_all_consumed and self.index != len(self.values):
83
- raise AssertionError("Not all values have been consumed.")
82
+ if self.require_all_consumed:
83
+ # Values is cast to a list here because the user has supplied
84
+ # require_all_consumed=True, we can therefore assume they
85
+ # supplied a finite list.
86
+ # In the case of require_all_consumed=False, an infinite
87
+ # iterble is permitted
88
+ values = list(self.values)
89
+ if self.index != len(values):
90
+ # Report the values consumed and the values yet to be
91
+ # consumed
92
+ consumed = values[0 : self.index]
93
+ to_be_consumed = values[self.index :]
94
+ raise AssertionError(
95
+ f"{self.signal.name}: {consumed} were consumed "
96
+ f"but {to_be_consumed} were not consumed"
97
+ )
84
98
 
85
99
 
86
100
  def set_mock_values(
87
101
  signal: Signal,
88
102
  values: Iterable[Any],
89
103
  require_all_consumed: bool = False,
90
- ) -> Iterator[Any]:
104
+ ) -> _SetValuesIterator:
91
105
  """Iterator to set a signal to a sequence of values, optionally repeating the
92
106
  sequence.
93
107
 
@@ -127,7 +141,7 @@ def _unset_side_effect_cm(put_mock: Mock):
127
141
  put_mock.side_effect = None
128
142
 
129
143
 
130
- def callback_on_mock_put(signal: Signal, callback: Callable[[T], None]):
144
+ def callback_on_mock_put(signal: Signal[T], callback: Callable[[T], None]):
131
145
  """For setting a callback when a backend is put to.
132
146
 
133
147
  Can either be used in a context, with the callback being
@@ -57,7 +57,7 @@ class Signal(Device, Generic[T]):
57
57
 
58
58
  def __init__(
59
59
  self,
60
- backend: SignalBackend[T],
60
+ backend: Optional[SignalBackend[T]] = None,
61
61
  timeout: Optional[float] = DEFAULT_TIMEOUT,
62
62
  name: str = "",
63
63
  ) -> None:
@@ -66,13 +66,24 @@ class Signal(Device, Generic[T]):
66
66
  super().__init__(name)
67
67
 
68
68
  async def connect(
69
- self, mock=False, timeout=DEFAULT_TIMEOUT, force_reconnect: bool = False
69
+ self,
70
+ mock=False,
71
+ timeout=DEFAULT_TIMEOUT,
72
+ force_reconnect: bool = False,
73
+ backend: Optional[SignalBackend[T]] = None,
70
74
  ):
75
+ if backend:
76
+ if self._initial_backend and backend is not self._initial_backend:
77
+ raise ValueError(
78
+ "Backend at connection different from initialised one."
79
+ )
80
+ self._backend = backend
71
81
  if mock and not isinstance(self._backend, MockSignalBackend):
72
82
  # Using a soft backend, look to the initial value
73
- self._backend = MockSignalBackend(
74
- initial_backend=self._initial_backend,
75
- )
83
+ self._backend = MockSignalBackend(initial_backend=self._backend)
84
+
85
+ if self._backend is None:
86
+ raise RuntimeError("`connect` called on signal without backend")
76
87
  self.log.debug(f"Connecting to {self.source}")
77
88
  await self._backend.connect(timeout=timeout)
78
89
 
@@ -283,15 +294,15 @@ def soft_signal_r_and_setter(
283
294
 
284
295
 
285
296
  def _generate_assert_error_msg(
286
- name: str, expected_result: str, actuall_result: str
297
+ name: str, expected_result: str, actual_result: str
287
298
  ) -> str:
288
299
  WARNING = "\033[93m"
289
300
  FAIL = "\033[91m"
290
301
  ENDC = "\033[0m"
291
302
  return (
292
303
  f"Expected {WARNING}{name}{ENDC} to produce"
293
- + f"\n{FAIL}{actuall_result}{ENDC}"
294
- + f"\nbut actually got \n{FAIL}{expected_result}{ENDC}"
304
+ + f"\n{FAIL}{expected_result}{ENDC}"
305
+ + f"\nbut actually got \n{FAIL}{actual_result}{ENDC}"
295
306
  )
296
307
 
297
308
 
@@ -313,7 +324,9 @@ async def assert_value(signal: SignalR[T], value: Any) -> None:
313
324
  """
314
325
  actual_value = await signal.get_value()
315
326
  assert actual_value == value, _generate_assert_error_msg(
316
- signal.name, value, actual_value
327
+ name=signal.name,
328
+ expected_result=value,
329
+ actual_result=actual_value,
317
330
  )
318
331
 
319
332
 
@@ -338,7 +351,9 @@ async def assert_reading(
338
351
  """
339
352
  actual_reading = await readable.read()
340
353
  assert expected_reading == actual_reading, _generate_assert_error_msg(
341
- readable.name, expected_reading, actual_reading
354
+ name=readable.name,
355
+ expected_result=expected_reading,
356
+ actual_result=actual_reading,
342
357
  )
343
358
 
344
359
 
@@ -364,7 +379,9 @@ async def assert_configuration(
364
379
  """
365
380
  actual_configurable = await configurable.read_configuration()
366
381
  assert configuration == actual_configurable, _generate_assert_error_msg(
367
- configurable.name, configuration, actual_configurable
382
+ name=configurable.name,
383
+ expected_result=configuration,
384
+ actual_result=actual_configurable,
368
385
  )
369
386
 
370
387
 
@@ -386,11 +403,15 @@ def assert_emitted(docs: Mapping[str, list[dict]], **numbers: int):
386
403
  resource=1, datum=1, event=1, stop=1)
387
404
  """
388
405
  assert list(docs) == list(numbers), _generate_assert_error_msg(
389
- "documents", list(numbers), list(docs)
406
+ name="documents",
407
+ expected_result=list(numbers),
408
+ actual_result=list(docs),
390
409
  )
391
410
  actual_numbers = {name: len(d) for name, d in docs.items()}
392
411
  assert actual_numbers == numbers, _generate_assert_error_msg(
393
- "emitted", numbers, actual_numbers
412
+ name="emitted",
413
+ expected_result=numbers,
414
+ actual_result=actual_numbers,
394
415
  )
395
416
 
396
417
 
@@ -14,7 +14,7 @@ class SignalBackend(Generic[T]):
14
14
 
15
15
  #: Like ca://PV_PREFIX:SIGNAL
16
16
  @abstractmethod
17
- def source(name: str) -> str:
17
+ def source(self, name: str) -> str:
18
18
  """Return source of signal. Signals may pass a name to the backend, which can be
19
19
  used or discarded."""
20
20
 
@@ -254,6 +254,8 @@ class HintedSignal(HasHints, AsyncReadable):
254
254
 
255
255
  @property
256
256
  def hints(self) -> Hints:
257
+ if self.signal.name == "":
258
+ return {"fields": []}
257
259
  return {"fields": [self.signal.name]}
258
260
 
259
261
  @classmethod
@@ -2,8 +2,10 @@ import logging
2
2
  import sys
3
3
  from dataclasses import dataclass
4
4
  from enum import Enum
5
- from typing import Any, Dict, Optional, Sequence, Type, Union
5
+ from math import isnan, nan
6
+ from typing import Any, Dict, List, Optional, Type, Union
6
7
 
8
+ import numpy as np
7
9
  from aioca import (
8
10
  FORMAT_CTRL,
9
11
  FORMAT_RAW,
@@ -28,7 +30,7 @@ from ophyd_async.core import (
28
30
  )
29
31
  from ophyd_async.core.utils import DEFAULT_TIMEOUT, NotConnected
30
32
 
31
- from .common import get_supported_values
33
+ from .common import LimitPair, Limits, common_meta, get_supported_values
32
34
 
33
35
  dbr_to_dtype: Dict[Dbr, Dtype] = {
34
36
  dbr.DBR_STRING: "string",
@@ -40,6 +42,64 @@ dbr_to_dtype: Dict[Dbr, Dtype] = {
40
42
  }
41
43
 
42
44
 
45
+ def _data_key_from_augmented_value(
46
+ value: AugmentedValue,
47
+ *,
48
+ choices: Optional[List[str]] = None,
49
+ dtype: Optional[str] = None,
50
+ ) -> DataKey:
51
+ """Use the return value of get with FORMAT_CTRL to construct a DataKey
52
+ describing the signal. See docstring of AugmentedValue for expected
53
+ value fields by DBR type.
54
+
55
+ Args:
56
+ value (AugmentedValue): Description of the the return type of a DB record
57
+ choices: Optional list of enum choices to pass as metadata in the datakey
58
+ dtype: Optional override dtype when AugmentedValue is ambiguous, e.g. booleans
59
+
60
+ Returns:
61
+ DataKey: A rich DataKey describing the DB record
62
+ """
63
+ source = f"ca://{value.name}"
64
+ assert value.ok, f"Error reading {source}: {value}"
65
+
66
+ scalar = value.element_count == 1
67
+ dtype = dtype or dbr_to_dtype[value.datatype]
68
+
69
+ d = DataKey(
70
+ source=source,
71
+ dtype=dtype if scalar else "array",
72
+ # strictly value.element_count >= len(value)
73
+ shape=[] if scalar else [len(value)],
74
+ )
75
+ for key in common_meta:
76
+ attr = getattr(value, key, nan)
77
+ if isinstance(attr, str) or not isnan(attr):
78
+ d[key] = attr
79
+
80
+ if choices is not None:
81
+ d["choices"] = choices
82
+
83
+ if limits := _limits_from_augmented_value(value):
84
+ d["limits"] = limits
85
+
86
+ return d
87
+
88
+
89
+ def _limits_from_augmented_value(value: AugmentedValue) -> Limits:
90
+ def get_limits(limit: str) -> LimitPair:
91
+ low = getattr(value, f"lower_{limit}_limit", None)
92
+ high = getattr(value, f"upper_{limit}_limit", None)
93
+ return LimitPair(low=low, high=high)
94
+
95
+ return Limits(
96
+ alarm=get_limits("alarm"),
97
+ control=get_limits("ctrl"),
98
+ display=get_limits("disp"),
99
+ warning=get_limits("warning"),
100
+ )
101
+
102
+
43
103
  @dataclass
44
104
  class CaConverter:
45
105
  read_dbr: Optional[Dbr]
@@ -49,7 +109,10 @@ class CaConverter:
49
109
  return value
50
110
 
51
111
  def value(self, value: AugmentedValue):
52
- return value
112
+ # for channel access ca_xxx classes, this
113
+ # invokes __pos__ operator to return an instance of
114
+ # the builtin base class
115
+ return +value
53
116
 
54
117
  def reading(self, value: AugmentedValue):
55
118
  return {
@@ -58,8 +121,8 @@ class CaConverter:
58
121
  "alarm_severity": -1 if value.severity > 2 else value.severity,
59
122
  }
60
123
 
61
- def get_datakey(self, source: str, value: AugmentedValue) -> DataKey:
62
- return {"source": source, "dtype": dbr_to_dtype[value.datatype], "shape": []}
124
+ def get_datakey(self, value: AugmentedValue) -> DataKey:
125
+ return _data_key_from_augmented_value(value)
63
126
 
64
127
 
65
128
  class CaLongStrConverter(CaConverter):
@@ -73,12 +136,17 @@ class CaLongStrConverter(CaConverter):
73
136
 
74
137
 
75
138
  class CaArrayConverter(CaConverter):
76
- def get_datakey(self, source: str, value: AugmentedValue) -> DataKey:
77
- return {"source": source, "dtype": "array", "shape": [len(value)]}
139
+ def value(self, value: AugmentedValue):
140
+ return np.array(value, copy=False)
78
141
 
79
142
 
80
143
  @dataclass
81
144
  class CaEnumConverter(CaConverter):
145
+ """To prevent issues when a signal is restarted and returns with different enum
146
+ values or orders, we put treat an Enum signal as a string, and cache the
147
+ choices on this class.
148
+ """
149
+
82
150
  choices: dict[str, str]
83
151
 
84
152
  def write_value(self, value: Union[Enum, str]):
@@ -90,13 +158,18 @@ class CaEnumConverter(CaConverter):
90
158
  def value(self, value: AugmentedValue):
91
159
  return self.choices[value]
92
160
 
93
- def get_datakey(self, source: str, value: AugmentedValue) -> DataKey:
94
- return {
95
- "source": source,
96
- "dtype": "string",
97
- "shape": [],
98
- "choices": list(self.choices),
99
- }
161
+ def get_datakey(self, value: AugmentedValue) -> DataKey:
162
+ # Sometimes DBR_TYPE returns as String, must pass choices still
163
+ return _data_key_from_augmented_value(value, choices=list(self.choices.keys()))
164
+
165
+
166
+ @dataclass
167
+ class CaBoolConverter(CaConverter):
168
+ def value(self, value: AugmentedValue) -> bool:
169
+ return bool(value)
170
+
171
+ def get_datakey(self, value: AugmentedValue) -> DataKey:
172
+ return _data_key_from_augmented_value(value, dtype="bool")
100
173
 
101
174
 
102
175
  class DisconnectedCaConverter(CaConverter):
@@ -115,8 +188,10 @@ def make_converter(
115
188
  return CaLongStrConverter()
116
189
  elif is_array and pv_dbr == dbr.DBR_STRING:
117
190
  # Waveform of strings, check we wanted this
118
- if datatype and datatype != Sequence[str]:
119
- raise TypeError(f"{pv} has type [str] not {datatype.__name__}")
191
+ if datatype:
192
+ datatype_dtype = get_dtype(datatype)
193
+ if not datatype_dtype or not np.can_cast(datatype_dtype, np.str_):
194
+ raise TypeError(f"{pv} has type [str] not {datatype.__name__}")
120
195
  return CaArrayConverter(pv_dbr, None)
121
196
  elif is_array:
122
197
  pv_dtype = get_unique({k: v.dtype for k, v in values.items()}, "dtypes")
@@ -136,7 +211,7 @@ def make_converter(
136
211
  )
137
212
  if pv_choices_len != 2:
138
213
  raise TypeError(f"{pv} has {pv_choices_len} choices, can't map to bool")
139
- return CaConverter(dbr.DBR_SHORT, dbr.DBR_SHORT)
214
+ return CaBoolConverter(dbr.DBR_SHORT, dbr.DBR_SHORT)
140
215
  elif pv_dbr == dbr.DBR_ENUM:
141
216
  # This is an Enum
142
217
  pv_choices = get_unique(
@@ -224,7 +299,7 @@ class CaSignalBackend(SignalBackend[T]):
224
299
 
225
300
  async def get_datakey(self, source: str) -> DataKey:
226
301
  value = await self._caget(FORMAT_CTRL)
227
- return self.converter.get_datakey(source, value)
302
+ return self.converter.get_datakey(value)
228
303
 
229
304
  async def get_reading(self) -> Reading:
230
305
  value = await self._caget(FORMAT_TIME)