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 | |
---|
39 | |
---|
40 | echo "Running the ${number[i]} Duchamp test:" |
---|
41 | echo " [${explanation[i]}]" |
---|
42 | if (( ( $i == "2" ) || ( $i == "3" ) )); then |
---|
43 | echo " [${explanation2[i]}]" |
---|
44 | fi |
---|
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 |
---|
50 | tail -${numDet} $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
51 | tail -${numDet} $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
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 |
---|
60 | else |
---|
61 | echo " ERROR. Wrong number of sources found." |
---|
62 | echo "Differences in results:" |
---|
63 | diff -I"Results of the Duchamp source finder:" $res $Sres |
---|
64 | numErrors=$numErrors+1 |
---|
65 | fi |
---|
66 | #Test the log files. |
---|
67 | if [ `diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog | wc -l` == 0 ]; then |
---|
68 | echo " Logfiles correct." |
---|
69 | else |
---|
70 | echo " ERROR: Differences in the log files:" |
---|
71 | diff -I"flagXOutput" -I"Duchamp" -I"spectraFile" $log $Slog |
---|
72 | numErrors=`expr $numErrors + 1` |
---|
73 | fi |
---|
74 | |
---|
75 | echo "" |
---|
76 | echo "" |
---|
77 | |
---|
78 | done |
---|
79 | |
---|
80 | ################################################################## |
---|
81 | # Summarise the results |
---|
82 | # Either give the OK, or give some advice about what to do. |
---|
83 | |
---|
84 | echo " " |
---|
85 | if [ $numErrors == 0 ]; then |
---|
86 | echo "No errors! Everything is working fine." |
---|
87 | echo " " |
---|
88 | echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
89 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
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)." |
---|
93 | echo "If they are more serious (e.g. wrong number of sources found), submit a bug report" |
---|
94 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
95 | fi |
---|