source: tags/release-1.1.11b/VerifyDuchamp.sh

Last change on this file was 754, checked in by MatthewWhiting, 14 years ago

Improved the verification script to make it easier to see what is going on (and make it more extensible).

  • Property svn:executable set to *
File size: 3.5 KB
Line 
1#!/bin/bash
2
3version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'`
4
5progname=./Duchamp-$version
6dir=./verification
7
8numErrors=0
9
10ndet=(5 5 5 5 1 1 5)
11number=("first" "second" "third" "fourth" "fifth" "sixth" "seventh")
12explanation=("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" )
19explanation2=("-" "-" "It should take a bit longer than the first two." "It should take a bit longer again" "-" "-" "-" )
20
21##################################################################
22# Run the tests.
23# First, test the results file, just looking at the number of sources
24#  and their pixel positions.
25# This is to avoid precision problems with the WCS positions.
26# Second, test the entire log files.
27
28for (( i=0; i<${#number[@]}; i++ )); do
29   
30    N=`expr $i + 1`
31    in=${dir}/input${N}
32    res=${dir}/results${N}.txt
33    Sres=${dir}/stdResults${N}.txt
34    log=${dir}/log${N}.txt
35    Slog=${dir}/stdLog${N}.txt
36   
37
38    echo "Running the ${number[i]} Duchamp test:"
39    echo "  [${explanation[i]}]"
40    if  (( ( $i == "2" ) || ( $i == "3" ) )); then
41        echo "  [${explanation2[i]}]"
42    fi
43    rm -f /tmp/duchampRes /tmp/duchampComp /tmp/duchamptest
44    $progname -p $in > /tmp/duchamptest
45    echo "Done. Comparison to standard result:"
46    numDet=`grep "Total number" $res | cut -f 6 -d " "`
47    if [ $numDet == ${ndet[i]} ]; then
48        tail -5 $res | awk '{print $1,$3,$4,$5}' > /tmp/duchampRes
49        tail -5 $Sres | awk '{print $1,$3,$4,$5}' > /tmp/duchampComp
50        if [ `diff /tmp/duchampRes /tmp/duchampComp | wc -l` != 0 ]; then
51            echo "  Found correct number of sources, but positions differ."
52            echo "  ERROR: Differences in positions of sources:"
53            diff -I"Results of the Duchamp source finder:" $res $Sres
54            numErrors=`expr $numErrors + 1`
55        else
56            echo "  All detections correct."
57        fi
58    else
59        echo "  ERROR. Wrong number of sources found."
60        echo "Differences in results:"
61        diff  -I"Results of the Duchamp source finder:" $res $Sres
62        numErrors=$numErrors+1
63    fi
64#Test the log files.
65    if [ `diff -I"flagXOutput" -I"New run of the Duchamp source" -I"Executing statement" -I"Duchamp completed:" $log $Slog | wc -l` == 0 ]; then
66        echo "  Logfiles correct."
67    else
68        echo "  ERROR: Differences in the log files:"
69        diff -I"flagXOutput" -I"New run of the Duchamp source" -I"Executing statement" -I"Duchamp completed:" $log $Slog
70        numErrors=`expr $numErrors + 1`
71    fi
72
73    echo ""
74    echo ""
75   
76done
77
78##################################################################
79# Summarise the results
80# Either give the OK, or give some advice about what to do.
81
82echo " "
83if [ $numErrors == 0 ]; then
84    echo "No errors! Everything is working fine."
85    echo " "
86    echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to"
87    echo "  http://svn.atnf.csiro.au/trac/duchamp/newticket"
88else
89    echo "There were some differences in the results compared to the standards."
90    echo "Have a look at the diffs to see if they are trivial or not (eg. precision errors)."
91    echo "If they are more serious (e.g. wrong number of sources found), submit a bug report"
92    echo "  at http://svn.atnf.csiro.au/trac/duchamp/newticket"
93fi
Note: See TracBrowser for help on using the repository browser.