PyMultiNest icon indicating copy to clipboard operation
PyMultiNest copied to clipboard

add Analyzer instance to solve() output

Open rpoleski opened this issue 2 years ago • 6 comments

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

rpoleski avatar Feb 02 '22 16:02 rpoleski

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 avatar Feb 02 '22 18:02 JohannesBuchner

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

JohannesBuchner avatar Feb 02 '22 19:02 JohannesBuchner

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?

rpoleski avatar Feb 02 '22 20:02 rpoleski

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

JohannesBuchner avatar Feb 03 '22 08:02 JohannesBuchner

Remove the need to read the same files twice.

rpoleski avatar Feb 03 '22 08:02 rpoleski

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.

JohannesBuchner avatar Feb 03 '22 08:02 JohannesBuchner