apsbits 1.0.4__tar.gz → 1.0.5__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 (132) hide show
  1. {apsbits-1.0.4 → apsbits-1.0.5}/HISTORY.rst +17 -1
  2. {apsbits-1.0.4/apsbits.egg-info → apsbits-1.0.5}/PKG-INFO +2 -2
  3. {apsbits-1.0.4 → apsbits-1.0.5/apsbits.egg-info}/PKG-INFO +2 -2
  4. {apsbits-1.0.4 → apsbits-1.0.5}/apsbits.egg-info/SOURCES.txt +1 -0
  5. {apsbits-1.0.4 → apsbits-1.0.5}/apsbits.egg-info/requires.txt +1 -1
  6. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/creating_devices.rst +14 -22
  7. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/sessions.rst +22 -0
  8. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/startup.rst +42 -2
  9. {apsbits-1.0.4 → apsbits-1.0.5}/pyproject.toml +1 -1
  10. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/_version.py +2 -2
  11. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/core/instrument_init.py +23 -21
  12. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/core/run_engine_init.py +1 -2
  13. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/configs/devices.yml +4 -5
  14. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/configs/devices_aps_only.yml +3 -1
  15. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/configs/iconfig.yml +8 -2
  16. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/startup.py +5 -0
  17. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_qserver/qs-config.yml +0 -9
  18. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_config.py +6 -4
  19. apsbits-1.0.5/src/apsbits/utils/baseline_setup.py +104 -0
  20. {apsbits-1.0.4 → apsbits-1.0.5}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  21. {apsbits-1.0.4 → apsbits-1.0.5}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {apsbits-1.0.4 → apsbits-1.0.5}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  23. {apsbits-1.0.4 → apsbits-1.0.5}/.github/ISSUE_TEMPLATE/other.md +0 -0
  24. {apsbits-1.0.4 → apsbits-1.0.5}/.github/ISSUE_TEMPLATE/question-issue-template.md +0 -0
  25. {apsbits-1.0.4 → apsbits-1.0.5}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  26. {apsbits-1.0.4 → apsbits-1.0.5}/.github/dependabot.yml +0 -0
  27. {apsbits-1.0.4 → apsbits-1.0.5}/.github/workflows/code.yml +0 -0
  28. {apsbits-1.0.4 → apsbits-1.0.5}/.github/workflows/docs.yml +0 -0
  29. {apsbits-1.0.4 → apsbits-1.0.5}/.github/workflows/pypi.yml +0 -0
  30. {apsbits-1.0.4 → apsbits-1.0.5}/.gitignore +0 -0
  31. {apsbits-1.0.4 → apsbits-1.0.5}/.pre-commit-config.yaml +0 -0
  32. {apsbits-1.0.4 → apsbits-1.0.5}/LICENSE +0 -0
  33. {apsbits-1.0.4 → apsbits-1.0.5}/README.md +0 -0
  34. {apsbits-1.0.4 → apsbits-1.0.5}/apsbits.egg-info/dependency_links.txt +0 -0
  35. {apsbits-1.0.4 → apsbits-1.0.5}/apsbits.egg-info/entry_points.txt +0 -0
  36. {apsbits-1.0.4 → apsbits-1.0.5}/apsbits.egg-info/top_level.txt +0 -0
  37. {apsbits-1.0.4 → apsbits-1.0.5}/docs/Makefile +0 -0
  38. {apsbits-1.0.4 → apsbits-1.0.5}/docs/make.bat +0 -0
  39. {apsbits-1.0.4 → apsbits-1.0.5}/docs/resources/create-repository-name.webp +0 -0
  40. {apsbits-1.0.4 → apsbits-1.0.5}/docs/resources/create-repository-owner.webp +0 -0
  41. {apsbits-1.0.4 → apsbits-1.0.5}/docs/resources/demo.ipynb +0 -0
  42. {apsbits-1.0.4 → apsbits-1.0.5}/docs/resources/use-this-template-button.webp +0 -0
  43. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/_static/.gitkeep +0 -0
  44. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/api.rst +0 -0
  45. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/core.rst +0 -0
  46. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/demo_instrument.rst +0 -0
  47. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/demo_qserver.rst +0 -0
  48. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.core.best_effort_init.rst +0 -0
  49. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.core.catalog_init.rst +0 -0
  50. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.core.run_engine_init.rst +0 -0
  51. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.callbacks.nexus_data_file_writer.rst +0 -0
  52. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.callbacks.rst +0 -0
  53. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.callbacks.spec_data_file_writer.rst +0 -0
  54. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.configs.rst +0 -0
  55. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.devices.rst +0 -0
  56. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.plans.dm_plans.rst +0 -0
  57. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.plans.rst +0 -0
  58. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.plans.sim_plans.rst +0 -0
  59. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.rst +0 -0
  60. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_instrument.startup.rst +0 -0
  61. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.demo_qserver.rst +0 -0
  62. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.aps_functions.rst +0 -0
  63. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.config_loaders.rst +0 -0
  64. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.controls_setup.rst +0 -0
  65. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.helper_functions.rst +0 -0
  66. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.logging_setup.rst +0 -0
  67. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.metadata.rst +0 -0
  68. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/generated/apsbits.utils.stored_dict.rst +0 -0
  69. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/index.rst +0 -0
  70. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/api/utils.rst +0 -0
  71. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/bits_overview.rst +0 -0
  72. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/conf.py +0 -0
  73. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/deprecated/console.rst +0 -0
  74. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/deprecated/dm.md +0 -0
  75. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/deprecated/logging_config.rst +0 -0
  76. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/deprecated/notebook.rst +0 -0
  77. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/deprecated/script.rst +0 -0
  78. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/creating_instrument.rst +0 -0
  79. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/developing_bits.rst +0 -0
  80. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/dm.rst +0 -0
  81. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/index.rst +0 -0
  82. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/logging.rst +0 -0
  83. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/qserver.rst +0 -0
  84. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/qserver_service.rst +0 -0
  85. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/setting_iconfig.rst +0 -0
  86. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/guides/template_creation.rst +0 -0
  87. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/history.rst +0 -0
  88. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/index.rst +0 -0
  89. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/install.rst +0 -0
  90. {apsbits-1.0.4 → apsbits-1.0.5}/docs/source/license.rst +0 -0
  91. {apsbits-1.0.4 → apsbits-1.0.5}/setup.cfg +0 -0
  92. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/__init__.py +0 -0
  93. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/api/__init__.py +0 -0
  94. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/api/create_new_instrument.py +0 -0
  95. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/api/delete_instrument.py +0 -0
  96. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/api/run_instrument.py +0 -0
  97. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/configs/logging.yml +0 -0
  98. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/core/__init__.py +0 -0
  99. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/core/best_effort_init.py +0 -0
  100. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/core/catalog_init.py +0 -0
  101. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/README.md +0 -0
  102. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/__init__.py +0 -0
  103. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/callbacks/__init__.py +0 -0
  104. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/callbacks/nexus_data_file_writer.py +0 -0
  105. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/callbacks/spec_data_file_writer.py +0 -0
  106. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/configs/__init__.py +0 -0
  107. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/configs/extra_logging.yml +0 -0
  108. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/devices/__init__.py +0 -0
  109. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/plans/__init__.py +0 -0
  110. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/plans/dm_plans.py +0 -0
  111. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/plans/sim_plans.py +0 -0
  112. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/suspenders/__init__.py +0 -0
  113. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_instrument/utils/__init__.py +0 -0
  114. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_qserver/qs_host.sh +0 -0
  115. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/demo_qserver/user_group_permissions.yaml +0 -0
  116. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/__init__.py +0 -0
  117. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/conftest.py +0 -0
  118. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_delete_instrument.py +0 -0
  119. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_device_factories.py +0 -0
  120. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_general.py +0 -0
  121. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_make_devices.py +0 -0
  122. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_run_instrument.py +0 -0
  123. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/tests/test_stored_dict.py +0 -0
  124. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/__init__.py +0 -0
  125. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/aps_functions.py +0 -0
  126. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/config_loaders.py +0 -0
  127. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/controls_setup.py +0 -0
  128. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/helper_functions.py +0 -0
  129. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/logging_setup.py +0 -0
  130. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/metadata.py +0 -0
  131. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/sim_creator.py +0 -0
  132. {apsbits-1.0.4 → apsbits-1.0.5}/src/apsbits/utils/stored_dict.py +0 -0
