1 | #!/bin/bash |
---|
2 | |
---|
3 | version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'` |
---|
4 | |
---|
5 | progname=./Duchamp-$version |
---|
6 | dir=./verification |
---|
7 | |
---|
8 | numErrors=0 |
---|
9 | |
---|
10 | ndet=(5 5 5 5 1 1 5 5 5) |
---|
11 | number=("first" "second" "third" "fourth" "fifth" "sixth" "seventh" "eighth" "ninth") |
---|
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" |
---|
18 | "This does the same as the first, and grows detections" |
---|
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" "-" "-" "-" "-" "-") |
---|
22 | |
---|
23 | ################################################################## |
---|
24 | # Run the tests. |
---|
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 | |
---|
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 | vot=${dir}/results${N}.xml |
---|
39 | Svot=${dir}/stdResults${N}.xml |
---|
40 | |
---|
41 | echo "Running the ${number[i]} Duchamp test:" |
---|
42 | echo " [${explanation[i]}]" |
---|
43 | if (( ( $i == "2" ) || ( $i == "3" ) )); then |
---|
44 | echo " [${explanation2[i]}]" |
---|
45 | fi |
---|
46 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
47 | $progname -p $in > /tmp/duchamptest |
---|
48 | echo "Done. Comparison to standard result:" |
---|
49 | numDet=`grep "Total number" $res | cut -f 6 -d " "` |
---|
50 | if [ $numDet == ${ndet[i]} ]; then |
---|
51 | tail -${numDet} $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
52 | tail -${numDet} $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
53 | if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then |
---|
54 | echo " Found correct number of sources, but positions differ." |
---|
55 | echo " ERROR: Differences in positions of sources:" |
---|
56 | diff -I"Results of the Duchamp source finder:" $res $Sres |
---|
57 | numErrors=`expr $numErrors + 1` |
---|
58 | else |
---|
59 | echo " All detections correct." |
---|
60 | fi |
---|
61 | else |
---|
62 | echo " ERROR. Wrong number of sources found." |
---|
63 | echo "Differences in results:" |
---|
64 | diff -I"Results of the Duchamp source finder:" $res $Sres |
---|
65 | numErrors=$numErrors+1 |
---|
66 | fi |
---|
67 | |
---|
68 | #Test the log files. |
---|
69 | if [ `diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog | wc -l` == 0 ]; then |
---|
70 | echo " Logfiles correct." |
---|
71 | else |
---|
72 | echo " ERROR: Differences in the log files:" |
---|
73 | diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog |
---|
74 | numErrors=`expr $numErrors + 1` |
---|
75 | fi |
---|
76 | |
---|
77 | #Test the VOTable results. |
---|
78 | if [ `diff $vot $Svot | wc -l` == 0 ]; then |
---|
79 | echo " VOTables correct." |
---|
80 | else |
---|
81 | echo " ERROR: Differences in the VOTables:" |
---|
82 | diff $vot $Svot |
---|
83 | numErrors=`expr $numErrors + 1` |
---|
84 | fi |
---|
85 | |
---|
86 | echo "" |
---|
87 | echo "" |
---|
88 | |
---|
89 | done |
---|
90 | |
---|
91 | ################################################################## |
---|
92 | # Summarise the results |
---|
93 | # Either give the OK, or give some advice about what to do. |
---|
94 | |
---|
95 | echo " " |
---|
96 | if [ $numErrors == 0 ]; then |
---|
97 | echo "No errors! Everything is working fine." |
---|
98 | echo " " |
---|
99 | echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
100 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
101 | else |
---|
102 | echo "There were some differences in the results compared to the standards." |
---|
103 | echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)." |
---|
104 | echo "If they are more serious (e.g. wrong number of sources found), submit a bug report" |
---|
105 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
106 | fi |
---|