HOW TO plot results of super-campaign analysis using tp-mc files.

This page details the recipe realised in the script

plot-merged

along with its "decoration" utility  decoration4plot
Both have help texts on option -h

plot-merged  has two contexts: Predictions and Residuals



This is what has happend up to the point when you'd like to plot results of super-campaign analysis:
urtapt has produced a set of merged files (with nuisance time parameters) one of wich is a *.jd.ts file with the MJD's of the drops.

Definitions:
type  - the string between the last two dots of the file name, e.g. ra or ph04
$VAR
- in the environment, a string that designates the analysis variant, e.g.  setenv VAR -O-expf  
For plotting you need tp-mc files with the MJD's in the first column. Use
ts2tpmc [options] type
It generates a file o/scg-cal-merged$VAR.type.mc with labels  MJC TYPE  
Do that for all result files that you want to plot.
A column with the uncertainties can be added, here to the all-residual:
tslist  t/urtap-merged.dw.ts -I -O:SIG o/scg-cal-merged$VAR.ra.mc
In a plot you'd abhor long stretches of time when nothing happens. Reducing the time scale is done with a tsf-edit command set provided in   tp.tse,D . 
Before you employ tp.tse , decide on the gap width (in days) for the plots. The default, 10, is wide.
Better perhaps:
setenv CLIPDTP 3.0
Check the last reduced date using
tslq o/scg-cal-merged$VAR.jd.ts -Etp.tse,D | fgrep Max
In plot-merged the (still hard-wired) end of the time axis is presently 100. Adjust it! (make it optional).

Campaign-, project- or set-wide averages of residuals can be produced. Here sets, where two sets would
be at least 60 seconds apart. (s60.)
tslist o/scg-cal-merged$VAR.ra.mc -qqq -LM -LR -LS -TPSs60.,+FR \
       -Etp.tse,D -Ft1,f13.7,1p,2e12.4 | fgrep -v '>' |\
  awk '{if(x!=$2){if(f){print f};if(r){print r};x=$2;f=$0};r=$0}'
where the awk-command shortens the output such that a minimum is kept for plotting straight lines.
For distinct symbols and error bars, use the following awk:
  awk '{if(x!=$2){if(f){print ($1+t)/2,$2,$3};t=$1;x=$2;f=$0};r=$0}'
(coded up slightly more complete in  collect-mean.awk
For projects, use -TPSh1.,+FR and campaigns -TPSd20.,+FR
There are alternative options. Default is to print one line for each auto-detected set / project / campaign.
These commands would typically pipe into a psxy command (GMT).
N.B. the output format and the cleaning of the pipe:  -Ft1,f13.7,1p,2e12.4 | fgrep -v '>'

Predicted results should be reduced for platform height. After
do-merging-job ... D
use
tp2tse-ploffs [options]
This produces a log-file  pfo.tse.log and a tse-file  pfo.tse,PFO ; the latter can be used in e.g.
tslist o/scg-cal-merged$VAR.ph04.mc -LM -LP -Epfo.tse,PFO ...
On the basis of the log file, decorations are added to show reduced platform levels.
For decoration you need the reduced time index of campaigns and projects. Use
tpindex-campaign -S $campaigns
With a little awk you can plot symbols and text using the result files (they are annonced by the script)
Assembled: campaigns-O-expf-index.dat
Assembled: projects-O-expf-index.dat

In order to add uncertainty to the predicted values,
make-tpprdsig
adds together the uncertainties of the parameter sets applying to each project, reading them from the
merged urtap analysis protocol. A three-column tslist'ed file with sigmas that don't change during the scope of a
project can be shortened

Now, the prerequisits are in place.

Annotating meters and orientations

awk '/ FG5-220 AA N/{print "> -St0.1 -G1/255/180/0 -W1/255/180/0"; print $1,"0"}'  projects$VAR-index.dat >> meter-orient.dat
awk '/ FG5-220 AA S/{print "> -Si0.1 -G1/255/180/0 -W1/255/180/0"; print $1,"0"}'  projects$VAR-index.dat >> meter-orient.dat
awk '/ FG5-220 AC N/{print "> -St0.1 -G1/255/180/0 -W1/255/180/0"; print $1,"1"}'  projects$VAR-index.dat >> meter-orient.dat
awk '/ FG5-233 AA N/{print "> -St0.1 -G1/0/180/255 -W1/0/180/255"; print $1,"0"}'  projects$VAR-index.dat >> meter-orient.dat
etc., platform by y-offset, orientation by triangle, meter by color
like in   decoration4plot  


decoration4plot -h
 
  USAGE:   decoration4plot [options]
 
  PURPOSE: Assembles an input file for psxy
           for representing projects with symbols
           designating platforms, meters, and orientations
 
           Must be manually edited if changes are needed.
 
           Optionally plots the decorations,
           optionally opens a plot surface,
 
           The next psxy command must/should use options
              -R0/100/<min>/max> -JX -Ba100/<tick>:"Y-title":W -O
           in order to define a Y-axis range.
           The plot is left with -R0/100/0/-0.5/0.5 (default) and -JX10/6
 
           The vertical bars are output to a file tmp/graybars.dat
 
 OPTIONS:
  -t           - test plot, complete and close.
  -t -p file   - test plot to named ps-file
  -p file      - plot to named ps-file and leave open.
  -S           - skip the preparation phase (it's needed only once)
  -r #b/#e     - begin and end of time axis [0/100]
  -s #x/#y     - plot size, appended to -JX
  -O           - continue on an open plot (keeps size, no X-offset)


plot-merged -h
 
 USAGE:         plot-merged [options - ] <type>
 
                The first character of <type> defines the context:
                p : predictions  (e.g. ph04 )
                r : residuals    (e.g. ra )

 PURPOSE:
                Plots residuals or predictions from super-campaign analysis
                results.
               
 OPTIONS:
 
  -Y #ylo/#yhi [ticks
                      - Y-axis range and ticks  

 
  -pfo file.tse       - tsf-edit file for platform offsets
                        (output of tp2tse-poffs)
                        if  file.tse.log exists, it is used
                        to plot the reduced platform levels
                        along with error margins
 
  -m <gap-def>        - In context "Residuals" defines
                        the gap width when a new mean value
                        is begun. For gap-def use ...
                  s#t - `s´ designating t seconds, for set means
                  h#t - `h´             t hours, for project means
                  d#t - `d´             t days, for campaign means
 
 ENVIRONMENT:    [default]
  setenv VAR     [-O-expf]
  setenv CLIPDTP [3.0]
  setenv PNGOUT  [~/www/4me/ag-superc]
 
 FILES:

  o/scg-cal-merged$VAR.$type.mc - in: a tp-mc file created from
                                  urtap merged ts-output using
                            ts2tpmc <type>
                                  In the case of residuals, add a
                                  column `SIG´(std-dev):
                            tslist t/urtap-merged.dw.ts -I -SO#scale -O:SIG
                                  The scale can be computed from
                                  urtap o/scg-cal-merged$VAR.prl : sqrt(Chi^2)
 
  tp$VAR-$type$mark.ps          - out: plot file, where mark is
                                  -sm , -pm , -cm for
residuals, 
                                  set-, project- or campaign-means,
                                  respectively.
 
  tmp/graybars.dat              - in:  decoration4plot is
                                  supposed to create gray vertical bars
                                  representing inter-campaign gaps
             
  t/prdsig$VAR.ts               - in:  uncertainties of predictions
                                  Created by
                            make-tpprdsig

 SCRIPTS:
   collect-mean.awk
   collect-mean-sig.awk
   decoration4plot




.bye