Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
StatisticInterface Class Reference

Facade exposing statistical workflows for an ObservableInterface. More...

#include <StatisticInterface.h>

Public Member Functions

 StatisticInterface (StatisticConfig config, std::shared_ptr< ObservableInterface > oi_)
 Constructs the statistical interface around an observable backend.
 
void select_experiment (const std::string &experiment)
 Restricts the analysis to a single experiment.
 
void select_experiments (const std::vector< std::string > &experiments)
 Restricts the analysis to a set of experiments.
 
void select_experiments_all ()
 Clears any experiment restriction and uses all experiments.
 
bool has_experiment_selection () const noexcept
 Tests whether an experiment selection is active.
 
std::set< std::string > selected_experiments () const
 Returns the currently selected experiments.
 
void select_experiment_observables (const std::vector< ExperimentObs > &observables)
 Restricts the analysis to exact experiment/observable/bin entries.
 
void select_experiment_observables_all ()
 Clears any exact experimental-observable restriction.
 
bool has_experiment_observable_selection () const noexcept
 Tests whether an exact experimental-observable selection is active.
 
std::set< ExperimentObsselected_experiment_observables () const
 Returns the active exact experimental-observable selection.
 
std::map< BinnedObservableId, GaussianSummarycompute_uncertainties ()
 Computes Gaussian uncertainty summaries for all active observables.
 
std::map< ParamId, double > get_active_observable_dependencies ()
 Returns the nuisance/input parameters currently seen by the statistical manager.
 
MCResult compute_uncertainties_and_sampling ()
 Runs uncertainty propagation and returns both samples and summaries.
 
FitResultWithMaps compute_MLE (const std::vector< ParamId > &p_specs)
 Runs a maximum-likelihood fit for the requested fit parameters.
 
Contour compute_confidence_contour (ParamId p1, ParamId p2, double z, std::array< double, 4 > bounds, ContourOptions options)
 Computes a two-dimensional confidence contour.
 
void reload_nuisance_specs ()
 Reloads default and user nuisance specifications.
 
void set_nuisance_user_file (const std::string &user_yaml_path)
 Uses a specific user nuisance configuration file.
 
void clear_nuisance_user_file ()
 Restores the default user nuisance file lookup.
 
void prepare_likelihood_for_scan (const std::vector< ParamId > &p_specs)
 Builds and stores the likelihood objects required for scan calls.
 
void set_manual_scan_point (const std::map< ParamId, double > &p_hat, const std::map< ParamId, double > &eta_hat)
 Manually sets the central point used by likelihood scans.
 
LikelihoodScanGrid scan_likelihood_around_current_point (ParamId p1, ParamId p2, double x_half_width, double y_half_width, std::size_t nx, std::size_t ny) const
 Evaluates a rectangular likelihood scan around the current point.
 
void save_likelihood_scan_csv (const std::string &path, const LikelihoodScanGrid &grid) const
 Saves a likelihood scan grid as a CSV file.
 
void update_cache (const std::vector< ParamId > &p_specs=std::vector< ParamId >())
 Refreshes the cached statistical inputs.
 
std::map< ParamId, double > get_all_obss_deps ()
 Selects all nuisance dependencies relevant to the current observable set.
 
std::map< ParamId, double > get_p_specs (const std::vector< ParamId > &p_specs)
 
std::map< ParamId, std::map< ParamId, double > > get_all_correlations ()
 
std::map< ExperimentObs, std::map< ExperimentObs, double > > get_all_obs_correlations ()
 
std::map< ExperimentObs, double > get_obs_exp ()
 
void print_cache ()
 Prints the current manager cache for diagnostics.
 

Public Attributes

 ProfileBackend = ProfilerMode
 

Detailed Description

Facade exposing statistical workflows for an ObservableInterface.

The class owns a configured StatisticManager and forwards high-level operations such as uncertainty propagation, maximum-likelihood fits, confidence contours and likelihood scans.

Definition at line 29 of file StatisticInterface.h.

Constructor & Destructor Documentation

◆ StatisticInterface()

Constructs the statistical interface around an observable backend.

The constructor creates the default proxy stack, initializes the underlying StatisticManager, selects all experiments and builds the initial cache.

Parameters
configStatistic configuration.
oi_Observable interface to use for predictions.

Definition at line 5 of file StatisticInterface.cpp.

Member Function Documentation

◆ clear_nuisance_user_file()

