Professor is hosted by Hepforge, IPPP Durham

Changes between Version 1 and Version 2 of MiniManual

Mar 17, 2008, 1:50:17 PM (10 years ago)



  • MiniManual

    v1 v2  
    11= Professor !MiniManual =
    2 This page shows you how to put the different parts of Professor together. An example program is in the SVN repository: source:trunk/
     2This page holds links/explains which part of the code to use for single tasks.
     3Example programs are in SVN: source:trunk/examples/
    6 == Loading XML Files ==
    7 This is done using the getTuningData function from source:trunk/professor/
     7== Single Tasks ==
     9This section describes how to get parameter estimates. The code presented is based on source:trunk/examples/
     11=== 1. Load configuration and parse command line ===
     12For more information see the CentralConfiguration page. We give the script a
     13option ''datadir'' which sets the path where the ''mc/'' and ''ref/''
     14directories lie. This option can be set on the command line with ''--datadir''.
     17from import Config
     18conf = Config()
     20        {'datadir' : ('./', None, True, None)})
     24=== 2. Load the AIDA-XML files ===
     25We use !TuningData objects to store the MC and reference data. It's also
     26building lists with pairs of reference bin and interpolations.
     28To create a !TuningData object from a directory tree, there is a factory
     29funtion getTuningData in source:trunk/professor/ .
     34from professor.rivetreader import getTuningData
     35mcdir = os.path.join(conf.getOption('example', 'datadir'), 'mc')
     36refdir = os.path.join(conf.getOption('example', 'datadir'), 'ref')
     37tundat = getTuningData(refdir, mcdir)
     40=== 3. Build a minimization object and run a minimization ===
     41To minimize in professor, we need a minimizer, i.e. a wrapper around
     42external minimization packages. Supported are Scipy.optimize.fmin_powell
     43(!ScipyMinimizer in source:trunk/professor/minimize/ and
     44Minuit (!MinuitMinimizer  in
     45source:trunk/professor/minimize/ By default the minimize
     46sub-package exports !MinuitMinimizer as ''Minimizer'' with
     47!ScipyMinimizer as fall back. All minimizers take a !TuningData instance for
     48creation. From this it gets the data to minimize on.
     51It needs a !TuningData
     52 The minimizer wraps around the !TuningData. To start
     53a minimization you'll use the ''guessMinimum'' method. It takes 4 arguments:
     54 1. A string deciding how to determine the start point for the
     55 minimization. N.B. Minuit doesn't actually use this. Possible values are:
     56 center, minmc, random .
     57 2. A list of strings with the run numbers to use for this minimization. If
     58 the list is empty or ''None'', all runs are used.
     59 3. A list of with the observable names to use in this minimizations. If
     60 the list is empty or ''None'', all runs are used.
     61 4. A list with ''selection functions''. With this functions you can exclude
     62 bins on a per-bin-level. At the moment only one selection function is
     63 implemented (see: source:trunk/professor/minimize/
    11 == Central Configuration ==
     65The return value is a !MinimizationResult.
     70from professor.minimize import Minimizer
     71from professor.minimize import selectionfunctions
     72# set up data selection for the minimization
     73# use all observables
     74obs = []
     75# use all runs
     76runs = []
     77# use the only selection function we have
     78selfuncs = [selectionfunctions.OmitEmpty()]
     80minim = Minimizer(tundat)
     81result = minim.guessMinimum('center', obs=obs, runs=runs, selfuncs=selfuncs)
     84=== 4. Store a list of results ===
     85If you want to store minimization results, you can use the !ResultList from
     86source:trunk/professor/minimize/ . It's a list subclass that
     87allows writing/reading xml files.
     92# create empty list
     93results = ResultList()
     95# adding a MinimizationResult:
     98# writing filled list to xml file:
     101# loading from xml file:
     102results = ResultList.fromXML("path/to/results.xml")
     105== Other ==
     106=== Loading AIDA XML Files ===
     107This is done using the getTuningData function from source:trunk/professor/ This function returns a !TuningData object.
     109=== Central Configuration ===
    12110Information how to use the central configuration and logging module can be found on the wiki page [wiki:CentralConfiguration Central Configuration]
    14 == Parameter Handling ==
     112=== Parameter Handling ===
    15113Go [wiki:ParameterHandling here] for more information.