Use data transformation results in other parts of plot configuration
This MR ...
- ... adds the
ResultPlaceholder
class, derived fromPlaceholder
and registers it with the!dag_result
YAML tag - ... implements a placeholder resolution function
- ... and integrates these into the plotting framework on the level of the
BasePlotCreator
This ended up being easier to do without BaseDataProxy
, but directly from the Placeholder
class that was implemented for the DAG.
Other changes
- Minor bugfix in
abc
andbase
modules - Added a generic test function for plots, see
test_dag_plotting.py
, with plots configured intests/cfg/dag_plots.yml
- Minor other improvements (sorry, a bit all over the place):
-
BaseDataProxy
no longer requires anobj
... - more f-strings
- docstring improvements here and there
- some weird leftover formatting stuff from !209 (merged)
-
Details
See extended documentation entry for more information and the full example.
Excerpt from there, to illustrate usage:
# ...
transform:
# For the y values, take the mean ...
- .mean: [!dag_tag some_data, [x, z]]
tag: y
# ... and use the standard deviation for the errors
- .std: [!dag_tag some_data, [x, z]]
tag: yerr
# Additional transformations for ResultPlaceholders
- .mean: [!dag_tag y]
- .item # ... otherwise it's still an xr.DataArray
- .format: ["Some Data (total mean: {:.3g})", !dag_prev ]
tag: title_str
# Now, use the place holder in the helper configuration
helpers:
set_title:
title: !dag_result title_str
Anything to double-check?
-
Interface and usage ok? -
Error messages helpful? -
Documentation understandable? Anything to add? -
Limitations ok – for now? (Can always extend this at a later point ... but perhaps not pressing now?)
Can this MR be accepted?
-
Implementation ready -
Tests added or adjusted -
Documentation extended or updated
-
Code quality -
Changes follow coding guidelines -
Checked code coverage on new and adjusted code
-
-
Ready for merging -
Pipeline passes without warnings -
History cleaned-up or squash option set -
Changelog entry added -
Version number bumped -
Reviewed & approved by @jeremiastraub
-
Related issues
Closes #218 (closed)
Edited by Utopia Developers