source: trunk/VerifyDuchamp.sh @ 500

Last change on this file since 500 was 500, checked in by MatthewWhiting, 16 years ago

This is just to highlight the change that was included in [498] but not documented. Running the old script with /bin/sh on Ubuntu gave a few errors, but making it bash seemed to fix it.

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