source: trunk/VerifyDuchamp.sh @ 890

Last change on this file since 890 was 890, checked in by MatthewWhiting, 12 years ago

Adding a new test, that repeats the first but with non-robust statistics. Standard results are taken from running it with Duchamp-1.1.13.

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