@@ -30,11 +30,27 @@ describe future plans.
30
30
  .. Coming release content can be gathered here.
31
31
  Some people object to publishing unreleased changes.
32
32
 
33
- 1.0.4
33
+ 1.1.0
34
34
  #####
35
35
 
36
36
  release expected ?
37
37
 
38
+ New Features
39
+ ---------------
40
+
41
+ * Hoist support to setup baseline stream using labels kwarg from USAXS.
42
+
43
+ Maintenance
44
+ ---------------
45
+
46
+ * Bump iconfig version to 2.0.1 for the baseline addition.
47
+ * Remove run_engine section from QS config.yml file and pin QS to 0.0.22+.
48
+
49
+ 1.0.4
50
+ #####
51
+
52
+ released 2025-05-14
53
+
38
54
  1.0.3
39
55
  #####
40
56
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsbits
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: Model of a Bluesky Data Acquisition Instrument in console, notebook, & queueserver.
5
5
  Author-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
6
6
  Maintainer-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
@@ -19,7 +19,7 @@ Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: apstools>=1.7.2
21
21
  Requires-Dist: bluesky-queueserver-api
22
- Requires-Dist: bluesky-queueserver
22
+ Requires-Dist: bluesky-queueserver>=0.0.22
23
23
  Requires-Dist: bluesky-widgets