void StatisticInterface::clear_nuisance_user_file ( )

Restores the default user nuisance file lookup.

Definition at line 96 of file StatisticInterface.cpp.

◆ compute_confidence_contour()

Contour StatisticInterface::compute_confidence_contour ( ParamId  p1,
ParamId  p2,
double  z,
std::array< double, 4 >  bounds,
ContourOptions  options 
)

Computes a two-dimensional confidence contour.

Parameters
p1First fit parameter.
p2Second fit parameter.
zGaussian-equivalent confidence level in standard deviations.
boundsContour bounds as {xmin, xmax, ymin, ymax}.
optionsContour and profiling options.
Returns
Extracted contour.

Definition at line 82 of file StatisticInterface.cpp.

◆ compute_MLE()

FitResultWithMaps StatisticInterface::compute_MLE ( const std::vector< ParamId > &  p_specs)

Runs a maximum-likelihood fit for the requested fit parameters.

Parameters
p_specsFit parameters to float.
Returns
Fit result keyed by parameter identifiers.

Definition at line 78 of file StatisticInterface.cpp.

◆ compute_uncertainties()

std::map< BinnedObservableId, GaussianSummary > StatisticInterface::compute_uncertainties ( )

Computes Gaussian uncertainty summaries for all active observables.

Returns
Map from binned observable id to Gaussian summary.

Definition at line 66 of file StatisticInterface.cpp.

◆ compute_uncertainties_and_sampling()

MCResult StatisticInterface::compute_uncertainties_and_sampling ( )

Runs uncertainty propagation and returns both samples and summaries.

Returns
Monte Carlo realization, Gaussian summaries and covariance data.

Definition at line 74 of file StatisticInterface.cpp.

◆ get_active_observable_dependencies()

std::map< ParamId, double > StatisticInterface::get_active_observable_dependencies ( )

Returns the nuisance/input parameters currently seen by the statistical manager.

This is mostly useful for dev/debug workflows. It runs the same observable dependency path as the cache builder: IModel::get_obs_deps(), leaf-source expansion through the source proxy, and the manager's sensitivity filtering. Runtime/lambda observables are therefore included as long as their dependencies were declared on the ObservableInterface side.

Definition at line 70 of file StatisticInterface.cpp.

◆ get_all_correlations()

std::map< ParamId, std::map< ParamId, double > > StatisticInterface::get_all_correlations ( )

Returns
Correlation matrix for the currently cached nuisance parameters.

Definition at line 140 of file StatisticInterface.cpp.

◆ get_all_obs_correlations()

std::map< ExperimentObs, std::map< ExperimentObs, double > > StatisticInterface::get_all_obs_correlations ( )

Returns
Correlation matrix for the currently cached experimental observables.

Definition at line 144 of file StatisticInterface.cpp.

◆ get_all_obss_deps()

std::map< ParamId, double > StatisticInterface::get_all_obss_deps ( )

Selects all nuisance dependencies relevant to the current observable set.

Returns
Map of selected nuisance identifiers to central values.

Definition at line 132 of file StatisticInterface.cpp.

◆ get_obs_exp()

std::map< ExperimentObs, double > StatisticInterface::get_obs_exp ( )

Returns
Experimental central values selected for the current observable/experiment set.

Definition at line 148 of file StatisticInterface.cpp.

◆ get_p_specs()

std::map< ParamId, double > StatisticInterface::get_p_specs ( const std::vector< ParamId > &  p_specs)

Definition at line 136 of file StatisticInterface.cpp.

◆ has_experiment_observable_selection()

bool StatisticInterface::has_experiment_observable_selection ( ) const
noexcept

Tests whether an exact experimental-observable selection is active.

Returns
True if exact measurements were selected explicitly.

Definition at line 58 of file StatisticInterface.cpp.

◆ has_experiment_selection()

bool StatisticInterface::has_experiment_selection ( ) const
noexcept

Tests whether an experiment selection is active.

Returns
True if only a subset of experiments is selected.

Definition at line 38 of file StatisticInterface.cpp.

◆ prepare_likelihood_for_scan()

void StatisticInterface::prepare_likelihood_for_scan ( const std::vector< ParamId > &  p_specs)

Builds and stores the likelihood objects required for scan calls.

The current central values are also stored as the default scan center, so lightweight scans can run without computing a full MLE first. Calling compute_MLE(...) or set_manual_scan_point(...) later replaces that reference point.

