JohannesBuchner / UltraNest

Fit and compare complex models reliably and rapidly. Advanced nested sampling.
https://johannesbuchner.github.io/UltraNest/
Other
153 stars 30 forks source link

Add the possibility to provide an ax for Band plots #108

Closed facero closed 1 year ago

facero commented 1 year ago

Hi,

After performing an analysis with BXA of X-ray spectral data, I'm tryring to perfom band plots in the Sherpa environment. What I do is a plot_fit_ratio() which plots the model in a panel and the residuals in another panel. When calling band.line the plot is added to the 2nd residual panel and not on the spectral data as I intended.

Looking at UltraNest plot.py, I added a keyword ax=None to allow to select the ax where the line or shade will be overlaid.

Let me know if you think this is a useful addition and if you recommend some modifications (or if there is a way to do that without my PR). I don't think this needs extra tests. Maybe the Example in the class docstring could be updated to show that it is possible. Let me know what you think.

JohannesBuchner commented 1 year ago

Maybe the Example in the class docstring could be updated to show that it is possible.

Yes

facero commented 1 year ago

Added the suggested change in the code and added the example

JohannesBuchner commented 1 year ago

Merged with some small fixes. The fix is part of ultranest version 3.6.3, please test and let me know whether the issue is resolved for you.

facero commented 1 year ago

I tested my band plots with 3.6.3 and everything worked fine. This issue can be marked as resolved.

Can the 3.6.3 be pushed to conda-forge ? I think the latest version in conda is 3.5

JohannesBuchner commented 1 year ago

Great, thank you!

JohannesBuchner commented 1 year ago

conda-forge currently has build issues, which you can follow here: https://github.com/conda-forge/ultranest-feedstock/pulls