Difference: PlotAlignmentDB (3 vs. 4)

Revision 42010-06-18 - NicolaChiapolini

Line: 1 to 1
 
META TOPICPARENT name="AlignmentOpenIssues"

Plot Tool for AlignmentDB

Changed:
<
<
The tool is a python script plots.py located in Alignment/Escher/scripts. The relevant commit is tagged as bursche_20100527.
>
>
The tool is a python script plots.py located in Alignment/Escher/scripts. The relevant commit is tagged as nchiapol_20100618.
  The command line to run the tool: %SYNTAX{ syntax="sh"}%
Changed:
<
<
python plots.py output.txt -s ~/newAlignment/Alignment.db
>
>
python -i plots.py
 %ENDSYNTAX%
Changed:
<
<
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.
>
>
By default the tool uses CondDB and DDDB with tag head-20100518 and creates some simple plots for TT. These plots are saved to pdf-Files. The tool provides two command line options. -t to change the filetype and -d to add database layers. The class definitions for this tool are all in libPlots.py. I recommend to have a look at that file.
 

Types of plots

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

Adjusting plots

Changed:
<
<
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:
>
>
Plots can be added or adjusted directly in the code in Alignment/Escher/scripts/plots.py. The file examplePlots.py contains a large number of predefined plots you can copy and paste into plots.py. Plots are represented either by instances of the class Plot or by instances of the class ArrowPlot:
  two examples %SYNTAX{ syntax="python"}%
Changed:
<
<
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])
>
>
ArrowPlot("VeLo-ZXarr",".*",lambda do:[do.Z,do.Z+10*do.TZ,do.X,do.X+10*do.TX],lambda do:do.Z<500) Plot("TT-ZtX","/TT(?!T)(?!.*Sensor.*)",lambda do:[do.Z,do.TX])
 %ENDSYNTAX%
Changed:
<
<
  • 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 first argument is the name and will be the base name of the saved file.
 
  • The second object is a regular expression to select the objects to plot.
Changed:
<
<
  • 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.
>
>
  • The third argument is a function taking an object of type ElementGeometry and returning two respectively four numbers. All members of ElementGeometry can be used as return values.
Any function can fulfilling these requirements can be used. For simple things lambda forms (see below) are very useful. For examples look at examplePlots.py and the class PlotFunctions in libPlots.py
  • The fourth argument is optional and allows to select spacial regions to plot. Its again a function taking an instance of ElementGeometry and returning a bool this time.
 
Changed:
<
<
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.
>
>
When a Plot (or Arrow Plot) object is appended to plots the script will assure its correctly filled and the output is saved. Different plots can be combined by using the function drawCombinedPlot. An example of how to use it can be found in the code as well.
 

lambda forms

Lambda forms are a shorthand to create anonymous functions. The following two lines create an identical function f(x)
Line: 46 to 46
 The python reference for lambda forms can be found at: http://docs.python.org/reference/expressions.html#lambda

-- AlbertBursche - 27-May-2010

Added:
>
>
-- NicolaChiapolini - 18-Jun-2010
 
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