source: trunk/VerifyDuchamp.sh @ 1075

Last change on this file since 1075 was 1073, checked in by MatthewWhiting, 12 years ago

Adding Karma annotation files to the verification script.

  • Property svn:executable set to *
File size: 4.2 KB
RevLine 
[754]1#!/bin/bash
[148]2
[389]3version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'`
[325]4
[361]5progname=./Duchamp-$version
[754]6dir=./verification
[338]7
[361]8numErrors=0
[325]9
[952]10ndet=(5 5 5 5 1 1 5 5 5)
11number=("first" "second" "third" "fourth" "fifth" "sixth" "seventh" "eighth" "ninth")
[754]12explanation=("This is a simple sigma-clipping search"
13"This uses the FDR method"
14"This spatially smoothes the cube, then searches with simple sigma-clipping"
15"This reconstructs the cube, then searches with simple sigma-clipping"
16"This just uses a small subsection of the full cube, with simple searching"
17"This reconstructs the subsection, then searches with simple sigma-clipping"
[890]18"This does the same as the first, and grows detections"
[952]19"This does the same as the first, but with regular statistics instead of robust"
20"This does the same as the first, but changing the spectral type, units, and rest frequency")
21explanation2=("-" "-" "It should take a bit longer than the first two." "It should take a bit longer again" "-" "-" "-" "-" "-")
[754]22
[325]23##################################################################
[754]24# Run the tests.
[325]25# First, test the results file, just looking at the number of sources
26#  and their pixel positions.
27# This is to avoid precision problems with the WCS positions.
28# Second, test the entire log files.
29
[754]30for (( i=0; i<${#number[@]}; i++ )); do
31   
32    N=`expr $i + 1`
33    in=${dir}/input${N}
34    res=${dir}/results${N}.txt
35    Sres=${dir}/stdResults${N}.txt
36    log=${dir}/log${N}.txt
37    Slog=${dir}/stdLog${N}.txt
[1062]38    vot=${dir}/results${N}.xml
[1073]39    Svot=${dir}/stdResults${N}.xml
40    karma=${dir}/results${N}.ann
41    Skarma=${dir}/stdResults${N}.ann
[148]42
[754]43    echo "Running the ${number[i]} Duchamp test:"
44    echo "  [${explanation[i]}]"
45    if  (( ( $i == "2" ) || ( $i == "3" ) )); then
46        echo "  [${explanation2[i]}]"
[361]47    fi
[754]48    rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
49    $progname -p $in > /tmp/duchamptest
50    echo "Done. Comparison to standard result:"
51    numDet=`grep "Total number" $res | cut -f 6 -d " "`
52    if [ $numDet == ${ndet[i]} ]; then
[939]53        tail -${numDet} $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
54        tail -${numDet} $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
[754]55        if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then
56            echo "  Found correct number of sources, but positions differ."
57            echo "  ERROR: Differences in positions of sources:"
58            diff -I"Results of the Duchamp source finder:" $res $Sres
59            numErrors=`expr $numErrors + 1`
60        else
61            echo "  All detections correct."
62        fi
[325]63    else
[754]64        echo "  ERROR. Wrong number of sources found."
65        echo "Differences in results:"
66        diff  -I"Results of the Duchamp source finder:" $res $Sres
[361]67        numErrors=$numErrors+1
68    fi
[1062]69
[325]70#Test the log files.
[1057]71    if [ `diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog | wc -l` == 0 ]; then
[754]72        echo "  Logfiles correct."
[604]73    else
[754]74        echo "  ERROR: Differences in the log files:"
[1057]75        diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog
[754]76        numErrors=`expr $numErrors + 1`
[604]77    fi
78
[1062]79#Test the VOTable results.
80    if [ `diff $vot $Svot | wc -l` == 0 ]; then
81        echo "  VOTables correct."
82    else
83        echo "  ERROR: Differences in the VOTables:"
84        diff $vot $Svot
85        numErrors=`expr $numErrors + 1`
86    fi
87
[1073]88#Test the Karma annotation files
89    if [ `diff $karma $Skarma | wc -l` == 0 ]; then
90        echo "  Karma annoation files correct."
91    else
92        echo "  ERROR: Differences in the Karma annotation files:"
93        diff $karma $Skarma
94        numErrors=`expr $numErrors + 1`
95    fi
96
[754]97    echo ""
98    echo ""
99   
100done
[604]101
[632]102##################################################################
[325]103# Summarise the results
104# Either give the OK, or give some advice about what to do.
105
[278]106echo " "
[361]107if [ $numErrors == 0 ]; then
[325]108    echo "No errors! Everything is working fine."
[354]109    echo " "
110    echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to"
[327]111    echo "  http://svn.atnf.csiro.au/trac/duchamp/newticket"
[325]112else
113    echo "There were some differences in the results compared to the standards."
114    echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)."
[486]115    echo "If they are more serious (e.g. wrong number of sources found), submit a bug report"
[327]116    echo "  at http://svn.atnf.csiro.au/trac/duchamp/newticket"
[361]117fi
Note: See TracBrowser for help on using the repository browser.