JohannesBuchner / UltraNest

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

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

Closed facero closed 10 months ago

facero commented 10 months 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 10 months ago

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

Yes

facero commented 10 months ago

Added the suggested change in the code and added the example

JohannesBuchner commented 10 months 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 10 months 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 10 months ago

Great, thank you!

JohannesBuchner commented 10 months ago

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