-
Notifications
You must be signed in to change notification settings - Fork 18
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
Allow interactively inspect plots #208
base: main
Are you sure you want to change the base?
Allow interactively inspect plots #208
Conversation
the way this is usually solved is with reference files and doing pixel-averaged distance between those and newly generated plots. see i briefly looked into doing that in #22 but seemed too brittle to pursue. also a bit annoying having to have a lot of references files in |
I guess my option is more naive: "just ask the user to inspect the figures themselve to see if it's broken", with a prompt like I intend to make this optional on top of the regular test workflow (only trigger in non-CI environment), such that if we did some major change to the code base, we run these tests locally to see if there is any major breakage. I would give it a spin first and see how everything goes :) |
889588d
to
3d818a1
Compare
a4619c1
to
cbed2dc
Compare
is this PR still on the to do list or could it be closed? |
* density_scatter_plotly add keyword colorbar_kwargs for customizing colorbar - increase tolerance in `get_image_sites` in `helpers.py` from 0.02 to 0.03 - add new test for colorbar customization in `test_scatter.py` * add plot_hetero_diatomic_curves.py with ptable and 3D line plots set Atoms(pbc=False) in mace_pair_repulsion.py for safety (already the default) * drop windows CI
Sorry for the lack of response and progress, I cleared most of my TODO list from the MP side so I would get my hands on these by next week ;) |
3014528
to
8144fbe
Compare
8144fbe
to
5079a56
Compare
6225dd0
to
4f795c7
Compare
I'm happy with current functionality so far, it displays the figure optionally when invoked interactively, and doesn't require much (if any) code change in our current test code. However there may be a few quality-of-life improvement possible:
|
Just I noticed another
Though I'm hoping their functionalities to complement one another (the pytest add-on for automated CI pipeline), and this for easier manual inspection (as this don't need to save a copy of the target figure) |
@@ -70,7 +70,7 @@ build-backend = "setuptools.build_meta" | |||
|
|||
[tool.pytest.ini_options] | |||
testpaths = ["tests"] | |||
addopts = "-p no:warnings" | |||
addopts = "-s -p no:warnings" |
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.
Admittedly this is not the best option (to globally un-capture output) as I was hoping this could be integrated without any code change to our current test framework, but I didn't find another way around this issue.
The most related might be the capsys
fixture but again I didn't manage to integrate this fixture into this helper function.
@janosh Not sure if you would be happy with adding this option to globally release pytest
output capture (though I would assume the side effect to be limited as we aren't inserting much print
and so on), and save the trouble to pass -s
every time we need to use this helper function. But I would be happy with either as passing a -s
would not be too much effort as manual inspection shouldn't be something super frequently done
Also for the other two possible improvements mentioned in #208 (comment), unfortunately I didn't find better solutions (the display size getter seems heavily OS-specific). Not sure if you have any comment?
Is there a way to open a figure with the same style as opening a saved one? I was taking the "saved" one as reference as it's more stable (and better looking in my case, as the directly shown one tend to overlap):
- Displaying exactly the figure that will be saved
- How to Save Figures Identical to the Displayed Figures in Matplotlib
Happy coding 2025 in any case :)
0d538be
to
00b7717
Compare
Summary
Allow interactively inspect plots.
Objective:
Add an interactive inspection tool to prompt the user to inspect a plot, this would only run locally and skip CI workflow.
Rationale:
It's really hard to automate tests for plotters, we could assert some elements (title, number of subplots and such), but it's hard to ensure the overall figure is in expected shape. Therefore we might be better off insert some interactive checkers which would only run locally anyway. Such that if developers want to inspect some plotters, they could run that particular unit test locally.
Currently I mostly use the "make_assets" scripts to inspect plots, but it's largely limited to certain "styles". Also it's not quite reusable if I wish to inspect some other styles.