Conversation
|
For me BPMs are part of the diagnostic and we can also move them in the project structure to be under diagnostic. When BPMs where created, there was no other diagnostics and BPM itself was more complicated (with model). @JeanLucPons do you think it's ok to move BPMs in diagnostics and make BPM holder part of diagnostic holder? |
|
Yes I would prefer to have BPM in diag. |
@gubaidulinvadim |
Yes, and, additionally, to move bpm module to be a submodule of diagnostics. This can be done in another PR. |
…ent' into 372-feature-add-a-public-diagnostic-holder # Conflicts: # pyaml/common/holders/element_holder.py
|
Would you like to keep the current |
|
For me only sr.design.diag.bpm is fine. |
Yes, and at some point we will have the clean the API so there ONE good way to do things. |
Description
Adds a public
diagnosticproperty (DiagnosticHolder) onElementHolder, mirroringRFHolderandToolHolder. It exposesdiagnostic.get(name)/diagnostic.get()for name-based/untyped access to all configured diagnostics, plus abetatron_tuneproperty resolving the monitor registered asBETATRON_TUNE(the existing default name, already the value ofpyaml.tuning_tools.tune.DEFAULT_BETATRON_TUNE_MONITOR) and validating its type, raisingPyAMLExceptionwhen it is missing or of the wrong type.Related Issue
Features/issues described there are:
DiagnosticHolderwas added (pyaml/common/holders/diagnostic_holder.py) and wired up asElementHolder.diagnostic, because diagnostics were only reachable throughget_betatron_tune_monitor(name), with no type validation and no discoverable entry point grouping them.diagnostic.get(name=None)returns a named diagnostic or, when no name is given, all configured diagnostics as anElementArray, mirroring the sameget()convention already used bytool.get()and the other sub-holders.Changes to existing functionality
get_betatron_tune_monitor(name)andadd_betatron_tune_monitor(tune_monitor)are unchanged, kept as the backward-compatible, untyped named lookup, per the issue.Testing
The following tests (compatible with pytest) were added to
tests/diagnostics/test_diagnostic_accessors.py(new file, newtests/diagnostics/directory):Verify that your checklist complies with the project
tests/tuning_tools/test_tuning_orm.py::test_tuning_orm, a Windows-onlyNamedTemporaryFiledouble-open issue)DiagnosticHolderclass docstring sodiagnosticandbetatron_tuneare discoverable viahelp())