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
Line 
1#!/bin/bash
2
3version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'`
4
5progname=./Duchamp-$version
6dir=./verification
7
8numErrors=0
9
10ndet=(5 5 5 5 1 1 5 5 5)
11number=("first" "second" "third" "fourth" "fifth" "sixth" "seventh" "eighth" "ninth")
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"
18"This does the same as the first, and grows detections"
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" "-" "-" "-" "-" "-")
22
23##################################################################
24# Run the tests.
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
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
38    vot=${dir}/results${N}.xml
39    Svot=${dir}/stdResults${N}.xml
40    karma=${dir}/results${N}.ann
41    Skarma=${dir}/stdResults${N}.ann
42
43    echo "Running the ${number[i]} Duchamp test:"
44    echo "  [${explanation[i]}]"
45    if  (( ( $i == "2" ) || ( $i == "3" ) )); then
46        echo "  [${explanation2[i]}]"
47    fi
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
53        tail -${numDet} $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
54        tail -${numDet} $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
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
63    else
64        echo "  ERROR. Wrong number of sources found."
65        echo "Differences in results:"
66        diff  -I"Results of the Duchamp source finder:" $res $Sres
67        numErrors=$numErrors+1
68    fi
69
70#Test the log files.
71    if [ `diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog | wc -l` == 0 ]; then
72        echo "  Logfiles correct."
73    else
74        echo "  ERROR: Differences in the log files:"
75        diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog
76        numErrors=`expr $numErrors + 1`
77    fi
78
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
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
97    echo ""
98    echo ""
99   
100done
101
102##################################################################
103# Summarise the results
104# Either give the OK, or give some advice about what to do.
105
106echo " "
107if [ $numErrors == 0 ]; then
108    echo "No errors! Everything is working fine."
109    echo " "
110    echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to"
111    echo "  http://svn.atnf.csiro.au/trac/duchamp/newticket"
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)."
115    echo "If they are more serious (e.g. wrong number of sources found), submit a bug report"
116    echo "  at http://svn.atnf.csiro.au/trac/duchamp/newticket"
117fi
Note: See TracBrowser for help on using the repository browser.