Parameters
p_specsFit parameters defining the scan parameter space.

Definition at line 101 of file StatisticInterface.cpp.

◆ print_cache()

void StatisticInterface::print_cache ( )

Prints the current manager cache for diagnostics.

Definition at line 152 of file StatisticInterface.cpp.

◆ reload_nuisance_specs()

void StatisticInterface::reload_nuisance_specs ( )

Reloads default and user nuisance specifications.

Definition at line 86 of file StatisticInterface.cpp.

◆ save_likelihood_scan_csv()

void StatisticInterface::save_likelihood_scan_csv ( const std::string &  path,
const LikelihoodScanGrid grid 
) const

Saves a likelihood scan grid as a CSV file.

Parameters
pathOutput CSV path.
gridGrid to serialize.

Definition at line 123 of file StatisticInterface.cpp.

◆ scan_likelihood_around_current_point()

LikelihoodScanGrid StatisticInterface::scan_likelihood_around_current_point ( ParamId  p1,
ParamId  p2,
double  x_half_width,
double  y_half_width,
std::size_t  nx,
std::size_t  ny 
) const

Evaluates a rectangular likelihood scan around the current point.

Parameters
p1First scan parameter.
p2Second scan parameter.
x_half_widthHalf-width along the first parameter axis.
y_half_widthHalf-width along the second parameter axis.
nxNumber of grid points along x.
nyNumber of grid points along y.
Returns
Likelihood scan grid.

Definition at line 110 of file StatisticInterface.cpp.

◆ select_experiment()

void StatisticInterface::select_experiment ( const std::string &  experiment)

Restricts the analysis to a single experiment.

Parameters
experimentExperiment name to select.

Definition at line 23 of file StatisticInterface.cpp.

◆ select_experiment_observables()

void StatisticInterface::select_experiment_observables ( const std::vector< ExperimentObs > &  observables)

Restricts the analysis to exact experiment/observable/bin entries.

Parameters
observablesExact experimental measurements to keep.

Definition at line 46 of file StatisticInterface.cpp.

◆ select_experiment_observables_all()

void StatisticInterface::select_experiment_observables_all ( )

Clears any exact experimental-observable restriction.

Definition at line 53 of file StatisticInterface.cpp.

◆ select_experiments()

void StatisticInterface::select_experiments ( const std::vector< std::string > &  experiments)

Restricts the analysis to a set of experiments.

Parameters
experimentsExperiment names to select.

Definition at line 28 of file StatisticInterface.cpp.

◆ select_experiments_all()

void StatisticInterface::select_experiments_all ( )

Clears any experiment restriction and uses all experiments.

Definition at line 33 of file StatisticInterface.cpp.

◆ selected_experiment_observables()

std::set< ExperimentObs > StatisticInterface::selected_experiment_observables ( ) const

Returns the active exact experimental-observable selection.

Returns
Selected measurements, or an empty set when no exact selection is active.

Definition at line 62 of file StatisticInterface.cpp.

◆ selected_experiments()

std::set< std::string > StatisticInterface::selected_experiments ( ) const

Returns the currently selected experiments.

Returns
Selected experiment names, or an empty set when all experiments are selected.

Definition at line 42 of file StatisticInterface.cpp.

◆ set_manual_scan_point()

void StatisticInterface::set_manual_scan_point ( const std::map< ParamId, double > &  p_hat,
const std::map< ParamId, double > &  eta_hat 
)

Manually sets the central point used by likelihood scans.

Parameters
p_hatFit-parameter values at the scan center.
eta_hatNuisance-parameter values at the scan center.

Definition at line 105 of file StatisticInterface.cpp.

◆ set_nuisance_user_file()

void StatisticInterface::set_nuisance_user_file ( const std::string &  user_yaml_path)

Uses a specific user nuisance configuration file.

Parameters
user_yaml_pathPath to the user YAML file.

Definition at line 91 of file StatisticInterface.cpp.

◆ update_cache()

void StatisticInterface::update_cache ( const std::vector< ParamId > &  p_specs = std::vector<ParamId>())

Refreshes the cached statistical inputs.

Parameters
p_specsOptional fit-parameter list used to define nuisance pruning and dependency handling.

Definition at line 128 of file StatisticInterface.cpp.

Member Data Documentation

◆ ProfileBackend

StatisticInterface.ProfileBackend = ProfilerMode

Definition at line 69 of file StatisticInterface.py.


The documentation for this class was generated from the following files: