source: tags/release-1.1.1/VerifyDuchamp.sh @ 1213

Last change on this file since 1213 was 337, checked in by MatthewWhiting, 17 years ago

Fixing the verification script so that it can see the executable that make produces.

  • Property svn:executable set to *
File size: 7.7 KB
Line 
1#!/bin/tcsh
2
3set version = `./Duchamp* -v | awk '{print $3}'`
4
5set progname = ./Duchamp-$version
6
7set numErrors = 0
8
9##################################################################
10# Run the first test, looking at simple sigma-clipped search
11# First, test the results file, just looking at the number of sources
12#  and their pixel positions.
13# This is to avoid precision problems with the WCS positions.
14# Second, test the entire log files.
15
16echo "Running the first Duchamp test:"
17echo "  [This is a simple sigma-clipping search]"
18rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
19$progname -p verification/input1 > /tmp/duchamptest
20echo "Done. Comparison to standard result:"
21set numDet = `grep "Total number" verification/results1.txt | cut -f 6 -d " "`
22if( $numDet == 5 ) then
23    tail -5 verification/results1.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
24    tail -5 verification/stdResults1.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
25    if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then
26        echo "  Found correct number of sources, but positions differ."
27        echo "  ERROR: Differences in positions of sources:"
28        diff  -I"Results of the Duchamp source finder:" verification/results1.txt verification/stdResults1.txt
29        $numErrors++
30    else
31        echo "  All detections correct."
32    endif
33else
34    echo "  ERROR. Wrong number of sources found."
35    echo "Differences in results:"
36    diff  -I"Results of the Duchamp source finder:" verification/results1.txt verification/stdResults1.txt
37    $numErrors++
38endif
39#Test the log files.
40if( `diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log1.txt verification/stdLog1.txt | wc -l` == 0 ) then
41    echo "  Logfiles correct."
42else
43    echo "  ERROR: Differences in the log files:"
44    diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log1.txt verification/stdLog1.txt
45    $numErrors++
46endif
47
48##################################################################
49# The next test uses the FDR method, but is otherwise the same.
50
51echo " "
52echo "Running the second Duchamp test:"
53echo "  [This uses the FDR method]"
54rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
55$progname -p verification/input2 > /tmp/duchamptest
56echo "Done. Comparison to standard result:"
57set numDet = `grep "Total number" verification/results2.txt | cut -f 6 -d " "`
58if( $numDet == 5 ) then
59    tail -5 verification/results2.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
60    tail -5 verification/stdResults2.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
61    if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then
62        echo "  Found correct number of sources, but positions differ."
63        echo "  ERROR: Differences in positions of sources:"
64        diff  -I"Results of the Duchamp source finder:" verification/results2.txt verification/stdResults2.txt
65        $numErrors++
66    else
67        echo "  All detections correct."
68    endif
69else
70    echo "  ERROR. Wrong number of sources found."
71    echo "Differences in results:"
72    diff  -I"Results of the Duchamp source finder:" verification/results2.txt verification/stdResults2.txt
73    $numErrors++
74endif
75#Test the log files.
76if( `diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log2.txt verification/stdLog2.txt | wc -l` == 0 ) then
77    echo "  Logfiles correct."
78else
79    echo "  ERROR: Differences in the log files:"
80    diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log2.txt verification/stdLog2.txt
81    $numErrors++
82endif
83
84##################################################################
85# The third test smoothes the cube and uses sigma-clipping
86
87echo " "
88echo "Running the third Duchamp test:"
89echo "  [This spatially smoothes the cube, then searches with simple sigma-clipping]"
90echo "  [It should take a bit longer than the first two.]"
91rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
92$progname -p verification/input3 > /tmp/duchamptest
93echo "Done. Comparison to standard result:"
94set numDet = `grep "Total number" verification/results3.txt | cut -f 6 -d " "`
95if( $numDet == 5 ) then
96    tail -5 verification/results3.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
97    tail -5 verification/stdResults3.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
98    if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then
99        echo "  Found correct number of sources, but positions differ."
100        echo "  ERROR: Differences in positions of sources:"
101        diff  -I"Results of the Duchamp source finder:" verification/results3.txt verification/stdResults3.txt
102        $numErrors++
103    else
104        echo "  All detections correct."
105    endif
106else
107    echo "  ERROR. Wrong number of sources found."
108    echo "Differences in results:"
109    diff  -I"Results of the Duchamp source finder:" verification/results3.txt verification/stdResults3.txt
110    $numErrors++
111endif
112#Test the log files.
113if( `diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log3.txt verification/stdLog3.txt | wc -l` == 0 ) then
114    echo "  Logfiles correct."
115else
116    echo "  ERROR: Differences in the log files:"
117    diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log3.txt verification/stdLog3.txt
118    $numErrors++
119endif
120
121##################################################################
122# The final test reconstructs the cube and uses sigma-clipping
123
124echo " "
125echo "Running the fourth Duchamp test:"
126echo "  [This reconstructs the cube, then searches with simple sigma-clipping]"
127echo "  [It should take a bit longer again]"
128rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
129$progname -p verification/input4 > /tmp/duchamptest
130echo "Done. Comparison to standard result:"
131set numDet = `grep "Total number" verification/results4.txt | cut -f 6 -d " "`
132if( $numDet == 5 ) then
133    tail -5 verification/results4.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
134    tail -5 verification/stdResults4.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
135    if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then
136        echo "  Found correct number of sources, but positions differ."
137        echo "  ERROR: Differences in positions of sources:"
138        diff  -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt
139        $numErrors++
140    else
141        echo "  All detections correct."
142    endif
143else
144    echo "  ERROR. Wrong number of sources found."
145    echo "Differences in results:"
146    diff  -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt
147    $numErrors++
148endif
149#Test the log files.
150if( `diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log4.txt verification/stdLog4.txt | wc -l` == 0 ) then
151    echo "  Logfiles correct."
152else
153    echo "  ERROR: Differences in the log files:"
154    diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log4.txt verification/stdLog4.txt
155    $numErrors++
156endif
157
158##################################################################
159# Summarise the results
160# Either give the OK, or give some advice about what to do.
161
162echo " "
163if( $numErrors == 0 ) then
164    echo "No errors! Everything is working fine."
165    echo "\nHappy Finding! If you ever need to report a bug or request an upgrade, go to"
166    echo "  http://svn.atnf.csiro.au/trac/duchamp/newticket"
167else
168    echo "There were some differences in the results compared to the standards."
169    echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)."
170    echo "If they are more serious (wrong number of sources found), submit a bug report"
171    echo "  at http://svn.atnf.csiro.au/trac/duchamp/newticket"
172endif
Note: See TracBrowser for help on using the repository browser.