-
Notifications
You must be signed in to change notification settings - Fork 7
/
do_makemultimages_tests.sh
executable file
·267 lines (208 loc) · 9.49 KB
/
do_makemultimages_tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/bin/bash
#
# Regression tests for makemultimages
# Predefine some ANSI color escape codes
RED='\033[0;31m'
GREEN='\033[0;0;32m'
NC='\033[0m' # No Color
# create an integer variable for status (& counting number of failed tests)
declare -i STATUS=0
FAILED_TEXT=" ** Test failed. **"
do_fits_tests=$(./python/py_startup_test.py)
if [ $do_fits_tests = "0" ]
then
echo -n "Unable to load numpy and/or pyfits Python modules"
echo
echo -n "Tests will skip comparison of FITS files"
fi
if [ ! -f ./makemultimages ]
then
echo "*** Unable to find local copy of makemultimages! ***"
echo
exit 2
fi
case "$OSTYPE" in
darwin*) osname="osx" ;;
linux*) osname="linux" ;;
*) echo "unknown: $OSTYPE" ;;
esac
# create output directory for test_dump*, etc. files (will do nothing if
# directory already exists)
mkdir -p temptest
echo ""
echo "Running tests for makemultimages..."
# do we correctly print list of available functions?
./makemultimages --list-functions > temptest/test_dump0
# simple tests using small images
rm temptest/multimage_diff-sizes*.fits
rm temptest/multimage-with-imageinfo_*.fits
# 3 images, one function block, using --image-info
./makemultimages tests/makemultimages_reference/config_for_globalparams.txt -o temptest/multimage-with-imageinfo --image-info=tests/makemultimages_reference/imageinfo_3image.txt > temptest/test_dump2
./makemultimages tests/makemultimages_reference/config_for_globalparams.txt -o temptest/multimage-with-imageinfo_b --image-info=tests/makemultimages_reference/imageinfo_3image_b.txt > temptest/test_dump2b
./makemultimages tests/makemultimages_reference/config_for_globalparams.txt -o temptest/multimage-with-imageinfo_c --image-info=tests/makemultimages_reference/imageinfo_3image_c.txt > temptest/test_dump2c
./makemultimages tests/makemultimages_reference/config_for_globalparams.txt -o temptest/multimage-with-imageinfo_d --image-info=tests/makemultimages_reference/imageinfo_3image_d.txt > temptest/test_dump2d
./makemultimages tests/makemultimages_reference/config_for_globalparams.txt -o temptest/multimage-with-imageinfo_e --image-info=tests/makemultimages_reference/imageinfo_3image_e.txt > temptest/test_dump2d
# model with two function blocks, 3 images (offsets only), using --image-info
./makemultimages tests/makemultimages_reference/config_for_globalparams_2blocks.txt -o temptest/multimage-with-imageinfo_2blocks --image-info=tests/makemultimages_reference/imageinfo_3image.txt > temptest/test_dump3
# model with 2 images, different sizes, using --image-info
./makemultimages tests/makemultimages_reference/config_for_globalparams_mult-sizes.txt -o temptest/multimage_diff-sizes --image-info=tests/makemultimages_reference/imageinfo_2sizes.txt > temptest/test_dump5
# model with 3 images, different sizes, 1st and 3rd with PSF, using --image-info
./makemultimages tests/makemultimages_reference/config_for_globalparams_mult-sizes.txt -o temptest/multimage_diff-sizes-psf --image-info=tests/makemultimages_reference/imageinfo_3sizes-with-psf.txt > temptest/test_dump6
# tests of PSF oversampling [NO COMPARISON WITH REFERENCE YET]
./makemultimages tests/makeimage_reference/config_makeimage_gauss-oversample.dat --image-info tests/makemultimages_reference/imageinfo_2sizes-with-oversampled-psf.txt -o temptest/multimage_osamp > temptest/test_dump7a
# tests of multi-region PSF oversampling [NO COMPARISON WITH REFERENCE YET]
./makemultimages tests/makeimage_reference/config_makeimage_gauss-oversample.dat --image-info tests/makemultimages_reference/imageinfo_2sizes-with-2oversampled-psf.txt -o temptest/multimage_2osamp > temptest/test_dump7b
echo ""
echo -n "*** Diff comparison with archives: printing function list... "
if (diff --brief temptest/test_dump0 tests/makemultimages_reference/makemultimages_textout0)
then
echo " OK"
else
echo "Diff output:"
diff temptest/test_dump0 tests/makemultimages_reference/makemultimages_textout0
STATUS+=1
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_0... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_0.fits tests/makemultimages_reference/multimagetest_0.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_1... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_1.fits tests/makemultimages_reference/multimagetest_1.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_2.fits tests/makemultimages_reference/multimagetest_2.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_b_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_b_2.fits tests/makemultimages_reference/multimagetest_2b.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_c_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_c_2.fits tests/makemultimages_reference/multimagetest_2c.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_d_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_d_2.fits tests/makemultimages_reference/multimagetest_2d.fits
STATUS+=$?
fi
# note that the following two use comparisons with reference images from previous tests
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_e_1... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_e_1.fits tests/makemultimages_reference/multimagetest_1.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_e_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_e_2.fits tests/makemultimages_reference/multimagetest_2d.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_2blocks_0... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_2blocks_0.fits tests/makemultimages_reference/multimagetest_2blocks_0.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_2blocks_1... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_2blocks_1.fits tests/makemultimages_reference/multimagetest_2blocks_offset_1.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage-with-imageinfo_2blocks_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage-with-imageinfo_2blocks_2.fits tests/makemultimages_reference/multimagetest_2blocks_offset_2.fits
STATUS+=$?
fi
# archive images generated by
# makeimage[v1.4] -c tests/makemultimages_reference/config_for_globalparams_2sizes.txt
echo -n "*** Diff comparison of image with archives: multimage_diff-sizes_0... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage_diff-sizes_0.fits tests/makemultimages_reference/multimagetest_diff-sizes_0.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage_diff-sizes_1... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage_diff-sizes_1.fits tests/makemultimages_reference/multimagetest_diff-sizes_1.fits
STATUS+=$?
fi
# archive images generated by
# makeimage[v1.4] -c tests_for_makemultimage/config_for_globalparams_2sizes.txt --psf=tests/psf_moffat_35_n4699z.fits
echo -n "*** Diff comparison of image with archives: multimage_diff-sizes-psf_0... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage_diff-sizes-psf_0.fits tests/makemultimages_reference/multimagetest_diff-sizes-psf_0.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage_diff-sizes-psf_1... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage_diff-sizes-psf_1.fits tests/makemultimages_reference/multimagetest_diff-sizes-psf_1.fits
STATUS+=$?
fi
echo -n "*** Diff comparison of image with archives: multimage_diff-sizes-psf_2... "
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py temptest/multimage_diff-sizes-psf_2.fits tests/makemultimages_reference/multimagetest_diff-sizes-psf_2.fits
STATUS+=$?
fi
# WARNING: We currently don't have a reference image for this yet!
# Note that we chose an OS-specific path for the reference file (image output is
# marginally different for Linux vs OS X)
# archive image generated by
# makimage[v1.3.1] tests/config_makeimage_gauss-oversample.dat --psf=tests/psf_standard.fits
echo -n "*** Diff comparison of PSF-oversampled image with archives: multimage_diff-sizes-psf_2... "
echo -n "[WARNING: NO REFERENCE IMAGE YET!]"
if [ $do_fits_tests = "1" ]
then
echo ""
./python/compare_fits_files.py --min-value=1.0e-7 temptest/multimage_osamp_1.fits tests/oversampled_orig.fits
STATUS+=$?
fi
echo ""
if [ $STATUS -eq 1 ]
then
echo -e "${RED}One test failed!${NC}"
elif [ $STATUS -gt 1 ]
then
echo -e "${RED}${STATUS} tests failed!${NC}"
else
echo -e "${GREEN}All tests passed.${NC}"
fi
echo ""
echo "Done."
echo ""
exit $STATUS