1 | #!/bin/sh |
---|
2 | |
---|
3 | version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'` |
---|
4 | |
---|
5 | progname=./Duchamp-$version |
---|
6 | |
---|
7 | 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 | |
---|
16 | echo "Running the first Duchamp test:" |
---|
17 | echo " [This is a simple sigma-clipping search]" |
---|
18 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
19 | $progname -p verification/input1 > /tmp/duchamptest |
---|
20 | echo "Done. Comparison to standard result:" |
---|
21 | numDet=`grep "Total number" verification/results1.txt | cut -f 6 -d " "` |
---|
22 | if [ $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=$numErrors+1 |
---|
30 | else |
---|
31 | echo " All detections correct." |
---|
32 | fi |
---|
33 | else |
---|
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=$numErrors+1 |
---|
38 | fi |
---|
39 | #Test the log files. |
---|
40 | if [ `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." |
---|
42 | else |
---|
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=$numErrors+1 |
---|
46 | fi |
---|
47 | |
---|
48 | ################################################################## |
---|
49 | # The next test uses the FDR method, but is otherwise the same. |
---|
50 | |
---|
51 | echo " " |
---|
52 | echo "Running the second Duchamp test:" |
---|
53 | echo " [This uses the FDR method]" |
---|
54 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
55 | $progname -p verification/input2 > /tmp/duchamptest |
---|
56 | echo "Done. Comparison to standard result:" |
---|
57 | set numDet = `grep "Total number" verification/results2.txt | cut -f 6 -d " "` |
---|
58 | if [ $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=$numErrors+1 |
---|
66 | else |
---|
67 | echo " All detections correct." |
---|
68 | fi |
---|
69 | else |
---|
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=$numErrors+1 |
---|
74 | fi |
---|
75 | #Test the log files. |
---|
76 | if [ `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." |
---|
78 | else |
---|
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=$numErrors+1 |
---|
82 | fi |
---|
83 | |
---|
84 | ################################################################## |
---|
85 | # The third test smoothes the cube and uses sigma-clipping |
---|
86 | |
---|
87 | echo " " |
---|
88 | echo "Running the third Duchamp test:" |
---|
89 | echo " [This spatially smoothes the cube, then searches with simple sigma-clipping]" |
---|
90 | echo " [It should take a bit longer than the first two.]" |
---|
91 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
92 | $progname -p verification/input3 > /tmp/duchamptest |
---|
93 | echo "Done. Comparison to standard result:" |
---|
94 | set numDet = `grep "Total number" verification/results3.txt | cut -f 6 -d " "` |
---|
95 | if [ $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=$numErrors+1 |
---|
103 | else |
---|
104 | echo " All detections correct." |
---|
105 | fi |
---|
106 | else |
---|
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=$numErrors+1 |
---|
111 | fi |
---|
112 | #Test the log files. |
---|
113 | if [ `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." |
---|
115 | else |
---|
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=$numErrors+1 |
---|
119 | fi |
---|
120 | |
---|
121 | ################################################################## |
---|
122 | # The final test reconstructs the cube and uses sigma-clipping |
---|
123 | |
---|
124 | echo " " |
---|
125 | echo "Running the fourth Duchamp test:" |
---|
126 | echo " [This reconstructs the cube, then searches with simple sigma-clipping]" |
---|
127 | echo " [It should take a bit longer again]" |
---|
128 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
129 | $progname -p verification/input4 > /tmp/duchamptest |
---|
130 | echo "Done. Comparison to standard result:" |
---|
131 | set numDet = `grep "Total number" verification/results4.txt | cut -f 6 -d " "` |
---|
132 | if [ $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=$numErrors+1 |
---|
140 | else |
---|
141 | echo " All detections correct." |
---|
142 | fi |
---|
143 | else |
---|
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=$numErrors+1 |
---|
148 | fi |
---|
149 | #Test the log files. |
---|
150 | if [ `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." |
---|
152 | else |
---|
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=$numErrors+1 |
---|
156 | fi |
---|
157 | |
---|
158 | ################################################################## |
---|
159 | # Summarise the results |
---|
160 | # Either give the OK, or give some advice about what to do. |
---|
161 | |
---|
162 | echo " " |
---|
163 | if [ $numErrors == 0 ]; then |
---|
164 | echo "No errors! Everything is working fine." |
---|
165 | echo " " |
---|
166 | echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
167 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
168 | else |
---|
169 | echo "There were some differences in the results compared to the standards." |
---|
170 | echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)." |
---|
171 | echo "If they are more serious (wrong number of sources found), submit a bug report" |
---|
172 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
173 | fi |
---|