Adds Bayesian plots to Python#52
Adds Bayesian plots to Python#52alexhroom merged 25 commits intoRascalSoftware:mainfrom alexhroom:45-additional-plots
Conversation
DrPaulSharp
left a comment
There was a problem hiding this comment.
The plots are looking good so far, and I'm really pleased you've thought at each stage how to make them look as good as possible and add extra features.
There are two main jobs for you to do: add tests and address the issue with normalisation (corner is not playing ball unfortunately).
Have a look through the other comments too, hopefully there's some ideas there that will turn the plots up to 11.
DrPaulSharp
left a comment
There was a problem hiding this comment.
The plots are looking in great shape and the tests look good. I have a few more specific comments, plus a few more general things to think about to make this module as strong as possible:
- I think we need to consider the naming convention of plotting routines. I think rather than e.g., "plot_hist" and "plot_hist_panel" we should have "plot_one_hist" and "plot_hists" (of course "plot_hists" and similar can plot a single example with one parameter index provided). This better matches the matlab and gives the simpler name to the more commonly used routines.
- Please add a test for plot_ref_sld with shading
- When running test_plotting I get the warning
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()`
I'd suggest explicitly closing figures generated by the tests, hopefully they will run quicker too. Also consider patching routines that generate figures if the actual figures are not required.
I'll try and establish what's happening with the live plots and matplotlib errors that we discussed.
DrPaulSharp
left a comment
There was a problem hiding this comment.
I've a few specific comments, alongside those could you please review the test coverage - it's lacking in a couple of places, in particular estimated densities on histograms and bad input for indices on plots.
DrPaulSharp
left a comment
There was a problem hiding this comment.
Have a look at the final point on tidying up the estimated density code and then we're all done!
RATapi/utils/plotting.py
Outdated
| if estimated_density is not None: | ||
| if isinstance(estimated_density, str): | ||
| estimated_density = {"default": estimated_density} | ||
| default = estimated_density.get("default") |
There was a problem hiding this comment.
Would it make more sense to write:
if isinstance(estimated_density, str):
default = estimated_density
else:
default = estimated_density.pop("default")
and remove lines 716-717.
I think this is a little clearer and avoids making and then emptying the estimated_density dict.
There was a problem hiding this comment.
can't do this because you iterate over estimated_density.items() so it must be a dict by that line. although looking at it i'm becoming dissatisfied with how the loop looks generally. will try to come up with a neater way
This PR fixes #45 by adding the remaining plotting functionality from RAT to the Python API. These are:
cornerPlot->plot_cornerplotHists->plot_histsbayesShadedPlot-> newbayesparameter forplot_ref_sldhistp->plot_one_hist(withestimated_densityparameter for estimated density overplot)mcmcplot->plot_chainplotBayes->plot_bayes(just callsplot_ref_sldwith and without confidence intervals,plot_histsandplot_corner)