1
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
! MIDAS procedure verify7.prg to verify MIDAS commands
4
! K. Banse 930628 creation
6
! use as @@ verify7 fffffff with f = 1 or 0 (on/off)
10
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++
12
define/par p1 111111111111 n "Enter control flags for entries: "
14
define/local loop/i/1/1 0
15
define/local rval/r/1/1 0. ? +lower
16
define/local ival/i/1/5 0 all +lower
17
define/local rcorr/r/1/20 0. all +lower
18
define/local icorr/i/1/20 0 all +lower
19
define/local errsum/i/1/1 0 ? +lower
20
define/local ccc/c/1/12 0000000000
21
define/local scale/i/1/1 1 ? +lower
22
define/local seconds/i/1/2 0,0? +lower
24
delete/temp !get rid of old temporary files
25
write/key sizez/i/1/5 600,600,0,0,0
26
write/key dispyes/i/1/2 0,0
28
write/out +------------------------------------------+
29
write/out Start of procedure verify7.prg
30
write/out +------------------------------------------+
34
! if enabled, handle FITS working environment
36
set/midas newfil=?? >Null
37
if outputc(1:1) .eq. "F" then !we're in true FITS environment
38
inputi = m$len(mid$types)
39
define/local imatype/c/1/{inputi} {mid$types(1:8)} ? +lower
40
inputi = m$len(mid$types(9:))
41
define/local tbltype/c/1/{inputi} {mid$types(9:)} ? +lower
42
define/local workenv/c/1/4 FITS ? +lower
44
define/local imatype/c/1/3 bdf ? +lower
45
define/local tbltype/c/1/3 tbl ? +lower
46
define/local workenv/c/1/5 Midas ? +lower
50
define/local save_out/c/1/20 {outputc}
51
set/midas f_update=yes
56
if ccc({loop}:{loop}) .eq. "1" @@ verify7,000{loop}
58
write/out "We got problems with entry 000{loop} in verify7.prg!"
63
set/midas f_update={save_out}
66
mid$info(8) = seconds(2)-seconds(1)
68
write/out +------------------------------------------+
69
write/out procedure verify7.prg:
70
write/out Total time elapsed = {mid$info(8)} seconds.
71
write/out All tests o.k. - you deserve a coffee now...
72
write/out +------------------------------------------+
75
! here the different sub-procedures
79
write/out test of CREATE/DISPLAY + CREATE/GRAPHICS
80
write/out "----------------------------------------"
83
create/display 0 4,4,0,0 ? no
84
mid$info(4) = dazdevr(12)-525
85
mid$info(5) = dazdevr(13)-560
87
create/display 7 512,512,{mid$info(4)},{mid$info(5)}
88
mid$info(4) = mid$info(4) - 608
89
mid$info(5) = dazdevr(13)-420
90
create/gra 3 600,400,{mid$info(4)},{mid$info(5)}
91
dispyes(1) = 1 !mark that we have display + graphic
98
write/out test of CREATE/IMA
99
write/out "------------------"
101
@@ creamask !create image arti.bdf
102
if {arti,npix(1)} .gt. 50 then
108
rebin/linear arti &z .25,.25
110
write/out > resample/image &z &zz half_step
111
resample/image &z &zz half_step
112
statist/image &zz p5=wf >Null
113
write/keyw rcorr 0.0,1.0,2.087141e-01,3.674280e-01,1.40988,3.21806
114
@@ kcompare rcorr outputr 1,6 0.001
115
write/keyw rcorr/r/13/14 3.000105e-01,2.087141e-01
116
@@ kcompare rcorr outputr 13,14 0.001
117
write/out > filter/smooth &zz &zzz 3,3,0.
118
filter/smooth &zz &zzz 3,3,0.
119
write/out > resample/image &zzz &b double_step
120
resample/image &zzz &x double_step
122
! filter again on small image
123
write/out > filter/smooth &z &zz 2,2,0.
124
filter/smooth &z &zz 2,2,0.
125
write/out > compute/image &d = &zz-&x
126
compute/image &d = &zz-&x
127
write/out > statist/image &d >Null
128
statist/image &d >Null
129
write/keyw rcorr -9.562504e-02,9.562498e-02,6.882602e-06,1.633776e-02,-1.56138E-02,6.4243
130
@@ kcompare rcorr outputr 1,6 0.00001
131
rename/image &zz &b !that's smoother
132
compute/image &b = &b * 0.999999 !to avoid rounding errors for different
133
!machine architectures
135
if dispyes(1) .eq. 1 then
136
load/ima &b.{imatype} scale={scale}
141
write/out test of REPLACE/IMA
142
write/out "-------------------"
144
create/ima &a 2,{&b,npix(1)},{&b,npix(2)} ? poly 0.,0.7
145
write/out > replace/ima &b veria 0.09,>=&a,0.
146
replace/ima &b veria 0.09,>=&a,0.
147
write/keyw icorr/i/15/1 20566
148
@@ kcompare icorr outputi 15,15
150
write/out > find/min veria
152
write/keyw rcorr 0.0,259.0
153
@@ kcompare rcorr outputr 1,2 0.001
154
write/keyw icorr 1,1,371,64
155
@@ kcompare icorr outputi 1,4
157
write/out > find/pixel veria 0.0,5.9 out all werio 221
158
find/pixel veria 0.0,5.9 out all werio 221
159
write/keyw icorr 20236
160
@@ kcompare icorr outputi 1,1
162
write/out > copy/dk werio.{tbltype} tblcontr inputi
163
copy/dk werio.{tbltype} tblcontr inputi
164
write/key icorr 9,248,3,221,0,0,0,1,15,221
165
@@ kcompare icorr inputi 1,10
167
write/out > find/pixel veria 0.0,0.1 out
168
find/pixel veria 0.0,0.1 out
170
@@ kcompare rcorr outputr 1,1 0.001
171
write/keyw icorr 8,30
172
@@ kcompare icorr outputi 1,2
173
rval = outputr(1)-0.2
175
if dispyes(1) .eq. 1 then
176
load/ima veria.{imatype} scale={scale} cuts={rval},{veria,lhcuts(4)}
182
write/out test of APPLY/EDGE
183
write/out "------------------"
185
write/out > apply/edge veria &e 0.1
186
apply/edge veria &e 0.1
188
if dispyes(1) .eq. 1 then
189
load/ima &e.{imatype} scale={scale} cuts=0.,1.
192
inputr = 0.2+{veria,lhcuts(4)}
193
write/out > replace/ima veria &b &e/0.09,>={inputr}
194
replace/ima veria &b &e/0.09,>={inputr}
197
if dispyes(1) .eq. 1 then
198
load/ima &b.{imatype} scale={scale} cuts={rval},{&b,lhcuts(4)}
201
! save this image for interactive usage
202
compute/image ia.{imatype} = &b.{imatype}
203
read/descr ia.{imatype}
207
write/out test of EXTRACT, INSERT, FLIP/IMAGE
208
write/out "-----------------------------------"
210
write/out > extra/image &f = &b[<,@26:>,@150]
211
extra/image &f = &b[<,@26:>,@150]
213
crea/ima &t 2,512,256 ? poly 50.,-0.05,-0.1
214
crea/ima &u 2,512,256
215
write/descr &f step 1.,1. !avoid a warning mesage in `insert'
216
insert/ima &f &u @67,<
217
replace/ima &u &s <,0=&t
218
create/ima &x 2,512,512
219
create/ima &y 2,512,512
220
insert/ima &s &x <,@257
221
insert/ima &s &y <,@257
223
compute/pix veria = &x+&y
224
write/ima veria <,@256,1024 250. all
227
this_is_a_very_long_long_descriptor_name0001/c/1/8 pipeline
228
write/dhelp veria this_is_a_very_long_long_descriptor_name0001 -
229
"help text for this horrible descriptor"
231
if dispyes(2) .eq. 1 then
232
load/ima veria.{imatype} scale={scale} cuts={rval},{&b,lhcuts(4)}
236
write/out test of COPY/...
237
write/out "----------------"
240
write/out "create imageZ via: extra/ima &z = veria[<,@100:@100,@100]"
241
extract/ima &z = veria[<,@100:@100,@100]
243
"imageZ -> descrZ -> keyZ -> descrY -> imageY -> keyY"
245
write/key testz/i/1/100 -1 all
249
write/key testy/i/1/100 -1 all
252
"finally, compare the contents of keyZ and keyY (no message, if o.k.)"
253
@@ kcompare testz testy 1,100
255
define/local longer_test/c/1/10 x all
256
copy/dk &z this_is_a_very_long_long_descriptor_name0001/c/2/4 longer_test
257
if longer_test .ne. "ipelxxxxxx" then
258
write/out key `longer_test': "{longer_test} - should be: ipelxxxxxx"
265
write/out test of LOAD/IMAGE cube
266
write/out "-------------------"
268
if dispyes(1) .ne. 1 return
270
define/local xs/i/1/2 0,190
271
define/local ys/i/1/2 0,190
272
define/local loop/i/1/1 0
273
define/local angle/r/1/1 45.0
275
create/image &a 3,380,380,9
277
write/out "rotate image in steps of 45 degrees" and store as planes of a cube
278
xs = -(m$value(&b,npix(1))/2-xs(2))
279
ys = -(m$value(&b,npix(2))/2-ys(2))
280
insert/image &b &a @{xs},@{ys},< >Null
281
insert/image &b &a @{xs},@{ys},> >Null
285
write/out > rebin/rotate &b &u {angle}
286
rebin/rotate &b &u {angle}
287
xs = -(m$value(&u,npix(1))/2-xs(2))
288
ys = -(m$value(&u,npix(2))/2-ys(2))
290
write/out > insert/image &u &a @{xs},@{ys},@{loop}
291
insert/image &u &a @{xs},@{ys},@{loop} >Null
295
create/display 7 512,512,616,300
297
write/out > load/image &a,all
298
load/image &a.{imatype},all
301
write/out test of very long command lines
302
write/out "-------------------------------"
304
write/out aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccccccccccccc ddddddddddddddddddddddddddddddddd eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ggggggggggggggggggggggggggggggggggggggg 99.9
305
@@ verify7,testlong aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzzzzzzzzz bbbbbbbbbbbbbbbbbbbbbbbbbbbzzzzzzzzzzzzzzzzz ccccccccccccccccccccccccccccccccccccccccczz dddddddddddddddddddddddddddddddddddddddddddddddddddzz eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeezzzzzzzzzzzzzzz fffffffffffffffffffffffffffffffffffffffffffffffzz ggggggggggggggggggggggggggggggggggggggggggzz
306
write/out mid$errmess(42:43) should be = `gz'
307
write/out {mid$errmess(42:43)}
310
define/param p1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
311
define/param p2 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
312
define/param p3 ccccccccccccccccccccccccccccccccccccccccccc
313
define/param p4 ddddddddddddddddddddddddddddddddddddddddddddd
314
define/param p5 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
315
define/param p6 ffffffffffffffffffffffffffffffffffffffffffffffffffffff
316
define/param p7 gggggggggggggggggggggggggggggggggggggggggggggggggggggggggg
317
define/param p8 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
320
write/keyw out_a {p3}
321
write/keyw out_b {p4}
322
write/keyw inputc {p5}
323
write/keyw outputc {p6}
324
write/keyw mid$errmess {p7}
325
read/keyw in_a,in_b,out_a,out_b,inputc,outputc,mid$errmess
329
write/out test of WCS handling via CD matrix
330
write/out "---------------------------------"
332
if mid$sys(1:5) .ne. "PC/Cy" then
333
define/local tmpname/c/1/48 "r.VIMOS.2004-07-13T08:27:31.790_0000.fits "
335
define/local tmpname/c/1/48 "r.VIMOS.2004-07-13T08c27c31.790_0000.fits "
337
inputi = m$exist("MID_TEST:{tmpname}")
338
if inputi .ne. 1 then
339
write/out > we need the FITS file `{tmpname}'
340
write/out > from the $MID_TEST directory for this verification
341
write/out > please, get the latest demo_data tar file from the ESO ftp server
342
write/out > to bring your MID_TEST dir up to date ...
343
write/out > test skipped.
345
$ echo "missing file: {tmpname} in verify7.prg" >> ./missing-files
349
indisk/fits MID_TEST:{tmpname} vimos2004
351
inputd(1) = m$value(vimos2004.bdf,step(2))
352
read/desc vimos2004 rotang_from_cd-matrix
353
inputd(2) = m$value(vimos2004.bdf,rotang_from_cd-matrix(1))
354
write/keyw outputd 0.5694400E-04,1.5707963267500
355
@@ kcompare outputd inputd 1,2 0.00001
358
write/out > wcstest.mt -> middummk.bdf
359
write/out > modify descr. step of middummk.bdf
360
write/out > middummk.bdf -> lola.fits -> middummz.bdf
361
write/out > compare step of middummk.bdf and middummz.bdf
362
define/local mymode/i/1/1 {mid$mode(6)}
363
define/local dwork/d/1/2 0.,0. ? +lower
367
@@ kcompare rcorr outputd 1,2 0.000001
369
@@ verify7,do_it !should give WRONG results
370
@@ kcompare rcorr dwork 1,2 0.000001
373
@@ kcompare rcorr outputd 1,2 0.000001
375
mid$mode(6) = mymode !reset to value before
380
indisk/fits wcstest.mt middummk
381
dwork(1) = m$value(middummk,step(1)) !save original step size
382
dwork(2) = m$value(middummk,step(2))
383
write/keyw outputd/d/1/2 -0.55250E-03,0.55250E-03
384
copy/kd outputd/d/1/2 middummk step/d/1/2
385
write/out modify step from: {dwork(1)},{dwork(2)} to: {outputd(1)},{outputd(2)}
386
outdisk/fits middummk lola.fits >Null
387
indisk/fits lola.fits middummz >Null
388
write/out for MID$MODE(6) = {MID$MODE(6)} we get:
389
read/descr middummk step
390
read/descr middummz step
391
rcorr(1) = m$value(middummz,step(1))
392
rcorr(2) = m$value(middummz,step(2))
395
write/out test of FIND/PXPOS
396
write/out "------------------"
398
indisk/fits ccd.fits pxpos
399
find/pxpos pxpos postab med,5 y !get 11 pixel positions
400
if outputi .ne. 11 then
401
write/out we should have got 11 pixel positions
404
! sort table in ascending order of pixel positions
405
sort/table postab :y_pix,:x_pix
406
copy/ti postab oldx :x_pix
407
copy/ti postab oldy :y_pix
408
do inputi = 1 11 !set column :value to 99999.0
409
postab,:value,@{inputi} = 99999.0
412
write/image ccd postab,table !store 99999.0 into the pixel pos.
414
! find back the positions of these 11 max values
415
find/pxpos ccd newtab max,10 y
416
if outputi .ne. 11 then
417
write/out we should have got 11 pixel positions
420
! sort table in ascending order of pixel positions
421
sort/table newtab :y_pix,:x_pix
422
copy/ti newtab newx :x_pix
423
copy/ti newtab newy :y_pix
425
! check result positions
426
! for images to be equal, we had to sort the tables...
429
compute/image &d = newx - oldx
431
@@ kcompare rcorr outputr 1,2 0.00001
432
compute/image &d = newy - oldy
434
@@ kcompare rcorr outputr 1,2 0.00001