source: trunk/VerifyDuchamp.sh @ 326

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