[325] | 1 | #!/bin/tcsh |
---|
[148] | 2 | |
---|
[337] | 3 | set version = `./Duchamp* -v | awk '{print $3}'` |
---|
[325] | 4 | |
---|
[337] | 5 | set progname = ./Duchamp-$version |
---|
| 6 | |
---|
[325] | 7 | set 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 | |
---|
[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:" |
---|
[325] | 21 | set 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++ |
---|
| 30 | else |
---|
| 31 | echo " All detections correct." |
---|
| 32 | endif |
---|
| 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++ |
---|
| 38 | endif |
---|
| 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++ |
---|
| 46 | endif |
---|
[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 " "` |
---|
| 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++ |
---|
| 66 | else |
---|
| 67 | echo " All detections correct." |
---|
| 68 | endif |
---|
| 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++ |
---|
| 74 | endif |
---|
| 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++ |
---|
| 82 | endif |
---|
[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 " "` |
---|
| 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++ |
---|
| 103 | else |
---|
| 104 | echo " All detections correct." |
---|
| 105 | endif |
---|
| 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++ |
---|
| 111 | endif |
---|
| 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++ |
---|
| 119 | endif |
---|
[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 " "` |
---|
| 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++ |
---|
| 140 | else |
---|
| 141 | echo " All detections correct." |
---|
| 142 | endif |
---|
| 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++ |
---|
| 148 | endif |
---|
| 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++ |
---|
| 156 | endif |
---|
[148] | 157 | |
---|
[325] | 158 | ################################################################## |
---|
| 159 | # Summarise the results |
---|
| 160 | # Either give the OK, or give some advice about what to do. |
---|
| 161 | |
---|
[278] | 162 | echo " " |
---|
[325] | 163 | if( $numErrors == 0 ) then |
---|
| 164 | echo "No errors! Everything is working fine." |
---|
[327] | 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" |
---|
[325] | 167 | else |
---|
| 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" |
---|
[327] | 171 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
[325] | 172 | endif |
---|