threeML.minimizer.minimization module

exception threeML.minimizer.minimization.BetterMinimumDuringProfiling[source]

Bases: RuntimeWarning

exception threeML.minimizer.minimization.CannotComputeCovariance[source]

Bases: RuntimeWarning

exception threeML.minimizer.minimization.CannotComputeErrors[source]

Bases: RuntimeWarning

exception threeML.minimizer.minimization.FitFailed[source]

Bases: Exception

class threeML.minimizer.minimization.FunctionWrapper(function, all_parameters, fixed_parameters)[source]

Bases: object

set_fixed_values(new_fixed_values)[source]
class threeML.minimizer.minimization.GlobalMinimization(minimizer_type)[source]

Bases: _Minimization

get_instance(*args, **kwargs)[source]
get_second_minimization_instance(*args, **kwargs)[source]
setup(**setup_dict)[source]
class threeML.minimizer.minimization.GlobalMinimizer(function, parameters, verbosity=1, setup_dict=None)[source]

Bases: Minimizer

class threeML.minimizer.minimization.LocalMinimization(minimizer_type)[source]

Bases: _Minimization

get_instance(*args, **kwargs)[source]
class threeML.minimizer.minimization.LocalMinimizer(function, parameters, verbosity=1, setup_dict=None)[source]

Bases: Minimizer

class threeML.minimizer.minimization.Minimizer(function, parameters, verbosity=1, setup_dict=None)[source]

Bases: object

property Npar
property algorithm_name
contours(param_1, param_1_minimum, param_1_maximum, param_1_n_steps, param_2=None, param_2_minimum=None, param_2_maximum=None, param_2_n_steps=None, progress=True, **options)[source]

Generate confidence contours for the given parameters by stepping for the given number of steps between the given boundaries. Call it specifying only source_1, param_1, param_1_minimum and param_1_maximum to generate the profile of the likelihood for parameter 1. Specify all parameters to obtain instead a 2d contour of param_1 vs param_2

Parameters:
  • param_1 – name of the first parameter

  • param_1_minimum – lower bound for the range for the first parameter

  • param_1_maximum – upper bound for the range for the first parameter

  • param_1_n_steps – number of steps for the first parameter

  • param_2 – name of the second parameter

  • param_2_minimum – lower bound for the range for the second parameter

  • param_2_maximum – upper bound for the range for the second parameter

  • param_2_n_steps – number of steps for the second parameter

  • progress – (True or False) whether to display progress or not

  • log – by default the steps are taken linearly. With this optional parameter you can provide a tuple of

booleans which specify whether the steps are to be taken logarithmically. For example, ‘log=(True,False)’ specify that the steps for the first parameter are to be taken logarithmically, while they are linear for the second parameter. If you are generating the profile for only one parameter, you can specify

‘log=(True,)’ or ‘log=(False,)’ (optional)

Param:

parallel: whether to use or not parallel computation (default:False)

Returns:

a : an array corresponding to the steps for the first parameter b : an array corresponding to the steps for the second parameter (or None if stepping only in one direction) contour : a matrix of size param_1_steps x param_2_steps containing the value of the function at the corresponding points in the grid. If param_2_steps is None (only one parameter), then this reduces to an array of size param_1_steps.

property correlation_matrix
property covariance_matrix
property fit_results
property function
get_errors()[source]

Compute asymmetric errors using the profile likelihood method (slow, but accurate).

Returns:

a dictionary with asymmetric errors for each parameter

minimize(compute_covar=True)[source]

Minimize objective function. This call _minimize, which is implemented by each subclass.

Parameters:

compute_covar

Returns:

best fit values (in external reference) and minimum of the objective function

property parameters
restore_best_fit()[source]

Reset all the parameters to their best fit value (from the last run fit)

Returns:

none

set_algorithm(algorithm)[source]
property verbosity
exception threeML.minimizer.minimization.MinimizerNotAvailable[source]

Bases: Exception

exception threeML.minimizer.minimization.ParameterIsNotFree[source]

Bases: Exception

class threeML.minimizer.minimization.ProfileLikelihood(minimizer_instance, fixed_parameters)[source]

Bases: object

step(steps1, steps2=None)[source]
threeML.minimizer.minimization.get_minimizer(minimizer_type)[source]

Return the requested minimizer class (not instance)

Parameters:

minimizer_type – MINUIT, ROOT, PYOPT…

Returns:

the class (i.e., the type) for the requested minimizer