24
24
  Requires-Dist: bluesky
25
25
  Requires-Dist: caproto
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apsbits
3
- Version: 1.0.4
3
+ Version: 1.0.5
4
4
  Summary: Model of a Bluesky Data Acquisition Instrument in console, notebook, & queueserver.
5
5
  Author-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
6
6
  Maintainer-email: Eric Codrea <ecodrea@anl.gov>, Pete Jemian <prjemian+instrument@gmail.com>, Rafael Vescovi <rvescovi@anl.gov>
@@ -19,7 +19,7 @@ Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
20
  Requires-Dist: apstools>=1.7.2
21
21
  Requires-Dist: bluesky-queueserver-api
22
- Requires-Dist: bluesky-queueserver
22
+ Requires-Dist: bluesky-queueserver>=0.0.22
23
23
  Requires-Dist: bluesky-widgets
24
24
  Requires-Dist: bluesky
25
25
  Requires-Dist: caproto
@@ -120,6 +120,7 @@ src/apsbits/tests/test_run_instrument.py
120
120
  src/apsbits/tests/test_stored_dict.py
121
121
  src/apsbits/utils/__init__.py
122
122
  src/apsbits/utils/aps_functions.py
123
+ src/apsbits/utils/baseline_setup.py
123
124
  src/apsbits/utils/config_loaders.py
124
125
  src/apsbits/utils/controls_setup.py
125
126
  src/apsbits/utils/helper_functions.py
@@ -1,6 +1,6 @@
1
1
  apstools>=1.7.2
2
2
  bluesky-queueserver-api
3
- bluesky-queueserver
3
+ bluesky-queueserver>=0.0.22
4
4
  bluesky-widgets
5
5
  bluesky
6
6
  caproto
@@ -46,32 +46,24 @@ You can also add a device from an external package to the ``devices.yml`` file.
46
46
  prefix: ioc:Slit1
47
47
  labels: ["slits"]
48
48
 
49
- 2. Make sure all your device files are loaded on the ``iconfig.yml`` file.
50
-
51
- .. code-block:: yaml
52
-
53
- DEVICES_FILES:
54
- - devices.yml
55
- APS_DEVICES_FILES:
56
- - devices_aps_only.yml
57
-
58
- Note that the ``devices.yml`` file is loaded by default and the ``devices_aps_only.yml`` file is only loaded if the device is on the APS network.
59
49
 
