[500] | 1 | #!/bin/bash |
---|
[148] | 2 | |
---|
[389] | 3 | version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'` |
---|
[325] | 4 | |
---|
[361] | 5 | progname=./Duchamp-$version |
---|
[338] | 6 | |
---|
[361] | 7 | numErrors=0 |
---|
[325] | 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 | |
---|
[148] | 16 | echo "Running the first Duchamp test:" |
---|
| 17 | echo " [This is a simple sigma-clipping search]" |
---|
[325] | 18 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 19 | $progname -p verification/input1 > /tmp/duchamptest |
---|
[148] | 20 | echo "Done. Comparison to standard result:" |
---|
[361] | 21 | numDet=`grep "Total number" verification/results1.txt | cut -f 6 -d " "` |
---|
| 22 | if [ $numDet == 5 ]; then |
---|
[325] | 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 |
---|
[361] | 25 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
[325] | 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 |
---|
[361] | 29 | numErrors=$numErrors+1 |
---|
[325] | 30 | else |
---|
| 31 | echo " All detections correct." |
---|
[361] | 32 | fi |
---|
[325] | 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 |
---|
[361] | 37 | numErrors=$numErrors+1 |
---|
| 38 | fi |
---|
[325] | 39 | #Test the log files. |
---|
[453] | 40 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log1.txt verification/stdLog1.txt | wc -l` == 0 ]; then |
---|
[325] | 41 | echo " Logfiles correct." |
---|
| 42 | else |
---|
| 43 | echo " ERROR: Differences in the log files:" |
---|
[453] | 44 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log1.txt verification/stdLog1.txt |
---|
[361] | 45 | numErrors=$numErrors+1 |
---|
| 46 | fi |
---|
[148] | 47 | |
---|
[325] | 48 | ################################################################## |
---|
| 49 | # The next test uses the FDR method, but is otherwise the same. |
---|
| 50 | |
---|
[154] | 51 | echo " " |
---|
[148] | 52 | echo "Running the second Duchamp test:" |
---|
| 53 | echo " [This uses the FDR method]" |
---|
[325] | 54 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 55 | $progname -p verification/input2 > /tmp/duchamptest |
---|
[148] | 56 | echo "Done. Comparison to standard result:" |
---|
[325] | 57 | set numDet = `grep "Total number" verification/results2.txt | cut -f 6 -d " "` |
---|
[361] | 58 | if [ $numDet == 5 ]; then |
---|
[325] | 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 |
---|
[361] | 61 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
[325] | 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 |
---|
[361] | 65 | numErrors=$numErrors+1 |
---|
[325] | 66 | else |
---|
| 67 | echo " All detections correct." |
---|
[361] | 68 | fi |
---|
[325] | 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 |
---|
[361] | 73 | numErrors=$numErrors+1 |
---|
| 74 | fi |
---|
[325] | 75 | #Test the log files. |
---|
[453] | 76 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log2.txt verification/stdLog2.txt | wc -l` == 0 ]; then |
---|
[325] | 77 | echo " Logfiles correct." |
---|
| 78 | else |
---|
| 79 | echo " ERROR: Differences in the log files:" |
---|
[453] | 80 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log2.txt verification/stdLog2.txt |
---|
[361] | 81 | numErrors=$numErrors+1 |
---|
| 82 | fi |
---|
[148] | 83 | |
---|
[325] | 84 | ################################################################## |
---|
| 85 | # The third test smoothes the cube and uses sigma-clipping |
---|
| 86 | |
---|
[154] | 87 | echo " " |
---|
[148] | 88 | echo "Running the third Duchamp test:" |
---|
[278] | 89 | echo " [This spatially smoothes the cube, then searches with simple sigma-clipping]" |
---|
[325] | 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 |
---|
[278] | 93 | echo "Done. Comparison to standard result:" |
---|
[325] | 94 | set numDet = `grep "Total number" verification/results3.txt | cut -f 6 -d " "` |
---|
[361] | 95 | if [ $numDet == 5 ]; then |
---|
[325] | 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 |
---|
[361] | 98 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
[325] | 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 |
---|
[361] | 102 | numErrors=$numErrors+1 |
---|
[325] | 103 | else |
---|
| 104 | echo " All detections correct." |
---|
[361] | 105 | fi |
---|
[325] | 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 |
---|
[361] | 110 | numErrors=$numErrors+1 |
---|
| 111 | fi |
---|
[325] | 112 | #Test the log files. |
---|
[453] | 113 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log3.txt verification/stdLog3.txt | wc -l` == 0 ]; then |
---|
[325] | 114 | echo " Logfiles correct." |
---|
| 115 | else |
---|
| 116 | echo " ERROR: Differences in the log files:" |
---|
[453] | 117 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log3.txt verification/stdLog3.txt |
---|
[361] | 118 | numErrors=$numErrors+1 |
---|
| 119 | fi |
---|
[278] | 120 | |
---|
[325] | 121 | ################################################################## |
---|
| 122 | # The final test reconstructs the cube and uses sigma-clipping |
---|
| 123 | |
---|
[278] | 124 | echo " " |
---|
| 125 | echo "Running the fourth Duchamp test:" |
---|
[148] | 126 | echo " [This reconstructs the cube, then searches with simple sigma-clipping]" |
---|
[325] | 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 |
---|
[148] | 130 | echo "Done. Comparison to standard result:" |
---|
[325] | 131 | set numDet = `grep "Total number" verification/results4.txt | cut -f 6 -d " "` |
---|
[361] | 132 | if [ $numDet == 5 ]; then |
---|
[325] | 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 |
---|
[361] | 135 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
[325] | 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 |
---|
[361] | 139 | numErrors=$numErrors+1 |
---|
[325] | 140 | else |
---|
| 141 | echo " All detections correct." |
---|
[361] | 142 | fi |
---|
[325] | 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 |
---|
[361] | 147 | numErrors=$numErrors+1 |
---|
| 148 | fi |
---|
[325] | 149 | #Test the log files. |
---|
[453] | 150 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log4.txt verification/stdLog4.txt | wc -l` == 0 ]; then |
---|
[325] | 151 | echo " Logfiles correct." |
---|
| 152 | else |
---|
| 153 | echo " ERROR: Differences in the log files:" |
---|
[453] | 154 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log4.txt verification/stdLog4.txt |
---|
[361] | 155 | numErrors=$numErrors+1 |
---|
| 156 | fi |
---|
[148] | 157 | |
---|
[325] | 158 | ################################################################## |
---|
[604] | 159 | # We now do two tests using the subsection functionality. |
---|
| 160 | # First just using the basic search |
---|
| 161 | |
---|
| 162 | echo " " |
---|
| 163 | echo "Running the fifth Duchamp test:" |
---|
| 164 | echo " [This just uses a small subsection of the full cube, with simple searching]" |
---|
| 165 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 166 | $progname -p verification/input5 > /tmp/duchamptest |
---|
| 167 | echo "Done. Comparison to standard result:" |
---|
| 168 | set numDet = `grep "Total number" verification/results4.txt | cut -f 6 -d " "` |
---|
| 169 | if [ $numDet == 5 ]; then |
---|
| 170 | tail -5 verification/results5.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
| 171 | tail -5 verification/stdResults5.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
| 172 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
| 173 | echo " Found correct number of sources, but positions differ." |
---|
| 174 | echo " ERROR: Differences in positions of sources:" |
---|
| 175 | diff -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt |
---|
| 176 | numErrors=$numErrors+1 |
---|
| 177 | else |
---|
| 178 | echo " All detections correct." |
---|
| 179 | fi |
---|
| 180 | else |
---|
| 181 | echo " ERROR. Wrong number of sources found." |
---|
| 182 | echo "Differences in results:" |
---|
| 183 | diff -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt |
---|
| 184 | numErrors=$numErrors+1 |
---|
| 185 | fi |
---|
| 186 | #Test the log files. |
---|
| 187 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log5.txt verification/stdLog5.txt | wc -l` == 0 ]; then |
---|
| 188 | echo " Logfiles correct." |
---|
| 189 | else |
---|
| 190 | echo " ERROR: Differences in the log files:" |
---|
| 191 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log5.txt verification/stdLog5.txt |
---|
| 192 | numErrors=$numErrors+1 |
---|
| 193 | fi |
---|
| 194 | |
---|
| 195 | ################################################################## |
---|
[632] | 196 | # This test uses the subsection, but does the reconstruction as well |
---|
[604] | 197 | |
---|
| 198 | echo " " |
---|
| 199 | echo "Running the sixth Duchamp test:" |
---|
| 200 | echo " [This reconstructs the subsection, then searches with simple sigma-clipping]" |
---|
| 201 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 202 | $progname -p verification/input6 > /tmp/duchamptest |
---|
| 203 | echo "Done. Comparison to standard result:" |
---|
| 204 | set numDet = `grep "Total number" verification/results6.txt | cut -f 6 -d " "` |
---|
| 205 | if [ $numDet == 5 ]; then |
---|
| 206 | tail -5 verification/results6.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
| 207 | tail -5 verification/stdResults6.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
| 208 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
| 209 | echo " Found correct number of sources, but positions differ." |
---|
| 210 | echo " ERROR: Differences in positions of sources:" |
---|
| 211 | diff -I"Results of the Duchamp source finder:" verification/results6.txt verification/stdResults6.txt |
---|
| 212 | numErrors=$numErrors+1 |
---|
| 213 | else |
---|
| 214 | echo " All detections correct." |
---|
| 215 | fi |
---|
| 216 | else |
---|
| 217 | echo " ERROR. Wrong number of sources found." |
---|
| 218 | echo "Differences in results:" |
---|
| 219 | diff -I"Results of the Duchamp source finder:" verification/results6.txt verification/stdResults6.txt |
---|
| 220 | numErrors=$numErrors+1 |
---|
| 221 | fi |
---|
| 222 | #Test the log files. |
---|
| 223 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log6.txt verification/stdLog6.txt | wc -l` == 0 ]; then |
---|
| 224 | echo " Logfiles correct." |
---|
| 225 | else |
---|
| 226 | echo " ERROR: Differences in the log files:" |
---|
| 227 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log6.txt verification/stdLog6.txt |
---|
| 228 | numErrors=$numErrors+1 |
---|
| 229 | fi |
---|
[632] | 230 | ################################################################## |
---|
| 231 | # This test does the same as the first, but with growing to a lower threshold |
---|
[604] | 232 | |
---|
[632] | 233 | echo " " |
---|
| 234 | echo "Running the seventh Duchamp test:" |
---|
| 235 | echo " [This does the same as the first, and grows detections]" |
---|
| 236 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 237 | $progname -p verification/input7 > /tmp/duchamptest |
---|
| 238 | echo "Done. Comparison to standard result:" |
---|
| 239 | set numDet = `grep "Total number" verification/results6.txt | cut -f 6 -d " "` |
---|
| 240 | if [ $numDet == 5 ]; then |
---|
| 241 | tail -5 verification/results7.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
| 242 | tail -5 verification/stdResults7.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
| 243 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
| 244 | echo " Found correct number of sources, but positions differ." |
---|
| 245 | echo " ERROR: Differences in positions of sources:" |
---|
| 246 | diff -I"Results of the Duchamp source finder:" verification/results7.txt verification/stdResults7.txt |
---|
| 247 | numErrors=$numErrors+1 |
---|
| 248 | else |
---|
| 249 | echo " All detections correct." |
---|
| 250 | fi |
---|
| 251 | else |
---|
| 252 | echo " ERROR. Wrong number of sources found." |
---|
| 253 | echo "Differences in results:" |
---|
| 254 | diff -I"Results of the Duchamp source finder:" verification/results7.txt verification/stdResults7.txt |
---|
| 255 | numErrors=$numErrors+1 |
---|
| 256 | fi |
---|
| 257 | #Test the log files. |
---|
| 258 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log6.txt verification/stdLog6.txt | wc -l` == 0 ]; then |
---|
| 259 | echo " Logfiles correct." |
---|
| 260 | else |
---|
| 261 | echo " ERROR: Differences in the log files:" |
---|
| 262 | diff -I"flagXOutput" -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log6.txt verification/stdLog6.txt |
---|
| 263 | numErrors=$numErrors+1 |
---|
| 264 | fi |
---|
| 265 | |
---|
[604] | 266 | ################################################################## |
---|
[325] | 267 | # Summarise the results |
---|
| 268 | # Either give the OK, or give some advice about what to do. |
---|
| 269 | |
---|
[278] | 270 | echo " " |
---|
[361] | 271 | if [ $numErrors == 0 ]; then |
---|
[325] | 272 | echo "No errors! Everything is working fine." |
---|
[354] | 273 | echo " " |
---|
| 274 | echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
[327] | 275 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
[325] | 276 | else |
---|
| 277 | echo "There were some differences in the results compared to the standards." |
---|
| 278 | echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)." |
---|
[486] | 279 | echo "If they are more serious (e.g. wrong number of sources found), submit a bug report" |
---|
[327] | 280 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
[361] | 281 | fi |
---|