1 | #!/bin/tcsh |
---|
2 | |
---|
3 | if( $# == 0 ) then |
---|
4 | set progname = ./Duchamp |
---|
5 | else |
---|
6 | set progname = $1 |
---|
7 | endif |
---|
8 | |
---|
9 | set numErrors = 0 |
---|
10 | |
---|
11 | ################################################################## |
---|
12 | # Run the first test, looking at simple sigma-clipped search |
---|
13 | # First, test the results file, just looking at the number of sources |
---|
14 | # and their pixel positions. |
---|
15 | # This is to avoid precision problems with the WCS positions. |
---|
16 | # Second, test the entire log files. |
---|
17 | |
---|
18 | echo "Running the first Duchamp test:" |
---|
19 | echo " [This is a simple sigma-clipping search]" |
---|
20 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
21 | $progname -p verification/input1 > /tmp/duchamptest |
---|
22 | echo "Done. Comparison to standard result:" |
---|
23 | set numDet = `grep "Total number" verification/results1.txt | cut -f 6 -d " "` |
---|
24 | if( $numDet == 5 ) then |
---|
25 | tail -5 verification/results1.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
26 | tail -5 verification/stdResults1.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
27 | if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then |
---|
28 | echo " Found correct number of sources, but positions differ." |
---|
29 | echo " ERROR: Differences in positions of sources:" |
---|
30 | diff -I"Results of the Duchamp source finder:" verification/results1.txt verification/stdResults1.txt |
---|
31 | $numErrors++ |
---|
32 | else |
---|
33 | echo " All detections correct." |
---|
34 | endif |
---|
35 | else |
---|
36 | echo " ERROR. Wrong number of sources found." |
---|
37 | echo "Differences in results:" |
---|
38 | diff -I"Results of the Duchamp source finder:" verification/results1.txt verification/stdResults1.txt |
---|
39 | $numErrors++ |
---|
40 | endif |
---|
41 | #Test the log files. |
---|
42 | 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 |
---|
43 | echo " Logfiles correct." |
---|
44 | else |
---|
45 | echo " ERROR: Differences in the log files:" |
---|
46 | diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log1.txt verification/stdLog1.txt |
---|
47 | $numErrors++ |
---|
48 | endif |
---|
49 | |
---|
50 | ################################################################## |
---|
51 | # The next test uses the FDR method, but is otherwise the same. |
---|
52 | |
---|
53 | echo " " |
---|
54 | echo "Running the second Duchamp test:" |
---|
55 | echo " [This uses the FDR method]" |
---|
56 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
57 | $progname -p verification/input2 > /tmp/duchamptest |
---|
58 | echo "Done. Comparison to standard result:" |
---|
59 | set numDet = `grep "Total number" verification/results2.txt | cut -f 6 -d " "` |
---|
60 | if( $numDet == 5 ) then |
---|
61 | tail -5 verification/results2.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
62 | tail -5 verification/stdResults2.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
63 | if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then |
---|
64 | echo " Found correct number of sources, but positions differ." |
---|
65 | echo " ERROR: Differences in positions of sources:" |
---|
66 | diff -I"Results of the Duchamp source finder:" verification/results2.txt verification/stdResults2.txt |
---|
67 | $numErrors++ |
---|
68 | else |
---|
69 | echo " All detections correct." |
---|
70 | endif |
---|
71 | else |
---|
72 | echo " ERROR. Wrong number of sources found." |
---|
73 | echo "Differences in results:" |
---|
74 | diff -I"Results of the Duchamp source finder:" verification/results2.txt verification/stdResults2.txt |
---|
75 | $numErrors++ |
---|
76 | endif |
---|
77 | #Test the log files. |
---|
78 | 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 |
---|
79 | echo " Logfiles correct." |
---|
80 | else |
---|
81 | echo " ERROR: Differences in the log files:" |
---|
82 | diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log2.txt verification/stdLog2.txt |
---|
83 | $numErrors++ |
---|
84 | endif |
---|
85 | |
---|
86 | ################################################################## |
---|
87 | # The third test smoothes the cube and uses sigma-clipping |
---|
88 | |
---|
89 | echo " " |
---|
90 | echo "Running the third Duchamp test:" |
---|
91 | echo " [This spatially smoothes the cube, then searches with simple sigma-clipping]" |
---|
92 | echo " [It should take a bit longer than the first two.]" |
---|
93 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
94 | $progname -p verification/input3 > /tmp/duchamptest |
---|
95 | echo "Done. Comparison to standard result:" |
---|
96 | set numDet = `grep "Total number" verification/results3.txt | cut -f 6 -d " "` |
---|
97 | if( $numDet == 5 ) then |
---|
98 | tail -5 verification/results3.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
99 | tail -5 verification/stdResults3.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
100 | if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then |
---|
101 | echo " Found correct number of sources, but positions differ." |
---|
102 | echo " ERROR: Differences in positions of sources:" |
---|
103 | diff -I"Results of the Duchamp source finder:" verification/results3.txt verification/stdResults3.txt |
---|
104 | $numErrors++ |
---|
105 | else |
---|
106 | echo " All detections correct." |
---|
107 | endif |
---|
108 | else |
---|
109 | echo " ERROR. Wrong number of sources found." |
---|
110 | echo "Differences in results:" |
---|
111 | diff -I"Results of the Duchamp source finder:" verification/results3.txt verification/stdResults3.txt |
---|
112 | $numErrors++ |
---|
113 | endif |
---|
114 | #Test the log files. |
---|
115 | 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 |
---|
116 | echo " Logfiles correct." |
---|
117 | else |
---|
118 | echo " ERROR: Differences in the log files:" |
---|
119 | diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log3.txt verification/stdLog3.txt |
---|
120 | $numErrors++ |
---|
121 | endif |
---|
122 | |
---|
123 | ################################################################## |
---|
124 | # The final test reconstructs the cube and uses sigma-clipping |
---|
125 | |
---|
126 | echo " " |
---|
127 | echo "Running the fourth Duchamp test:" |
---|
128 | echo " [This reconstructs the cube, then searches with simple sigma-clipping]" |
---|
129 | echo " [It should take a bit longer again]" |
---|
130 | rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest |
---|
131 | $progname -p verification/input4 > /tmp/duchamptest |
---|
132 | echo "Done. Comparison to standard result:" |
---|
133 | set numDet = `grep "Total number" verification/results4.txt | cut -f 6 -d " "` |
---|
134 | if( $numDet == 5 ) then |
---|
135 | tail -5 verification/results4.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes |
---|
136 | tail -5 verification/stdResults4.txt | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp |
---|
137 | if( `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ) then |
---|
138 | echo " Found correct number of sources, but positions differ." |
---|
139 | echo " ERROR: Differences in positions of sources:" |
---|
140 | diff -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt |
---|
141 | $numErrors++ |
---|
142 | else |
---|
143 | echo " All detections correct." |
---|
144 | endif |
---|
145 | else |
---|
146 | echo " ERROR. Wrong number of sources found." |
---|
147 | echo "Differences in results:" |
---|
148 | diff -I"Results of the Duchamp source finder:" verification/results4.txt verification/stdResults4.txt |
---|
149 | $numErrors++ |
---|
150 | endif |
---|
151 | #Test the log files. |
---|
152 | 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 |
---|
153 | echo " Logfiles correct." |
---|
154 | else |
---|
155 | echo " ERROR: Differences in the log files:" |
---|
156 | diff -I"New run of the Duchamp sourcefinder" -I"Executing statement" -I"Duchamp completed:" verification/log4.txt verification/stdLog4.txt |
---|
157 | $numErrors++ |
---|
158 | endif |
---|
159 | |
---|
160 | ################################################################## |
---|
161 | # Summarise the results |
---|
162 | # Either give the OK, or give some advice about what to do. |
---|
163 | |
---|
164 | echo " " |
---|
165 | if( $numErrors == 0 ) then |
---|
166 | echo "No errors! Everything is working fine." |
---|
167 | echo "\nHappy Finding! If you ever need to report a bug or request an upgrade, go to" |
---|
168 | echo " http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
169 | else |
---|
170 | echo "There were some differences in the results compared to the standards." |
---|
171 | echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)." |
---|
172 | echo "If they are more serious (wrong number of sources found), submit a bug report" |
---|
173 | echo " at http://svn.atnf.csiro.au/trac/duchamp/newticket" |
---|
174 | endif |
---|