JohannesBuchner / PyMultiNest

Pythonic Bayesian inference and visualization for the MultiNest Nested Sampling Algorithm and PyCuba's cubature algorithms.
http://johannesbuchner.github.io/PyMultiNest/
Other
191 stars 87 forks source link

add Analyzer instance to solve() output #205

Closed rpoleski closed 1 year ago

rpoleski commented 2 years ago

Function solve() returns more output. Then there is no need to re-read the file to run e.g., Analyzer.get_data().

JohannesBuchner commented 2 years ago

I am wondering if this may cause issues with users who want to pickle the result.

Perhaps using the Solver class may be more suitable for use cases which should retain the state.

JohannesBuchner commented 2 years ago

perhaps we should break up this function into the run() and analyse() part, so that the solver class can expose the analyzer.

rpoleski commented 2 years ago

One more approach would be to add return_analyzer parameter to solve() with defult value of False. This will make the default behaviour same as now, but would return instance of Analyzer if user wants. I can code that. Do you like this idea?

JohannesBuchner commented 2 years ago

What problem are you trying to solve in the first place?

rpoleski commented 2 years ago

Remove the need to read the same files twice.

JohannesBuchner commented 2 years ago

If this is just a mild nuisance to you but does not stop you from doing something for performance reasons, I am hesitant to make substantial changes, which could affect depending packages and increase maintenance complications.

For a return flag, we would have to check if BXA and other pymultinest using libraries on github would break.

This can be avoided by splitting the code into functions that the user can assemble differently than solve() does, to access intermediate parts.