Plot Tool for AlignmentDB

The tool is a python script plots.py located in Alignment/Escher/scripts. The relevant commit is tagged as bursche_20100527.

The command line to run the tool:

python plots.py output.txt -s ~/newAlignment/Alignment.db
The tool dumps all the alignment constants to output.txt. Usually they are not needed and one can use /dev/null instead of output.txt.

Types of plots

There are two types of plots
  • normal plots (class Plot)
  • arrow plots (class ArrowPlot) displaying an arrow between the survey position and the aligned position.

Adjusting plots

Plots can be added or adjusted directly in the code in Alignment/Escher/scripts/plots.py. This takes one line per plot! Plots are represented either by instances of the class Plot or by instances of the class ArrowPlot:

two examples

ArrowPlot("VeLo-ZXarr"+opts.plot,".*",lambda do:[do.Z,do.Z+10*do.TZ,do.X,do.X+10*do.TX],lambda do:do.Z<500)
Plot("TT-ZtX"+opts.plot,"/TT(?!T)(?!.*Sensor.*)",lambda do:[do.Z,do.TX])
  • The first argument is the name and will be the filename after the script is run. opts.plot allows to set an file extension from the command line and is ".png" by default.
  • The second object is a regular expression to select the objects to plot.
  • The third argument function taking a DetectorObject and returning two respectively four numbers. All members of DetectorObject can be used as return values. Combinations of members can be used as well but in these cases editing initialiseAxes can be nessecary to get correct axis labels. The idea is to use lambda forms (see below) but all functions can be used here.
  • The fourth argument is optional and allows to select spacial regions to plot. Its again a function taking a DetectorObject and returning a bool this time.

When a Plot (or ArrowPlot) object it appended to the list plots the script will assure its correctly filled and the output is saved. There are many plots allready by default in the code so you will probably be able to copy one of the calls and edit it to plot, whatever you are interested in.

lambda forms

Lambda forms are a shorthand to create anonymous functions. The following two lines create an identical function f(x)
>>> # using lambda forms
>>> f = lambda x:x+1

>>> # using normal functions
>>> def f(x): return x+1
The python reference for lambda forms can be found at: http://docs.python.org/reference/expressions.html#lambda

-- AlbertBursche - 27-May-2010

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r3 - 2010-06-09 - NicolaChiapolini
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback