[754] | 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 |
---|
[754] | 6 | dir=./verification |
---|
[338] | 7 | |
---|
[361] | 8 | numErrors=0 |
---|
[325] | 9 | |
---|
[952] | 10 | ndet=(5 5 5 5 1 1 5 5 5) |
---|
| 11 | number=("first" "second" "third" "fourth" "fifth" "sixth" "seventh" "eighth" "ninth") |
---|
[754] | 12 | explanation=("This is a simple sigma-clipping search" |
---|
| 13 | "This uses the FDR method" |
---|
| 14 | "This spatially smoothes the cube, then searches with simple sigma-clipping" |
---|
| 15 | "This reconstructs the cube, then searches with simple sigma-clipping" |
---|
| 16 | "This just uses a small subsection of the full cube, with simple searching" |
---|
| 17 | "This reconstructs the subsection, then searches with simple sigma-clipping" |
---|
[890] | 18 | "This does the same as the first, and grows detections" |
---|
[952] | 19 | "This does the same as the first, but with regular statistics instead of robust" |
---|
| 20 | "This does the same as the first, but changing the spectral type, units, and rest frequency") |
---|
| 21 | explanation2=("-" "-" "It should take a bit longer than the first two." "It should take a bit longer again" "-" "-" "-" "-" "-") |
---|
[754] | 22 | |
---|
[325] | 23 | ################################################################## |
---|
[754] | 24 | # Run the tests. |
---|
[325] | 25 | # First, test the results file, just looking at the number of sources |
---|
| 26 | # and their pixel positions. |
---|
| 27 | # This is to avoid precision problems with the WCS positions. |
---|
| 28 | # Second, test the entire log files. |
---|
| 29 | |
---|
[754] | 30 | for (( i=0; i<${#number[@]}; i++ )); do |
---|
| 31 | |
---|
| 32 | N=`expr $i + 1` |
---|
| 33 | in=${dir}/input${N} |
---|
| 34 | res=${dir}/results${N}.txt |
---|
| 35 | Sres=${dir}/stdResults${N}.txt |
---|
| 36 | log=${dir}/log${N}.txt |
---|
| 37 | Slog=${dir}/stdLog${N}.txt |
---|
| 38 | |
---|
[148] | 39 | |
---|
[754] | 40 | echo "Running the ${number[i]} Duchamp test:" |
---|
| 41 | echo " [${explanation[i]}]" |
---|
| 42 | if (( ( $i == "2" ) || ( $i == "3" ) )); then |
---|
| 43 | echo " [${explanation2[i]}]" |
---|
[361] | 44 | fi |
---|
[754] | 45 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
| 46 | $progname -p $in > /tmp/duchamptest |
---|
| 47 | echo "Done. Comparison to standard result:" |
---|
| 48 | numDet=`grep "Total number" $res | cut -f 6 -d " "` |
---|
| 49 | if [ $numDet == ${ndet[i]} ]; then |
---|
[939] | 50 | tail -${numDet} $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
| 51 | tail -${numDet} $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
[754] | 52 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
| 53 | echo " Found correct number of sources, but positions differ." |
---|
| 54 | echo " ERROR: Differences in positions of sources:" |
---|
| 55 | diff -I"Results of the Duchamp source finder:" $res $Sres |
---|
| 56 | numErrors=`expr $numErrors + 1` |
---|
| 57 | else |
---|
| 58 | echo " All detections correct." |
---|
| 59 | fi |
---|
[325] | 60 | else |
---|
[754] | 61 | echo " ERROR. Wrong number of sources found." |
---|
| 62 | echo "Differences in results:" |
---|
| 63 | diff -I"Results of the Duchamp source finder:" $res $Sres |
---|
[361] | 64 | numErrors=$numErrors+1 |
---|
| 65 | fi |
---|
[325] | 66 | #Test the log files. |
---|
[838] | 67 | if [ `diff -I"flagXOutput" -I"New run of the Duchamp source" -I"Executing statement" -I"Duchamp completed:" -I"spectraFile" -I"flagXOutput" $log $Slog | wc -l` == 0 ]; then |
---|
[754] | 68 | echo " Logfiles correct." |
---|
[604] | 69 | else |
---|
[754] | 70 | echo " ERROR: Differences in the log files:" |
---|
| 71 | diff -I"flagXOutput" -I"New run of the Duchamp source" -I"Executing statement" -I"Duchamp completed:" $log $Slog |
---|
| 72 | numErrors=`expr $numErrors + 1` |
---|
[604] | 73 | fi |
---|
| 74 | |
---|
[754] | 75 | echo "" |
---|
| 76 | echo "" |
---|
| 77 | |
---|
| 78 | done |
---|
[604] | 79 | |
---|
[632] | 80 | ################################################################## |
---|
[325] | 81 | # Summarise the results |
---|
| 82 | # Either give the OK, or give some advice about what to do. |
---|
| 83 | |
---|
[278] | 84 | echo " " |
---|
[361] | 85 | if [ $numErrors == 0 ]; then |
---|
[325] | 86 | echo "No errors! Everything is working fine." |
---|
[354] | 87 | echo " " |
---|
| 88 | echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
[327] | 89 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
[325] | 90 | else |
---|
| 91 | echo "There were some differences in the results compared to the standards." |
---|
| 92 | echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)." |
---|
[486] | 93 | echo "If they are more serious (e.g. wrong number of sources found), submit a bug report" |
---|
[327] | 94 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
[361] | 95 | fi |
---|