60
50
  .. tip::
61
- All kwargs of your device can be specified in the yaml file making it easy to resuse classes.
51
+ `APSTOOLS <https://github.com/BCDA-APS/apstools/tree/main/apstools>`_ has a lot of devices commonly used at the APS. Consider first checking the package and overwriting the device class to fit your needs before creating a new device.
62
52
 
63
53
  .. tip::
64
- You can add any number of device files inside the iconfig file used by your instrument ``startup.py`` file. Just add another entry to the list.
54
+ You can add the `label: baseline` to any device in your configuration to automatically track its state during scans. This is particularly useful for monitoring environmental conditions or instrument parameters. For example:
65
55
 
66
- .. code-block:: yaml
56
+ .. code-block:: yaml
67
57
 
68
- ### Local OPHYD Device Control Yaml
69
- DEVICES_FILES:
70
- - devices.yml ## standard device file
71
- - devices_2.yml ## another device file
72
- APS_DEVICES_FILES:
73
- - devices_aps_only.yml ## APS only device file
74
- - devices_aps_only_2.yml ## another APS only device file
58
+ apstools.devices.ApsMachineParametersDevice:
59
+ - name: aps
60
+ labels:
61
+ - baseline
75
62
 
76
- .. tip::
77
- `APSTOOLS <https://github.com/BCDA-APS/apstools/tree/main/apstools>`_ has a lot of devices commonly used at the APS. Consider first checking the package and overwriting the device class to fit your needs before creating a new device.
63
+ ophyd.EpicsSignalRO:
64
+ - name: temperature_monitor
65
+ prefix: "IOC:TEMP"
66
+ labels:
67
+ - baseline
68
+
69
+ Baseline devices will be automatically included in the metadata of each scan, making it easy to track changes in environmental conditions or instrument parameters over time.
@@ -35,4 +35,26 @@ When ready to load the bluesky data acquisition for use, type this command. For
35
35
 
36
36
  .. code-block:: bash
37
37
 
38
+ from demo_instrument.startup import *
39
+
40
+ .. note::
41
+ Change the demo_instrument to your instrument installed package name.
42
+
43
+ Adding BITS to ipython profile
44
+ ----------------------------------
45
+
46
+ To add BITS to your ipython profile, first create a new profile:
47
+
48
+ .. code-block:: bash
49
+
50
+ ipython profile create bits-xx
51
+
52
+ Then, add the following to your startup file:
53
+
54
+ .. code-block:: bash
55
+
56
+ cat > ~/.ipython/profile_bits-xx/startup/00-start-bits.py << EOF
38
57
  from new_instrument.startup import *
58
+ EOF
59
+
60
+ For more detailed guidance on creating and configuring an ipython profile, see the `bluesky training documentation <https://github.com/BCDA-APS/bluesky_training/blob/304b8d02503044932afa5657cb43afd1f6be2f40/docs/source/instrument/_create_bluesky_ipython_profile.rst#L2>`_.
@@ -52,7 +52,6 @@ Tips:
52
52
  * Create an extra_logging.yml file if you need custom logging configuration
53
53
  * The default logging setup from apsbits will be used if no extra configuration is provided
54
54
 
55
-
56
55
  Data Management Setup
57
56
  ~~~~~~~~~~~~~~~~~~~
58
57
 
@@ -129,10 +128,51 @@ Device Loading
129
128
  if host_on_aps_subnet():
130
129
  RE(make_devices(clear=False, file="device_aps_only.yml"))
131
130
 
131
+ This block:
132
+ * Loads the main device configuration from devices.yml
133
+ * Optionally loads APS-specific devices from devices_aps_only.yml if running on APS subnet
134
+ * Uses clear=False to preserve existing devices
135
+
132
136
  Tips:
133
137
  * Create a devices.yml file with your instrument's device configurations
134
138
  * Optionally create device_aps_only.yml for APS-specific devices
