hutch-python 1.21.0__tar.gz → 1.22.0__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 (148) hide show
  1. {hutch_python-1.21.0 → hutch_python-1.22.0}/PKG-INFO +2 -2
  2. {hutch_python-1.21.0 → hutch_python-1.22.0}/conda-recipe/meta.yaml +1 -1
  3. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/releases.rst +41 -0
  4. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/yaml_files.rst +28 -3
  5. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/_version.py +2 -2
  6. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/calc_defaults.py +10 -0
  7. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/constants.py +1 -0
  8. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/happi.py +46 -32
  9. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/load_conf.py +16 -1
  10. hutch_python-1.22.0/hutch_python/startup_script.py +49 -0
  11. hutch_python-1.22.0/hutch_python/tests/conf.yaml +15 -0
  12. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_cli.py +3 -1
  13. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_happi.py +27 -6
  14. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/PKG-INFO +2 -2
  15. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/requires.txt +1 -1
  16. {hutch_python-1.21.0 → hutch_python-1.22.0}/requirements.txt +1 -1
  17. hutch_python-1.21.0/hutch_python/startup_script.py +0 -32
  18. hutch_python-1.21.0/hutch_python/tests/conf.yaml +0 -7
  19. {hutch_python-1.21.0 → hutch_python-1.22.0}/.coveragerc +0 -0
  20. {hutch_python-1.21.0 → hutch_python-1.22.0}/.flake8 +0 -0
  21. {hutch_python-1.21.0 → hutch_python-1.22.0}/.git_archival.txt +0 -0
  22. {hutch_python-1.21.0 → hutch_python-1.22.0}/.gitattributes +0 -0
  23. {hutch_python-1.21.0 → hutch_python-1.22.0}/.github/ISSUE_TEMPLATE.md +0 -0
  24. {hutch_python-1.21.0 → hutch_python-1.22.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  25. {hutch_python-1.21.0 → hutch_python-1.22.0}/.github/workflows/standard.yml +0 -0
  26. {hutch_python-1.21.0 → hutch_python-1.22.0}/.gitignore +0 -0
  27. {hutch_python-1.21.0 → hutch_python-1.22.0}/.landscape.yml +0 -0
  28. {hutch_python-1.21.0 → hutch_python-1.22.0}/.pre-commit-config.yaml +0 -0
  29. {hutch_python-1.21.0 → hutch_python-1.22.0}/AUTHORS.rst +0 -0
  30. {hutch_python-1.21.0 → hutch_python-1.22.0}/CONTRIBUTING.rst +0 -0
  31. {hutch_python-1.21.0 → hutch_python-1.22.0}/LICENSE +0 -0
  32. {hutch_python-1.21.0 → hutch_python-1.22.0}/MANIFEST.in +0 -0
  33. {hutch_python-1.21.0 → hutch_python-1.22.0}/README.rst +0 -0
  34. {hutch_python-1.21.0 → hutch_python-1.22.0}/bin/hutch-python +0 -0
  35. {hutch_python-1.21.0 → hutch_python-1.22.0}/dev-requirements.txt +0 -0
  36. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/Makefile +0 -0
  37. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/hutch_python.ipynb +0 -0
  38. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/pre-release-notes.sh +0 -0
  39. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/release_notes.py +0 -0
  40. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/beamline.rst +0 -0
  41. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/bug.rst +0 -0
  42. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/cache.rst +0 -0
  43. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/cli.rst +0 -0
  44. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/conf.py +0 -0
  45. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/daq.rst +0 -0
  46. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/database.rst +0 -0
  47. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/debug.rst +0 -0
  48. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/environment.rst +0 -0
  49. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/experiment.rst +0 -0
  50. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/hutch_setup.rst +0 -0
  51. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/index.rst +0 -0
  52. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/ipython_log.rst +0 -0
  53. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/load_conf.rst +0 -0
  54. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/load_parts.rst +0 -0
  55. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/log_setup.rst +0 -0
  56. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/namespace.rst +0 -0
  57. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/object_configuration.rst +0 -0
  58. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/other_modules.rst +0 -0
  59. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/presets.rst +0 -0
  60. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/report.rst +0 -0
  61. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/start.rst +0 -0
  62. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/startup.rst +0 -0
  63. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/tips.rst +0 -0
  64. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/tutorial.ipynb +0 -0
  65. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/upcoming_release_notes/template-full.rst +0 -0
  66. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/upcoming_release_notes/template-short.rst +0 -0
  67. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/user_utils.rst +0 -0
  68. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs/source/utils.rst +0 -0
  69. {hutch_python-1.21.0 → hutch_python-1.22.0}/docs-requirements.txt +0 -0
  70. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/__init__.py +0 -0
  71. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/__main__.py +0 -0
  72. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/bug.py +0 -0
  73. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cache.py +0 -0
  74. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cam_load.py +0 -0
  75. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cli.py +0 -0
  76. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/cookiecutter.json +0 -0
  77. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/.gitignore +0 -0
  78. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/README.md +0 -0
  79. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/conf.yml +0 -0
  80. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/experiments/__init__.py +0 -0
  81. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/set-dev +0 -0
  82. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/{{ cookiecutter.hutch }}/__init__.py +0 -0
  83. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/{{ cookiecutter.hutch }}/beamline.py +0 -0
  84. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/{{ cookiecutter.hutch }}env +0 -0
  85. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/cookiecutter/{{ cookiecutter.hutch }}/{{ cookiecutter.hutch }}python +0 -0
  86. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/debug.py +0 -0
  87. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/env_version.py +0 -0
  88. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/epics_arch.py +0 -0
  89. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/exp_load.py +0 -0
  90. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/ipython_log.py +0 -0
  91. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/ipython_session_timer.py +0 -0
  92. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/lcls.py +0 -0
  93. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/log_setup.py +0 -0
  94. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/logging.yml +0 -0
  95. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/mpl_config.py +0 -0
  96. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/namespace.py +0 -0
  97. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/obj_config.py +0 -0
  98. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/ophyd_settings.py +0 -0
  99. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/options.py +0 -0
  100. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/plan_defaults.py +0 -0
  101. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/plan_wrappers.py +0 -0
  102. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/print_hint_banner.py +0 -0
  103. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/pt_app_config.py +0 -0
  104. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/qs_load.py +0 -0
  105. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/sim.py +0 -0
  106. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/templates/issue.template +0 -0
  107. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/__init__.py +0 -0
  108. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/bad_script.py +0 -0
  109. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/camviewer.cfg +0 -0
  110. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/conftest.py +0 -0
  111. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/envs/pcds-1.0.0 +0 -0
  112. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/envs/pcds-2.0.0 +0 -0
  113. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/envs/z-env +0 -0
  114. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/experiments/sample_expname.py +0 -0
  115. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/experiments/x010.py +0 -0
  116. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/experiments/x011.py +0 -0
  117. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/happi_db.json +0 -0
  118. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/sample_module_1.py +0 -0
  119. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/sample_module_2.py +0 -0
  120. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/script.py +0 -0
  121. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_bug.py +0 -0
  122. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_cache.py +0 -0
  123. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_cam_load.py +0 -0
  124. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_epics_arch.py +0 -0
  125. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_experiment.py +0 -0
  126. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_ipython_log.py +0 -0
  127. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_ipython_session_timer.py +0 -0
  128. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_load_conf.py +0 -0
  129. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_log_setup.py +0 -0
  130. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_namespace.py +0 -0
  131. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_obj_config.py +0 -0
  132. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_plan_wrappers.py +0 -0
  133. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_questionnaire.py +0 -0
  134. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_tstpython.py +0 -0
  135. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_user_load.py +0 -0
  136. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/test_utils.py +0 -0
  137. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/tst/__init__.py +0 -0
  138. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/tst/beamline.py +0 -0
  139. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/tests/tstpython +0 -0
  140. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/user_load.py +0 -0
  141. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/utils.py +0 -0
  142. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python/version.py +0 -0
  143. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/SOURCES.txt +0 -0
  144. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/dependency_links.txt +0 -0
  145. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/entry_points.txt +0 -0
  146. {hutch_python-1.21.0 → hutch_python-1.22.0}/hutch_python.egg-info/top_level.txt +0 -0
  147. {hutch_python-1.21.0 → hutch_python-1.22.0}/pyproject.toml +0 -0
  148. {hutch_python-1.21.0 → hutch_python-1.22.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hutch-python
3
- Version: 1.21.0
3
+ Version: 1.22.0
4
4
  Summary: Launcher and Config Reader for LCLS Interactive IPython Sessions
5
5
  Author: SLAC National Accelerator Laboratory
6
6
  License: Copyright (c) 2023, The Board of Trustees of the Leland Stanford Junior
@@ -60,7 +60,7 @@ Requires-Dist: jinja2>=2.11.0
60
60
  Requires-Dist: lightpath>=1.0.1
61
61
  Requires-Dist: matplotlib>=3.4.0
62
62
  Requires-Dist: nabs>=1.5.0
63
- Requires-Dist: pcdscalc>=0.3.0
63
+ Requires-Dist: pcdscalc>=0.6.0
64
64
  Requires-Dist: pcdsdaq>=2.3.0
65
65
  Requires-Dist: pcdsdevices>=7.0.0
66
66
  Requires-Dist: pcdsutils>=0.5.0
@@ -32,7 +32,7 @@ requirements:
32
32
  - lightpath >=1.0.1
33
33
  - matplotlib-base >=3.4.0
34
34
  - nabs >=1.5.0
35
- - pcdscalc >=0.3.0
35
+ - pcdscalc >=0.6.0
36
36
  - pcdsdaq >=2.3.0
37
37
  - pcdsdevices >=7.0.0
38
38
  - pcdsutils >=0.6.0
@@ -2,6 +2,47 @@ Release History
2
2
  ###############
3
3
 
4
4
 
5
+ v1.22.0 (2024-12-19)
6
+ ====================
7
+
8
+ Features
9
+ --------
10
+ - Add ``pcdscalc.xray`` to the calc namespace.
11
+ - Add top-level shortcuts to some of the most used calcs,
12
+ ``E2lam``, ``lam2E``, ``bragg_angle``, ``darwin_width``,
13
+ and ``transmission``.
14
+ ``E2lam`` is an alias for ``energy_to_wavelength`` and
15
+ ``lam2E`` is an alias for ``wavelength_to_energy``
16
+ to match scientist expectations.
17
+ - Added ability to ignore specific upstream devices when loading hutch-python.
18
+
19
+ - ``UPSTREAM``: The hutch's devices, and devices upstream from the requested hutch.
20
+ If there are multiple paths to the requested hutch, all paths devices are loaded.
21
+ - ``STANDARD``: Devices gathered via ``UPSTREAM``, plus devices that share the
22
+ "beamline" field in happi with the ``UPSTREAM`` devices. (The current standard)
23
+ - ``ALL``: All devices in the happi database. Use this option at your own risk.
24
+
25
+
26
+ Bugfixes
27
+ --------
28
+ - Make test_create_arg agnostic to where pytest was invoked from
29
+ - Fix an issue where the user could clobber their own ``elog``
30
+ object in a way that would allow the ``ElogPoster`` utility to
31
+ load and then fail at scan time.
32
+
33
+ Maintenance
34
+ -----------
35
+ - Updates documentation formatting for device load_level, and adds an ascii beamline map to the test suite
36
+
37
+ Contributors
38
+ ------------
39
+ - janeliu-slac
40
+ - tangkong
41
+ - vespos
42
+ - zllentz
43
+
44
+
45
+
5
46
  v1.21.0 (2024-08-20)
6
47
  ====================
7
48
 
@@ -4,7 +4,7 @@ Yaml Files
4
4
  ``hutch-python`` uses a ``conf.yml`` file for basic configuration. This is a
5
5
  standard yaml file with the following valid keys:
6
6
  ``hutch``, ``db``, ``load``, ``load_level``, ``experiment``, ``obj_config``,
7
- ``daq_type``, ``daq_host``, and ``daq_platform``.
7
+ ``daq_type``, ``daq_host``, and ``daq_platform``, ``exclude_devices``.
8
8
 
9
9
 
10
10
  hutch
@@ -75,9 +75,11 @@ The ``load_level`` key expects one of the following strings, corresponding to th
75
75
  amount of ophyd devices to load:
76
76
 
77
77
  - ``UPSTREAM``: The hutch's devices, and devices upstream from the requested hutch.
78
- If there are multiple paths to the requested hutch, all paths' devices are loaded.
78
+ If there are multiple paths to the requested hutch, all paths' devices are loaded.
79
+
79
80
  - ``STANDARD``: Devices gathered via ``UPSTREAM``, plus devices that share the
80
- "beamline" field in happi with the ``UPSTREAM`` devices. (The current standard)
81
+ "beamline" field in happi with the ``UPSTREAM`` devices. (The current standard)
82
+
81
83
  - ``ALL``: All devices in the happi database. Use this option at your own risk.
82
84
 
83
85
  .. code-block:: YAML
@@ -104,6 +106,7 @@ particular experiment.
104
106
 
105
107
  .. _obj_conf_yaml:
106
108
 
109
+
107
110
  obj_conf
108
111
  --------
109
112
 
@@ -135,6 +138,7 @@ This key expects a string with one of four valid values:
135
138
  LCLS1-style daq, a simulated LCLS1-style daq, an LCLS2-style daq,
136
139
  or no daq respectively.
137
140
 
141
+
138
142
  daq_host
139
143
  --------
140
144
 
@@ -142,6 +146,7 @@ The daq collection host as a string. This is a required key
142
146
  when using the lcls2 daq_type, and is ignored with any other daq_type.
143
147
  It will be used in the creation of the lcls2 daq object.
144
148
 
149
+
145
150
  daq_platform
146
151
  ------------
147
152
 
@@ -155,6 +160,26 @@ experiment. Additional keys are interpreted as hostnames to use
155
160
  alternate platforms for. Alternate platforms will post to the
156
161
  secondary elog.
157
162
 
163
+
164
+ exclude_devices
165
+ ------------
166
+ The ``exclude_devices`` key is optional. ``exclude_devices`` expects a list
167
+ of strings containing names of upstream devices that should not be loaded.
168
+ It reduces the amount of unnecessary information shown in the console at
169
+ load time. The list can be created as a multi-line array of strings or all
170
+ on one line using the following formats:
171
+
172
+ .. code-block:: YAML
173
+
174
+ exclude_devices:
175
+ - crix_cryo_y
176
+ - at2k2_calc
177
+
178
+ .. code-block:: YAML
179
+
180
+ exclude_devices: ['crix_cryo_y', 'at2k2_calc']
181
+
182
+
158
183
  Full File Example
159
184
  -----------------
160
185
 
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '1.21.0'
16
- __version_tuple__ = version_tuple = (1, 21, 0)
15
+ __version__ = version = '1.22.0'
16
+ __version_tuple__ = version_tuple = (1, 22, 0)
@@ -1,5 +1,9 @@
1
1
  from importlib import import_module
2
2
 
3
+ from pcdscalc.common import energy_to_wavelength, wavelength_to_energy
4
+ from pcdscalc.diffraction import bragg_angle, darwin_width
5
+ from pcdscalc.xray import transmission
6
+
3
7
  from .utils import HelpfulNamespace
4
8
 
5
9
 
@@ -33,7 +37,13 @@ def collect_functions(modules):
33
37
 
34
38
 
35
39
  calc_namespace = HelpfulNamespace(
40
+ E2lam=energy_to_wavelength,
41
+ lam2E=wavelength_to_energy,
42
+ bragg_angle=bragg_angle,
43
+ darwin_width=darwin_width,
44
+ transmission=transmission,
36
45
  be_lens=collect_functions(['pcdscalc.be_lens_calcs']),
37
46
  common=collect_functions(['pcdscalc.common']),
38
47
  diffraction=collect_functions(['pcdscalc.diffraction']),
48
+ xray=collect_functions(['pcdscalc.xray']),
39
49
  )
@@ -39,6 +39,7 @@ VALID_KEYS = (
39
39
  'daq_host',
40
40
  'obj_config',
41
41
  'session_timer',
42
+ 'exclude_devices'
42
43
  )
43
44
  NO_LOG_EXCEPTIONS = (KeyboardInterrupt, SystemExit)
44
45
  LOG_DOMAINS = {".pcdsn", ".slac.stanford.edu"}
@@ -29,7 +29,8 @@ def get_happi_objs(
29
29
  db: str,
30
30
  light_ctrl: LightController,
31
31
  endstation: str,
32
- load_level: DeviceLoadLevel = DeviceLoadLevel.STANDARD
32
+ load_level: DeviceLoadLevel = DeviceLoadLevel.STANDARD,
33
+ exclude_devices: list[str] = None
33
34
  ) -> dict[str, ophyd.Device]:
34
35
  """
35
36
  Get the relevant items for ``endstation`` from the happi database ``db``.
@@ -57,6 +58,11 @@ def get_happi_objs(
57
58
  objs: ``dict``
58
59
  A mapping from item name to item
59
60
  """
61
+
62
+ # Explicitly set exclude_devices to empty list to avoid mutable default arguments issue.
63
+ if not exclude_devices:
64
+ exclude_devices = []
65
+
60
66
  # Load the happi Client
61
67
  if None not in (light_ctrl, lightpath):
62
68
  client = light_ctrl.client
@@ -67,47 +73,51 @@ def get_happi_objs(
67
73
  if load_level == DeviceLoadLevel.ALL:
68
74
  results = client.search(active=True)
69
75
  containers.extend(res.item for res in results)
70
- return _load_devices(*containers)
71
76
 
72
- if light_ctrl is None or (endstation.upper() not in light_ctrl.beamlines):
77
+ elif light_ctrl is None or (endstation.upper() not in light_ctrl.beamlines):
73
78
  # lightpath was unavailable, search by beamline name
74
79
  reqs = dict(beamline=endstation.upper(), active=True)
75
80
  results = client.search(**reqs)
76
81
  containers.extend(res.item for res in results)
77
- return _load_devices(*containers)
78
-
79
- # if lightpath exists, we can grab upstream devices
80
- dev_names = set()
81
- paths = light_ctrl.beamlines[endstation.upper()]
82
- for path in paths:
83
- dev_names.update(path)
84
-
85
- # gather happi items for each of these
86
- for name in dev_names:
87
- results = client.search(name=name)
88
- containers.extend(res.item for res in results)
89
82
 
90
- if load_level >= DeviceLoadLevel.STANDARD:
91
- # also any device with the same beamline name
92
- # since lightpath only grabs lightpath-active devices
93
- beamlines = {it.beamline for it in containers}
94
- beamlines.add(endstation.upper())
95
-
96
- for line in beamlines:
97
- # Assume we want hutch items that are active
98
- # items can be lightpath-inactive
99
- reqs = dict(beamline=line, active=True)
100
- results = client.search(**reqs)
101
- blc = [res.item for res in results
102
- if res.item.name not in dev_names]
103
- # Add the beamline containers to the complete list
104
- if blc:
105
- containers.extend(blc)
83
+ else:
84
+ # if lightpath exists, we can grab upstream devices
85
+ dev_names = set()
86
+ paths = light_ctrl.beamlines[endstation.upper()]
87
+ for path in paths:
88
+ dev_names.update(path)
89
+
90
+ # gather happi items for each of these
91
+ for name in dev_names:
92
+ results = client.search(name=name)
93
+ containers.extend(res.item for res in results)
94
+
95
+ if load_level >= DeviceLoadLevel.STANDARD:
96
+ # also any device with the same beamline name
97
+ # since lightpath only grabs lightpath-active devices
98
+ beamlines = {it.beamline for it in containers}
99
+ beamlines.add(endstation.upper())
100
+
101
+ for line in beamlines:
102
+ # Assume we want hutch items that are active
103
+ # items can be lightpath-inactive
104
+ reqs = dict(beamline=line, active=True)
105
+ results = client.search(**reqs)
106
+ blc = [res.item for res in results
107
+ if res.item.name not in dev_names]
108
+ # Add the beamline containers to the complete list
109
+ if blc:
110
+ containers.extend(blc)
106
111
 
107
112
  if len(containers) < 1:
108
113
  logger.warning(f'{len(containers)} active devices found for '
109
114
  'this beampath')
110
115
 
116
+ # Do not load excluded devices
117
+ for device in containers.copy():
118
+ if device.name in exclude_devices:
119
+ containers.remove(device)
120
+
111
121
  return _load_devices(*containers)
112
122
 
113
123
 
@@ -132,7 +142,7 @@ def _load_devices(*containers: happi.HappiItem):
132
142
  return dev_namespace.__dict__
133
143
 
134
144
 
135
- def get_lightpath(db, hutch) -> LightController:
145
+ def get_lightpath(db: str, hutch: str) -> LightController:
136
146
  """
137
147
  Create a ``lightpath.LightController`` from relevant ``happi`` objects.
138
148
 
@@ -155,10 +165,14 @@ def get_lightpath(db, hutch) -> LightController:
155
165
  if None in (lightpath, beamlines):
156
166
  logger.warning('Lightpath module is not available.')
157
167
  return None
168
+
158
169
  # Load the happi Client
159
170
  client = happi.Client(path=db)
171
+
160
172
  # Allow the lightpath module to create a path
161
173
  lc = lightpath.LightController(client, endstations=[hutch.upper()])
174
+
162
175
  # Return paths (names only) seen by the LightController
163
176
  # avoid loding the devices so hutch-python can keep track of it
177
+
164
178
  return lc
@@ -297,6 +297,20 @@ def load_conf(conf, hutch_dir=None, args=None):
297
297
  daq_platform = 0
298
298
  logger.info('Selected default hutch-python daq platform: 0')
299
299
 
300
+ try:
301
+ # This is a list of all devices that should not be loaded
302
+ exclude_devices = conf['exclude_devices']
303
+ if not isinstance(exclude_devices, list):
304
+ logger.error(
305
+ 'Invalid exclude_devices conf, must be a list.')
306
+ exclude_devices = []
307
+ else:
308
+ exclude_devices = [device_name.strip() for device_name in exclude_devices]
309
+ except KeyError:
310
+ exclude_devices = []
311
+ logger.info(
312
+ 'Missing exclude_devices in conf. Will load all devices.')
313
+
300
314
  # Set the session timeout duration
301
315
  try:
302
316
  hutch_python.ipython_session_timer.configure_timeout(
@@ -460,7 +474,8 @@ def load_conf(conf, hutch_dir=None, args=None):
460
474
  lc = get_lightpath(db, hutch)
461
475
 
462
476
  # Gather relevant objects given the BeamPath
463
- happi_objs = get_happi_objs(db, lc, hutch, load_level=load_level)
477
+ happi_objs = get_happi_objs(
478
+ db, lc, hutch, load_level=load_level, exclude_devices=exclude_devices)
464
479
  cache(**happi_objs)
465
480
 
466
481
  # create and store beampath
@@ -0,0 +1,49 @@
1
+ """
2
+ Initialize the ELogPoster callback and subscribe it to the RunEngine
3
+
4
+ Startup script files to be run after ipython is initialized via:
5
+ ``c.InteractiveTerminalApp.exec_files``
6
+
7
+ Code here will take executed after both IPython has been loaded and
8
+ the namespace has been populated with hutch objects.
9
+
10
+ These will be run as standalone python files, and should not be
11
+ imported from.
12
+ """
13
+
14
+
15
+ def _configure_elog_poster():
16
+ import IPython
17
+ from nabs.callbacks import ELogPoster
18
+
19
+ from hutch_python.utils import safe_load
20
+
21
+ with safe_load('ELogPoster'):
22
+ try:
23
+ from bluesky.run_engine import RunEngine
24
+ from elog import HutchELog
25
+ except ImportError:
26
+ raise RuntimeError("A required module is missing, skip ElogPoster")
27
+
28
+ # RE, elog will already exist by now, if not we fail and skip.
29
+ # Some effort to give better error message for the logs.
30
+ try:
31
+ elog = globals()['elog']
32
+ except KeyError:
33
+ raise RuntimeError("elog not loaded, skip ElogPoster")
34
+ try:
35
+ RE = globals()['RE']
36
+ except KeyError:
37
+ raise RuntimeError("RE not loaded, skip ElogPoster")
38
+ # Even if they exist, things can go wrong if the user accidentally clobbers the name
39
+ if not isinstance(elog, HutchELog):
40
+ raise RuntimeError("elog replaced, skip ELogPoster")
41
+ if not isinstance(RE, RunEngine):
42
+ raise RuntimeError("RE replaced, skip ELogPoster")
43
+
44
+ elogc = ELogPoster(elog, IPython.get_ipython())
45
+ RE.subscribe(elogc)
46
+
47
+
48
+ if __name__ == '__main__':
49
+ _configure_elog_poster()
@@ -0,0 +1,15 @@
1
+ hutch: tst
2
+
3
+ # Our test happi database has the following configuration:
4
+ # tst_device_3 (inactive)
5
+
6
+ # z +-> (0.8) (1.0) (2.0)
7
+ # X0 -- tst_device_5 ------ tst_device_1 -- test_device_2 -- "TST"
8
+ # \
9
+ # Z0 -- tst_device_4 -- tst_device_6
10
+ # z +-> (0.85) (1.85)
11
+ db: happi_db.json
12
+
13
+ load: tst.beamline
14
+
15
+ experiment: tstx010
@@ -69,7 +69,9 @@ def test_sim_arg(no_ipython_launch):
69
69
  def test_create_arg():
70
70
  logger.debug('test_create_arg_dev')
71
71
  hutch = 'temp_create'
72
- test_dir = CFG_PATH.parent.parent.parent / hutch
72
+ # CLI invocation will create the hutch folder in the folder pytest was
73
+ # called from. We should check and clean that folder.
74
+ test_dir = Path.cwd() / hutch
73
75
  if test_dir.exists():
74
76
  shutil.rmtree(test_dir)
75
77
 
@@ -17,9 +17,6 @@ def test_happi_objs():
17
17
  logger.debug("test_happi_objs")
18
18
  db = os.path.join(os.path.abspath(os.path.dirname(__file__)),
19
19
  'happi_db.json')
20
- # patch lightpath configs to include test db beamline
21
- conftest.beamlines['TST'] = ['X0']
22
- conftest.sources.append('X0')
23
20
  # Only select active objects
24
21
  lc = get_lightpath(db, 'tst')
25
22
  objs = get_happi_objs(db, lc, 'tst')
@@ -44,9 +41,6 @@ def test_load_level(load_level: DeviceLoadLevel, num_devices: int):
44
41
  logger.debug("test_load_level")
45
42
  db = os.path.join(os.path.abspath(os.path.dirname(__file__)),
46
43
  'happi_db.json')
47
- # patch lightpath configs to include test db beamline
48
- conftest.beamlines['TST'] = ['X0']
49
- conftest.sources.append('X0')
50
44
  # Only select active objects
51
45
  lc = get_lightpath(db, 'tst')
52
46
  objs = get_happi_objs(db, lc, 'tst', load_level=load_level)
@@ -63,3 +57,30 @@ def test_get_lightpath():
63
57
  # Check that we created a valid BeamPath with no inactive objects
64
58
  assert obj.name == 'TST'
65
59
  assert len(obj.devices) == 3
60
+
61
+
62
+ # run test_happi_objs() with exclude_devices
63
+ @conftest.requires_lightpath
64
+ def test_happi_objs_with_exclude_devices():
65
+ # This test checks whether devices from exclude_devices have been removed from the
66
+ # output of get_happi_objs(). For comparison, get_happi_objs() is first called without
67
+ # exclude_devices and then called again with exclude_devices.
68
+ exclude_devices = ['tst_device_5', 'tst_device_1']
69
+
70
+ logger.debug("test_happi_objs")
71
+ db = os.path.join(os.path.abspath(os.path.dirname(__file__)),
72
+ 'happi_db.json')
73
+ # Only select active objects
74
+ lc = get_lightpath(db, 'tst')
75
+
76
+ # Call get_happi_objs() without exclude_devices
77
+ objs = get_happi_objs(db, lc, 'tst', DeviceLoadLevel.STANDARD)
78
+ assert len(objs) == 4
79
+
80
+ # Call get_happi_objs() with exclude_devices
81
+ objs_exclude_devices = get_happi_objs(db, lc, 'tst', DeviceLoadLevel.STANDARD, exclude_devices)
82
+ assert len(objs_exclude_devices) == 2
83
+
84
+ # Check that none of the loaded devices are in the exclude_devices list
85
+ for obj in objs_exclude_devices:
86
+ assert obj not in exclude_devices
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hutch-python
3
- Version: 1.21.0
3
+ Version: 1.22.0
4
4
  Summary: Launcher and Config Reader for LCLS Interactive IPython Sessions
5
5
  Author: SLAC National Accelerator Laboratory
6
6
  License: Copyright (c) 2023, The Board of Trustees of the Leland Stanford Junior
@@ -60,7 +60,7 @@ Requires-Dist: jinja2>=2.11.0
60
60
  Requires-Dist: lightpath>=1.0.1
61
61
  Requires-Dist: matplotlib>=3.4.0
62
62
  Requires-Dist: nabs>=1.5.0
63
- Requires-Dist: pcdscalc>=0.3.0
63
+ Requires-Dist: pcdscalc>=0.6.0
64
64
  Requires-Dist: pcdsdaq>=2.3.0
65
65
  Requires-Dist: pcdsdevices>=7.0.0
66
66
  Requires-Dist: pcdsutils>=0.5.0
@@ -8,7 +8,7 @@ jinja2>=2.11.0
8
8
  lightpath>=1.0.1
9
9
  matplotlib>=3.4.0
10
10
  nabs>=1.5.0
11
- pcdscalc>=0.3.0
11
+ pcdscalc>=0.6.0
12
12
  pcdsdaq>=2.3.0
13
13
  pcdsdevices>=7.0.0
14
14
  pcdsutils>=0.5.0
@@ -8,7 +8,7 @@ jinja2>=2.11.0
8
8
  lightpath>=1.0.1
9
9
  matplotlib>=3.4.0
10
10
  nabs>=1.5.0
11
- pcdscalc>=0.3.0
11
+ pcdscalc>=0.6.0
12
12
  pcdsdaq>=2.3.0
13
13
  pcdsdevices>=7.0.0
14
14
  pcdsutils>=0.5.0
@@ -1,32 +0,0 @@
1
- """
2
- Initialize the ELogPoster callback and subscribe it to the RunEngine
3
-
4
- Startup script files to be run after ipython is initialized via:
5
- ``c.InteractiveTerminalApp.exec_files``
6
-
7
- Code here will take executed after both IPython has been loaded and
8
- the namespace has been populated with hutch objects.
9
-
10
- These will be run as standalone python files, and should not be
11
- imported from.
12
- """
13
-
14
-
15
- def _configure_elog_poster():
16
- import IPython
17
- from nabs.callbacks import ELogPoster
18
-
19
- from hutch_python.utils import safe_load
20
-
21
- with safe_load('ELogPoster'):
22
- # RE, ELog will already exist by now
23
- elog = globals().get('elog', None)
24
- RE = globals().get('RE', None)
25
- assert elog is not None
26
-
27
- elogc = ELogPoster(elog, IPython.get_ipython())
28
- RE.subscribe(elogc)
29
-
30
-
31
- if __name__ == '__main__':
32
- _configure_elog_poster()
@@ -1,7 +0,0 @@
1
- hutch: tst
2
-
3
- db: happi_db.json
4
-
5
- load: tst.beamline
6
-
7
- experiment: tstx010
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes