professor is hosted by Hepforge, IPPP Durham

professor.minimize

Introduction

The minimize package defines interfaces to external minimizers, most notably PyMinuit, and containers for minimization results.

minimizers

For an explanation how to use the minimizer see BaseMinimizer. Supported minimizers are:

  • ScipyMinimizer
  • PyMinuitMinimizer, which is used by default

A convenience function is available to get a minimizer that is available in the current Python installation: getMinimizerClass().

To get the default minimizer use:

>>> from professor.minimize import getMinimizerClass
>>> MinClass = getMinimizerClass()
>>> min = MinClass()
>>> min.guessMinimum(singletunedata, "center")

container classes

  • MinimizationResult

    A simple container for all data of one interpolation that is of interest for the different prof-* scripts.

  • ResultList

    A list of `MinimizationResult`s that are stored in one file on disk.

Documentation

professor.minimize.getMinimizerClass(which, useminos=False, printminuit=0)

Return the configured minimizer class.

If import fails we use SciPy as a fallback.

class professor.minimize.result.ResultList(results=None, validate=True)

Bases: list

Container class for storing list of MinimizationResults.

It is expected that all results were created with the same set of observables (and weighting).

Usage examples:

creating empty instance:

>>> results = ResultList()
adding a MinimizationResult:
>>> results.append(minresult)
writing filled list to xml file:
>>> results.write("path/to/results.xml")
creating instance from pickle file:
>>> results = ResultList.mkFromPickle("path/to/results.pkl")

Methods

filtered(ff)

Get filtered result list.

The returned ResultList will contain only results for that the filter function ff returned True.

classmethod fromDirectory(*args, **kwargs)
classmethod fromPickle(*args, **kwargs)
getCorrelationMatrix(*args, **kwargs)
getCorrelations(*args, **kwargs)
getCovariances(*args, **kwargs)
getIpolMethods()

Return a list of the IpolMethods used.

getKBest(K)

Return the K results that have the lowest GoF. @param K: an integer that specifies how many results you want.

getMaxRunsResults()

Return sublist with all results using the maximal #(runs).

This is a short-cut for:
>>> maxnrruns = max(rl.getRunCounts())
>>> new = rl.filtered(lambda mr: len(mr.runs) == maxnrruns)
getMinimum(*args, **kwargs)
getObservables()
getParamNames()
getParamValues(param, K=0)

Return all parameter values of a certain parameter param from either all results in the resultlist or the K best (in terms of GoF)

Parameters :

param : str

The parameter name.

K: int|’all’, optional :

Return only the parameter values of the K best results. If K is negative or zero all values are returned. The special value ‘all’ is accepted, too.

Returns :

values : numpy.ndarray

getResultsInsideKsigmaEllipsisOfM0(*args, **kwargs)
getResultsInsideRange(rangedict)

Return only those Minimization Results that are inside parameter ranges specified via rangedict.

getRunCounts()

Return a list with the different numbers of runs used for the results.

getSampleCorrelations(retcov=False)

Return the sample correlation (or covariance) matrix.

This uses the numpy implementation of the covariance estimator.

To create nice color plots from the output of this function you can do the following:

>>> corrcoeffs = resultlist.getSampleCorrelations()
>>> paramnames = resultlist.getParamNames()
>>> X, Y = pyplot.meshgrid(arange(len(paramnames) + 1),
... arange(len(paramnames) + 1))
>>> # the y-axis (= axis 0 in pcolor semantics) must be inverted
... # to get the usual matrix ordering
...
>>> pyplot.pcolor(X, Y, corrcoeffs[::-1], vmin=-1.0, vmax=1.0)
Parameters :

retcov : bool, optional

Return the covariance matrix instead if set to True.

getSampleCovMat(*args, **kwargs)
getUnique(*args, **kwargs)
isValid()

Perform some validity checks.

  • Checks if all stored results have the same parameters.
  • Checks if all stored results have the same set of observables.
@raises FixedSortedKeysError: if results have different parameter names
@see{FixedSortedKeys.goodPartner()}.

@raises ValueError: if results have different sets of observables.

mean(param)

Return weighted mean of param values and the mean of the largest and the smallest uncertainty as typical error.

classmethod mkFromDirectory(directory='.', identifier='results')

Create a ResultList instance from all identifier*.pkl files found in the directory specified via directory NOTE: you need to know what you are doing here, validation is switched of here!

classmethod mkFromPickle(path)
names
translateCovariance(*args, **kwargs)
write(outfile)

Write MinimizationResults as pickle/cPickle object to outfile

Table Of Contents

Previous topic

professor.interpolation

Next topic

professor.histo

This Page