135
- * Set clear=False to preserve existing devices
139
+ * The make_devices function will automatically register devices with the ophyd registry
140
+
141
+ Baseline Device Setup
142
+ ~~~~~~~~~~~~~~~~~~~
143
+
144
+ The baseline device setup allows you to track and record the state of specific devices during each scan. This is particularly useful for monitoring environmental conditions or instrument parameters that might affect your measurements.
145
+
146
+ To configure baseline devices:
147
+
148
+ 1. In your devices.yml file, add a `label: baseline` to any device you want to track:
149
+
150
+ .. code-block:: yaml
151
+
152
+ apstools.devices.ApsMachineParametersDevice:
153
+ - name: aps
154
+ labels:
155
+ - baseline
156
+
157
+ ophyd.EpicsSignalRO:
158
+ - name: temperature_monitor
159
+ prefix: "IOC:TEMP"
160
+ labels:
161
+ - baseline
162
+
163
+ 2. The baseline devices will be automatically included in the metadata of each scan through the setup_baseline_stream function:
164
+
165
+ .. code-block:: python
166
+
167
+ setup_baseline_stream(sd, oregistry, connect=False)
168
+
169
+ 3. You can access baseline device values in your analysis using the scan metadata.
170
+
171
+ Tips:
172
+ * Use baseline devices for monitoring critical environmental parameters
173
+ * Consider including timestamps, temperature, pressure, or other relevant measurements
174
+ * Baseline devices should be read-only to avoid accidental modifications
175
+ * Keep the number of baseline devices reasonable to avoid excessive data collection
136
176
 
137
177
  Configuration Tips
138
178
  ----------------
