procedure abba ( ipref, sp1, sp2, opref, so1 , flat ) # # Procedure to take ABBA differences # Richard Elston 3/6/93 # string ipref {prompt="input image prefix"} int sp1 {prompt="starting number of input image"} int sp2 {prompt="stopping number of input image"} string opref {prompt="output image prefix"} int so1 {prompt="starting output number"} string flat {prompt="flat field image"} bool backg {yes, prompt="Fit and remove background residual",mode="h"} string bksamp {"*", prompt="Sample of points to use for Background",mode="h"} bool bkinter {yes, prompt="Fit background interactively",mode="h"} begin int i string sa1, sa2, sb1, sb2, oname string wrk1, wrk2 string num1 string inpref, outpref int p1, p2, o1 inpref = ipref p1 = sp1 p2 = sp2 outpref = opref o1 = so1 wrk1 = mktemp("xyz") wrk2 = mktemp("xyz") for ( i = p1 ; i <= p2 ; i += 1) { if ( i < 10 ) { sa1 = inpref//"00"//i } else if ( i < 100 ) { sa1 = inpref//"0"//i } else { sa1 = inpref//i } i = i+1 if ( i < 10 ) { sb1 = inpref//"00"//i } else if ( i < 100 ) { sb1 = inpref//"0"//i } else { sb1 = inpref//i } i = i+1 if ( i < 10 ) { sb2 = inpref//"00"//i } else if ( i < 100 ) { sb2 = inpref//"0"//i } else { sb2 = inpref//i } i = i+1 if ( i < 10 ) { sa2 = inpref//"00"//i } else if ( i < 100 ) { sa2 = inpref//"0"//i } else { sa2 = inpref//i } if ( o1 < 10 ) { oname = outpref//"00"//o1 } else if ( o1 < 100 ) { oname = outpref//"0"//o1 } else { oname = outpref//o1 } o1=o1+1 print("A1 = ",sa1," A2 = ",sa2) print("B1 = ",sb1," B2 = ",sb2) print( oname, " = A1+A2-B1-B2") imarith(sa1, "+", sa2, wrk1) imarith(sb1, "+", sb2, wrk2) imarith(wrk1,"-",wrk2, wrk1) imarith(wrk1,"/", 2.0, wrk1) xdispflatten(wrk1, flat, oname) xdisplay(oname) if (backg) { print ("******Fiting Residual Background*******") imdel (wrk1, ver-) background (oname//".ksub.imh", wrk1, axis=2, interactive=bkinter, sample=bksamp, naverage=1, function="chebyshev", order=1, low_reject=2., high_reject=2., niterate=5, grow=0., graphics="stdgraph", cursor="") imdel (oname//".ksub.imh") imrename (wrk1, oname//".ksub.imh") background (oname//".hsub.imh", wrk1, axis=2, interactive=bkinter, sample=bksamp, naverage=1, function="chebyshev", order=1, low_reject=2., high_reject=2., niterate=5, grow=0., graphics="stdgraph", cursor="") imdel (oname//".hsub.imh") imrename (wrk1, oname//".hsub.imh") background (oname//".jsub.imh", wrk1, axis=2, interactive=bkinter, sample=bksamp, naverage=1, function="chebyshev", order=1, low_reject=2., high_reject=2., niterate=5, grow=0., graphics="stdgraph", cursor="") imdel (oname//".jsub.imh") imrename (wrk1, oname//".jsub.imh") background (oname//".isub.imh", wrk1, axis=2, interactive=bkinter, sample=bksamp, naverage=1, function="chebyshev", order=1, low_reject=2., high_reject=2., niterate=5, grow=0., graphics="stdgraph", cursor="") imdel (oname//".isub.imh") imrename (wrk1, oname//".isub.imh") xdisplay(oname) } imdel(wrk1,ver-) imdel(wrk2,ver-) } end