-
Notifications
You must be signed in to change notification settings - Fork 1
Add log stream name mapping support #589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ef6cbe7
Add log stream name mapping support to StreamMapping
SimonHeybrock bbd7a5c
Extend nexus_helpers with units extraction and code generation
SimonHeybrock d007bd4
Address PR review comments for nexus_helpers
SimonHeybrock 158f421
Do not strip suffixes from suggested internal names
SimonHeybrock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -231,11 +231,137 @@ class QMapOutputs(WorkflowOutputsBase): | |
| '113_psd1', | ||
| ] | ||
|
|
||
| # Some example motions used for testing, probably not reflecting reality | ||
| # Combined f144 log stream configuration. | ||
| # Maps internal name -> {source: Kafka source name, units: unit string, topic: topic} | ||
| # Generated using: python -m ess.livedata.nexus_helpers <file> --generate --topic <t> | ||
| f144_log_streams: dict[str, dict[str, str]] = { | ||
| # Motion streams (topic: bifrost_motion) | ||
| 'attenuator_1': { | ||
| 'source': 'BIFRO-AttChg:MC-Pne-01:ShtAuxBits07', | ||
| 'units': 'dimensionless', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'attenuator_2': { | ||
| 'source': 'BIFRO-AttChg:MC-Pne-02:ShtAuxBits07', | ||
| 'units': 'dimensionless', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'attenuator_3': { | ||
| 'source': 'BIFRO-AttChg:MC-Pne-03:ShtAuxBits07', | ||
| 'units': 'dimensionless', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'detector_rotation': { | ||
| 'source': 'BIFRO-DtCar:MC-RotZ-01:Mtr.RBV', | ||
| 'units': 'deg', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'get_lost_tube': { | ||
| 'source': 'BIFRO-InBm:MC-Pne-01:ShtAuxBits07', | ||
| 'units': 'dimensionless', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'goniometer_x': { | ||
| 'source': 'BIFRO-SpGon:MC-RotX-01:Mtr.RBV', | ||
| 'units': 'deg', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'goniometer_y': { | ||
| 'source': 'BIFRO-SpGon:MC-RotY-01:Mtr.RBV', | ||
| 'units': 'deg', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'sample_rotation': { | ||
| 'source': 'BIFRO-SpRot:MC-RotZ-01:Mtr.RBV', | ||
| 'units': 'deg', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'slit_bottom': { | ||
| 'source': 'BIFRO-SpSl1:MC-SlZm-01:PzMtr.RBV', | ||
| 'units': 'mm', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'slit_left': { | ||
| 'source': 'BIFRO-SpSl1:MC-SlYp-01:PzMtr.RBV', | ||
| 'units': 'mm', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'slit_right': { | ||
| 'source': 'BIFRO-SpSl1:MC-SlYm-01:PzMtr.RBV', | ||
| 'units': 'mm', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'slit_top': { | ||
| 'source': 'BIFRO-SpSl1:MC-SlZp-01:PzMtr.RBV', | ||
| 'units': 'mm', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| 'slit_position': { | ||
| 'source': 'BIFRO-SpSl1:MC-LinX-01:PzMtr-PosReadback', | ||
| 'units': 'mm', | ||
| 'topic': 'bifrost_motion', | ||
| }, | ||
| # Sample environment streams (topic: bifrost_sample_env) | ||
| 'heater_1': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:HTR1', | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Strange to see Ymir stuff in here? (or maybe not?)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comes from the latest coda file. |
||
| 'units': 'W', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'heater_2': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:HTR2', | ||
| 'units': 'W', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'temperature_0': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:KRDG0', | ||
| 'units': 'K', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'temperature_1': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:KRDG1', | ||
| 'units': 'K', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'temperature_2': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:KRDG2', | ||
| 'units': 'K', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'temperature_3': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:KRDG3', | ||
| 'units': 'K', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'temperature_setpoint': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:SETP_S1', | ||
| 'units': 'K', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'sensor_0': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:SRDG0', | ||
| 'units': 'V', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'sensor_1': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:SRDG1', | ||
| 'units': 'V', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'sensor_2': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:SRDG2', | ||
| 'units': 'V', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| 'sensor_3': { | ||
| 'source': 'YMIR-SEE:SE-LS336-004:SRDG3', | ||
| 'units': 'V', | ||
| 'topic': 'bifrost_sample_env', | ||
| }, | ||
| } | ||
|
|
||
| # Derived from f144_log_streams for use by the Instrument | ||
| f144_attribute_registry = { | ||
| 'detector_rotation': {'units': 'deg'}, | ||
| 'sample_rotation': {'units': 'deg'}, | ||
| 'sample_temperature': {'units': 'K'}, | ||
| name: {'units': info['units']} for name, info in f144_log_streams.items() | ||
| } | ||
|
|
||
| # Create instrument | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a mapping only applicable to Bifrost, or will other instruments follow later?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, others will follow later, but every instrument will have its own unique mapping (or maybe with some overlap, for shared equipment).