@@ -35,7 +35,7 @@ classifiers = [
35
35
  dependencies = [
36
36
  "apstools >= 1.7.2",
37
37
  "bluesky-queueserver-api",
38
- "bluesky-queueserver",
38
+ "bluesky-queueserver >=0.0.22",
39
39
  "bluesky-widgets",
40
40
  "bluesky",
41
41
  "caproto",
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '1.0.4'
21
- __version_tuple__ = version_tuple = (1, 0, 4)
20
+ __version__ = version = '1.0.5'
21
+ __version_tuple__ = version_tuple = (1, 0, 5)
@@ -62,6 +62,22 @@ def make_devices(
62
62
 
63
63
  logger.debug("(Re)Loading local control objects.")
64
64
 
65
+ if file is None:
66
+ logger.error("No custom device file provided.")
67
+ return
68
+
69
+ if path is None:
70
+ iconfig = get_config()
71
+ instrument_path = pathlib.Path(iconfig.get("INSTRUMENT_PATH")).parent
72
+ configs_path = instrument_path / "configs"
73
+ logger.info(
74
+ f"No custom path provided.\n\nUsing default configs path: {configs_path}"
75
+ )
76
+
77
+ else:
78
+ logger.info(f"Using custom path for device files: {path}")
79
+ configs_path = pathlib.Path(path)
80
+
65
81
  if clear:
66
82
  main_namespace = sys.modules[MAIN_NAMESPACE]
67
83
 
@@ -75,27 +91,10 @@ def make_devices(
75
91
 
76
92
  oregistry.clear()
77
93
 
78
- if path is not None and file is None:
79
- raise ValueError(
80
- "When a custom path is provided, a specific device file must"
81
- " also be provided"
82
- )
83
-
84
- if path is not None:
85
- configs_path = pathlib.Path(path)
86
- print(f"\n\nConfigs path: {configs_path}\n\n")
87
-
88
- else:
89
- iconfig = get_config()
90
- instrument_path = pathlib.Path(iconfig.get("INSTRUMENT_PATH")).parent
91
- configs_path = instrument_path / "configs"
92
-
93
- device_file = file
94
-
95
- logger.debug("Loading device files: %r", device_file)
94
+ logger.debug("Loading device files: %r", file)
96
95
 
97
96
  # Load each device file
98
- device_path = configs_path / device_file
97
+ device_path = configs_path / file
99
98
  if not device_path.exists():
100
99
  logger.error("Device file not found: %s", device_path)
101
100
 
@@ -129,14 +128,17 @@ def namespace_loader(yaml_device_file, main=True):
129
128
  logger.debug("Devices file %r.", str(yaml_device_file))
130
129
  t0 = time.time()
131
130
 
131
+ current_devices = oregistry.device_names
132
+
132
133
  instrument.load(yaml_device_file)
133
134
 
134
135
  logger.info("Devices loaded in %.3f s.", time.time() - t0)
135
136
  if main:
136
137
  main_namespace = sys.modules[MAIN_NAMESPACE]
137
- for label in oregistry.device_names:
138
+ for label in sorted(oregistry.device_names):
139
+ if label in current_devices:
140
+ continue
138
141
  logger.info("Adding ophyd device %r to main namespace", label)
139
-
140
142
  setattr(main_namespace, label, oregistry[label])
141
143
 
142
144
 
@@ -7,7 +7,7 @@ Bluesky RunEngine with metadata storage, subscriptions, and various
7
7
  settings based on a configuration dictionary.
8
8
 
9
9
  .. autosummary::
10
- init_RE
10
+ ~init_RE
11
11
  """
12
12
 
13
13
  import logging
@@ -113,7 +113,6 @@ def init_RE(
113
113
  RE.subscribe(cat_instance.v1.insert)
114
114
  if bec_instance is not None:
115
115
  RE.subscribe(bec_instance)
116
- RE.preprocessors.append(sd)
117
116
 
118
117
  scan_id_pv = iconfig.get("RUN_ENGINE", {}).get("SCAN_ID_PV")
119
118
  connect_scan_id_pv(RE, pv=scan_id_pv)
@@ -1,13 +1,12 @@
1
1
  # Guarneri-style device YAML configuration
2
2
 
3
3
  apsbits.utils.sim_creator.predefined_device:
4
- - {creator: ophyd.sim.motor, name: sim_motor}
5
- - {creator: ophyd.sim.noisy_det, name: sim_det}
4
+ - { creator: ophyd.sim.motor, name: sim_motor }
5
+ - { creator: ophyd.sim.noisy_det, name: sim_det }
6
6
 
7
7
  apstools.devices.SimulatedApsPssShutterWithStatus:
8
8
  - name: shutter
9
- labels: ["shutters"]
10
-
9
+ labels: [ "shutters", "baseline" ]
11
10
 
12
11
  ## THIS ARE EXAMPLES OF OTHER DEVICES THAT YOU CAN USE
13
12
  # ophyd.Signal:
@@ -19,7 +18,7 @@ apstools.devices.SimulatedApsPssShutterWithStatus:
19
18
  # apstools.synApps.Optics2Slit2D_HV:
20
19
  # - name: slit1
21
20
  # prefix: ioc:Slit1
22
- # labels: ["slits"]
21
+ # labels: ["slits", "baseline"]
23
22
 
24
23
  # hkl.SimulatedE4CV:
25
24
  # - name: sim4c
@@ -3,4 +3,6 @@
3
3
  # Objects only available at APS
4
4
 
5
5
  apstools.devices.ApsMachineParametersDevice:
6
- - name: aps
6
+ - name: aps
7
+ labels:
8
+ - baseline
@@ -1,7 +1,7 @@
1
1
  # Configuration for the Bluesky instrument package.
2
2
 
3
3
  # identify the version of this iconfig.yml file
4
- ICONFIG_VERSION: 2.0.0
4
+ ICONFIG_VERSION: 2.0.1
5
5
 
6
6
  # Add additional configuration for use with your instrument.
7
7
 
@@ -29,6 +29,12 @@ RUN_ENGINE:
29
29
  ### Default: False
30
30
  USE_PROGRESS_BAR: false
31
31
 
32
+ ### Baseline stream
33
+ ### When ENABLE=true, all ophyd objects with a "baseline" label
34
+ ### will be added to the baseline stream.
35
+ BASELINE_LABEL:
36
+ ENABLE: true
37
+
32
38
  ### Best Effort Callback Configurations
33
39
  ### Defaults: all true
34
40
  ### except no plots in queueserver
@@ -50,7 +56,7 @@ SPEC_DATA_FILES:
50
56
  FILE_EXTENSION: dat
51
57
 
52
58
  ### APS Data Management
53
- ### Use bash shell, deactivate all conda environments, source this file:
59
+ ### Learn environment variables for Data Management from this file:
54
60
  DM_SETUP_FILE: "/home/dm/etc/dm.setup.sh"
55
61
 
56
62
  # ----------------------------------
@@ -24,6 +24,7 @@ from apsbits.core.run_engine_init import init_RE
24
24
  # Utility functions
25
25
  from apsbits.utils.aps_functions import aps_dm_setup
26
26
  from apsbits.utils.aps_functions import host_on_aps_subnet
27
+ from apsbits.utils.baseline_setup import setup_baseline_stream
27
28
 
28
29
  # Configuration functions
29
30
  from apsbits.utils.config_loaders import load_config
@@ -104,3 +105,7 @@ RE(make_devices(clear=False, file="devices.yml")) # Create the devices.
104
105
 
105
106
  if host_on_aps_subnet():
106
107
  RE(make_devices(clear=False, file="devices_aps_only.yml"))
108
+
109
+ # Setup baseline stream with connect=False is default
110
+ # Devices with the label 'baseline' will be added to the baseline stream.
111
+ setup_baseline_stream(sd, oregistry, connect=False)
@@ -30,15 +30,6 @@ operation:
30
30
  # choices: NEVER ON_REQUEST ON_STARTUP
31
31
  user_group_permissions_reload: ON_STARTUP
32
32
 
33
- run_engine:
34
- # databroker_config: name_of_databroker_config_file
35
-
36
- # kafka_server: 127.0.0.1:9092
37
- # kafka_topic: custom_topic_name
38
-
39
- use_persistent_metadata: true
40
- zmq_data_proxy_addr: localhost:5567
41
-
42
33
  startup:
43
34
  keep_re: true
44
35
  startup_module: demo_instrument.startup
@@ -15,12 +15,14 @@ from apsbits.utils.config_loaders import load_config
15
15
  if TYPE_CHECKING:
16
16
  pass
17
17
 
18
+ ICONFIG_VERSION_NOW: str = "2.0.1"
19
+
18
20
 
19
21
  @pytest.fixture
20
22
  def yml_config_file():
21
23
  """Create a temporary YAML configuration file."""
22
24
  config = {
23
- "ICONFIG_VERSION": "2.0.0",
25
+ "ICONFIG_VERSION": ICONFIG_VERSION_NOW,
24
26
  "DATABROKER_CATALOG": "temp",
25
27
  "test_key": "test_value",
26
28
  }
@@ -37,7 +39,7 @@ def yml_config_file():
37
39
  def toml_config_file():
38
40
  """Create a temporary TOML configuration file."""
39
41
  config = {
40
- "ICONFIG_VERSION": "2.0.0",
42
+ "ICONFIG_VERSION": ICONFIG_VERSION_NOW,
41
43
  "DATABROKER_CATALOG": "temp",
42
44
  "test_key": "test_value",
43
45
  }
@@ -58,7 +60,7 @@ def test_load_yaml_config(yml_config_file: pathlib.Path) -> None:
58
60
  yml_config_file: Path to the temporary YAML configuration file.
59
61
  """
60
62
  config = load_config(yml_config_file)
61
- assert config["ICONFIG_VERSION"] == "2.0.0"
63
+ assert config["ICONFIG_VERSION"] == ICONFIG_VERSION_NOW
62
64
  assert config["DATABROKER_CATALOG"] == "temp"
63
65
  assert config["test_key"] == "test_value"
64
66
 
@@ -71,7 +73,7 @@ def test_load_toml_config(toml_config_file: pathlib.Path) -> None:
71
73
  toml_config_file: Path to the temporary TOML configuration file.
72
74
  """
73
75
  config = load_config(toml_config_file)
74
- assert config["ICONFIG_VERSION"] == "2.0.0"
76
+ assert config["ICONFIG_VERSION"] == ICONFIG_VERSION_NOW
75
77
  assert config["DATABROKER_CATALOG"] == "temp"
76
78
  assert config["test_key"] == "test_value"
77
79
 
@@ -0,0 +1,104 @@
1
+ """
2
+ Setup all configured ophyd items for the baseline stream.
3
+
4
+ .. autosummary::
5
+ ~setup_baseline_stream
6
+ """
7
+
8
+ import logging
9
+
10
+ import bluesky
11
+ import guarneri
12
+
13
+ from apsbits.utils.config_loaders import get_config
14
+
15
+ logger = logging.getLogger(__name__)
16
+ logger.bsdev(__file__)
17
+
18
+
19
+ def setup_baseline_stream(
20
+ sd: bluesky.SupplementalData,
21
+ oregistry: guarneri.Instrument,
22
+ connect: bool = False,
23
+ ) -> None:
24
+ """
25
+ Add ophyd objects with 'baseline' label to baseline stream.
26
+
27
+ Call :func:`~apsbits.core.run_engine_init.setup_baseline_stream(sd, iconfig,
28
+ oregistry)` in the startup code after all ophyd objects have been created.
29
+ It is safe to call this function even when no objects are labeled; there are
30
+ checks that return early if not configured. This function should part of
31
+ every startup.
32
+
33
+ To include any ophyd object created after startup has completed, append it
34
+ to the 'sd.baseline' list, such as: ``sd.baseline.append(new_ophyd_object)``
35
+
36
+ Parameters:
37
+
38
+ sd bluesky.SupplementalData :
39
+ Object which contains the list of baseline objects to be published.
40
+ oregistry guarneri.Instrument :
41
+ Registry of ophyd objects.
42
+ connect bool :
43
+ When True (default: False), will wait for connection for all marked
44
+ devices. A warning will be logged for any devices which do not
45
+ connect.
46
+
47
+ .. rubric:: Background
48
+
49
+ The baseline stream records the values of ophyd objects:
50
+
51
+ * at the start and end of a run
52
+ * that are not intended as detectors (or other readables) for the primary stream
53
+ * that may not be suitable to record in the run's metadata
54
+ * for use by post-acquisition processing
55
+
56
+ To enable the assignment of an ophyd object to the baseline stream, add
57
+ "baseline" to its labels kwarg list. On startup, after all the objects have
58
+ been created, use the oregistry to find all the objects with the "baseline"
59
+ label and append each to the sd.baseline list.
60
+
61
+ To learn more about baseline readings and the baseline stream in bluesky, see:
62
+
63
+ * https://blueskyproject.io/bluesky/main/plans.html#supplemental-data
64
+ * https://blueskyproject.io/bluesky/main/metadata.html#recording-metadata
65
+ * https://nsls-ii.github.io/bluesky/tutorial.html#baseline-readings-and-other-supplemental-data
66
+ """
67
+
68
+ iconfig = get_config()
69
+ baseline_config = iconfig.get("BASELINE_LABEL")
70
+ if baseline_config is None:
71
+ logger.info("No baseline configuration found in iconfig.yml file.")
72
+ return
73
+
74
+ if not baseline_config.get("ENABLE", False):
75
+ logger.info("Baseline stream is disabled in iconfig.yml file.")
76
+ return
77
+
78
+ candidates = oregistry.findall("baseline", allow_none=True)
79
+ if candidates is None:
80
+ logger.info("No baseline objects found in oregistry.")
81
+ return
82
+
83
+ if connect:
84
+ # Wait for all objects in parallel.
85
+ for item in candidates:
86
+ try:
87
+ item.wait_for_connection()
88
+ except TimeoutError:
89
+ pass # Check for connection below.
90
+
91
+ troubled = [item for item in candidates if not item.connected]
92
+ for item in troubled:
93
+ logger.warning("Could not connect baseline object: %s", item)
94
+ candidates.remove(item)
95
+ oregistry.pop(item)
96
+
97
+ try:
98
+ logger.info("Adding marked objects to 'baseline' stream.")
99
+ sd.baseline.extend(candidates)
100
+ except Exception as excuse:
101
+ logger.warning(
102
+ "Problem extending 'baseline' stream: %s",
103
+ excuse,
104
+ )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes