source: trunk/VerifyDuchamp.sh @ 852

Last change on this file since 852 was 838, checked in by MatthewWhiting, 13 years ago

Make the verification script not care about whether pgplot has been enabled.

  • Property svn:executable set to *
File size: 3.5 KB
RevLine 
[754]1#!/bin/bash
[148]2
[389]3version=`grep VERSION src/config.h | sed '/\"/s///' | sed '/\"/s///' | awk '{print $3}'`
[325]4
[361]5progname=./Duchamp-$version
[754]6dir=./verification
[338]7
[361]8numErrors=0
[325]9
[754]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
[325]21##################################################################
[754]22# Run the tests.
[325]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
[754]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   
[148]37
[754]38    echo "Running the ${number[i]} Duchamp test:"
39    echo "  [${explanation[i]}]"
40    if  (( ( $i == "2" ) || ( $i == "3" ) )); then
41        echo "  [${explanation2[i]}]"
[361]42    fi
[754]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
[325]58    else
[754]59        echo "  ERROR. Wrong number of sources found."
60        echo "Differences in results:"
61        diff  -I"Results of the Duchamp source finder:" $res $Sres
[361]62        numErrors=$numErrors+1
63    fi
[325]64#Test the log files.
[838]65    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
[754]66        echo "  Logfiles correct."
[604]67    else
[754]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`
[604]71    fi
72
[754]73    echo ""
74    echo ""
75   
76done
[604]77
[632]78##################################################################
[325]79# Summarise the results
80# Either give the OK, or give some advice about what to do.
81
[278]82echo " "
[361]83if [ $numErrors == 0 ]; then
[325]84    echo "No errors! Everything is working fine."
[354]85    echo " "
86    echo "Happy Finding! If you ever need to report a bug or request an upgrade, go to"
[327]87    echo "  http://svn.atnf.csiro.au/trac/duchamp/newticket"
[325]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)."
[486]91    echo "If they are more serious (e.g. wrong number of sources found), submit a bug report"
[327]92    echo "  at http://svn.atnf.csiro.au/trac/duchamp/newticket"
[361]93fi
Note: See TracBrowser for help on using the repository browser.