Skip to content

Refactor analysis package#916

Open
thehrh wants to merge 8 commits intomasterfrom
refactor/analysis_package
Open

Refactor analysis package#916
thehrh wants to merge 8 commits intomasterfrom
refactor/analysis_package

Conversation

@thehrh
Copy link
Copy Markdown
Collaborator

@thehrh thehrh commented Mar 9, 2026

  • move configuration of scipy and nlopt minimization settings to separate modules
  • move parameter manipulation tools to another
  • make fit_history and detailed metric info in HypoFitResult configurable (less memory and disk space usage by default) and verify consistency between detailed metric info and the external metric value (where possible; not for a fit that used Detectors -> TODO added)
  • catch any exception due to random failure of constrained-slsqp test
  • remove setting of iprint and disp options for l-bfgs-b
  • cosmetics
  • removal of unused & broken Analysis class (is a replacement of nofit_hypo desirable?)
  • remove global scipy minimization from automatic unit testing (for reduced workflow duration)

Fixes #915
Fixes #913 (create a replacement issue for the randomness)
Closes #910
Fixes #827
Should at least partially address #644

In addition, #661 could be closed as not planned if this PR goes through.

thehrh added 5 commits March 9, 2026 23:21
…mization settings to separate modules, parameter manipulation tools to another; make fit_history and detailed metric info in HypoFitResult configurable; catch any exception due to random failure of constrained-slsqp test; cosmetics
…o use fit_recursively (and also apply some cleanups)
@thehrh thehrh marked this pull request as ready for review March 11, 2026 17:02
thehrh added 2 commits March 12, 2026 14:50
…o setter and warn in case of failure (e.g. for externally constructed HypoFitResult)
Comment thread pisa/analysis/analysis.py Outdated
Common tools for performing an analysis collected into a single class
`Analysis` that can be subclassed by specific analyses.
Common tools for performing an analysis collected into the class
`BasicAnalysis` that can be subclassed by specific analyses.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be good to rename the BasicAnalysis class to Analysis now that the Analysis class is gone? That way other scripts could still import Analysis.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd tend to agree with the sentiment that "Analysis" is a more appropriate name (the single fit it returns might be considered "basic" compared to a set of fits as in a scan, but the available fitting methods are anything but "basic"). We can define the alias BasicAnalysis = Analysis for backwards compatibility.

Comment thread pisa/analysis/analysis.py
# TODO: We don't have access to the Detectors instance itself here
# -> no straightforward way to correctly determine the total prior
# contribution (cf. Detectors.init_params())
metric_val_from_priors = np.nan
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't total_metric_val_from_detailed always be nan if is_detectors?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, and in that case no consistency check will and can be done

…tibility, move mcmc_sampling to own module (shouldn't and doesn't need to be part of Analysis class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants