-
Notifications
You must be signed in to change notification settings - Fork 5
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
✨ Add configuration for plot functions #288
Conversation
✨ Add PlotLabelOverRideValue and PlotLabelOverRideMap
# Conflicts: # requirements_pinned.txt
🩹 Fix mutation of input values in plot config
🚇👌 Use non editable install in CI (closer to user how users run it)
This prevents the folloing warning when running the tests: RuntimeWarning: More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`). Consider using `matplotlib.pyplot.close()`.
👌 Improve error collection and messages
👌 Make Config.reload lazy (only reloaded when files changed) 👌 Make Config.reload respect plot_config_context
This allows users to pass a tuple of kwarg names (exclude_from_config) that should be ignored when generating the json schema
Changed the spelling of the class `PlotLabelOverRideValue` to the grammatically correct `PlotLabelOverrideValue`. The term "override" is a single word, so it does not make sense to use "OverRide" in the class name.
Correcting `PlotLabelOverRideMap` -> `PlotLabelOverrideMap`
It should be Overdue not OverDue (in OverDueDeprecationError). The word "overdue" is a single word and should not be split into "Over" and "Due" in the class name.
♻️ Factor out yaml string and markdown method adding into a decorator
Posix and windows have different python installation folder layouts, which caused tests fail since the correct importlib path couldn't be determined on posix systems
🧙 Sourcery has finished reviewing your pull request! Tips
|
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.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #288 +/- ##
===========================================
+ Coverage 44.77% 58.26% +13.48%
===========================================
Files 27 31 +4
Lines 1043 1598 +555
Branches 162 290 +128
===========================================
+ Hits 467 931 +464
- Misses 568 651 +83
- Partials 8 16 +8 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
Main reason to pin pydantic==2.7.2 at runtime is that this is the minimum requirement of pyglotaran 0.7.3 The conflict is caused by: The user requested pydantic==2.7 pyglotaran 0.7.3 depends on pydantic>=2.7.2
As discussed before this allows better integratin and consistency with the config. Since plot_pfid wasn't part of a release this isn't a regression.
After this PR got merged our docs will have the config schema for the builtin functions under |
This technically isn't needed since it can fallback using __getitem__ and use False on KeyError, however this causes the debugger to stop on __getitem__ unneededly. Wenn to use the type object to make mypy happy, since the super type Mapping has that typing.
As we say in dutch "Het heeft even geduurd, maar nu hebben we ook wat!". 👍 To illlustrate what can be done with it, here the plot_overview from the fluorescence case study without config and with. # yaml-language-server: $schema=pygta_config.schema.json
plotting:
general:
default_args_override:
linlog: false
use_svd_number: false
linthresh: 2
axis_label_override:
time: Time (ps)
spectral: Wavelength (nm)
data_left_singular_vectors: ''
data_singular_values: Singular Value (a.u.)
data_right_singular_vectors: ''
plot_data_overview:
default_args_override:
use_svd_number: false
plot_svd:
default_args_override:
use_svd_number: true
plot_overview:
default_args_override:
show_data: false ... which may not seem, until you realize all axis labels have now almost effortlessly been replaced ( The autocompletion, due to the (autogenerated) from pyglotaran_extras import CONFIG
CONFIG.init_project() All in all, an impressive piece of work, and clearly a labor of love, which I'm sure out community will ❤️ as well. |
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.
Reviewed and tested ok. The docs can still do with some polishing here and there, but this is more than good enough for the pyglotaran_extras CONFIG v1 release. 👍
For the effort and pushing to finish in conjunction with the pyglotaran 0.7.3 release, I award you a gold medal 🥇 !
Here is the long overdue PR that adds the plot config.
The main goal is to reduce repetitive boilerplate code (I.e. when changing plot labels).
See the difference in code to get the same resulting plot (
CONFIG._reset(project_config)
is just needed in the docs to show the differences.)With the corresponding config:
Change summary
myst-nb
(this allows support for mermaid)Checklist