Professor is hosted by Hepforge, IPPP Durham

Professor MiniManual

This page holds links/explains which part of the code to use for single tasks. Example programs are in SVN: source:trunk/examples/

Single Tasks

This section describes how to get parameter estimates. The code presented is based on source:trunk/examples/

1. Load configuration and parse command line

For more information see the CentralConfiguration page. We give the script a option datadir which sets the path where the mc/ and ref/ directories lie. This option can be set on the command line with --datadir.

from import Config
conf = Config()
        {'datadir' : ('./', None, True, None)})

2. Load the AIDA-XML files

We use TuningData objects to store the MC and reference data. It's also building lists with pairs of reference bin and interpolations.

To create a TuningData object from a directory tree, there is a factory funtion getTuningData in source:trunk/professor/ .


from professor.rivetreader import getTuningData
mcdir = os.path.join(conf.getOption('example', 'datadir'), 'mc')
refdir = os.path.join(conf.getOption('example', 'datadir'), 'ref')
tundat = getTuningData(refdir, mcdir)

3. Build a minimization object and run a minimization

To minimize in professor, we need a minimizer, i.e. a wrapper around external minimization packages. Supported are Scipy.optimize.fmin_powell (ScipyMinimizer in source:trunk/professor/minimize/ and Minuit (MinuitMinimizer in source:trunk/professor/minimize/ By default the minimize sub-package exports MinuitMinimizer as Minimizer with ScipyMinimizer as fall back. All minimizers take a TuningData instance for creation. From this it gets the data to minimize on.

It needs a TuningData

The minimizer wraps around the TuningData. To start

a minimization you'll use the guessMinimum method. It takes 4 arguments:

  1. A string deciding how to determine the start point for the minimization. N.B. Minuit doesn't actually use this. Possible values are: center, minmc, random .
  2. A list of strings with the run numbers to use for this minimization. If the list is empty or None, all runs are used.
  3. A list of with the observable names to use in this minimizations. If the list is empty or None, all runs are used.
  4. A list with selection functions. With this functions you can exclude bins on a per-bin-level. At the moment only one selection function is implemented (see: source:trunk/professor/minimize/

The return value is a MinimizationResult.


from professor.minimize import Minimizer
from professor.minimize import selectionfunctions
# set up data selection for the minimization
# use all observables
obs = []
# use all runs
runs = []
# use the only selection function we have
selfuncs = [selectionfunctions.OmitEmpty()]

minim = Minimizer(tundat)
result = minim.guessMinimum('center', obs=obs, runs=runs, selfuncs=selfuncs)

4. Store a list of results

If you want to store minimization results, you can use the ResultList from source:trunk/professor/minimize/ . It's a list subclass that allows writing/reading xml files.


# create empty list
results = ResultList()

# adding a MinimizationResult:

# writing filled list to xml file:

# loading from xml file:
results = ResultList.fromXML("path/to/results.xml")


Loading AIDA XML Files

This is done using the getTuningData function from source:trunk/professor/ This function returns a TuningData object.

Central Configuration

Information how to use the central configuration and logging module can be found on the wiki page Central Configuration

Parameter Handling

Go here for more information.

Last modified 10 years ago Last modified on Mar 17, 2008, 1:50:17 PM