; ; CALLING SEQUENCE: scale=td_mk3scale(image) ; ; PARAMETERS: image is the MK3 image to be sampled. ; ; NOTES: This procedure is based on Alice's mkqual.auto.pro IDL ; procedure which scales MK3 images for the website. This ; procedure samples a ring of radius r0 to rmx and looks at ; the min and max values found there. Next some garbage is ; taken out and the min and max scaling factors to use are ; returned. ; ; RETURN TYPE: FLTARR(2) ; ; CALLS: None ; ; HISTORY: Adapted from Alice's code on 2-JUN-98 ; FUNCTION td_mk3scale, image nray=720 nraym1=nray-1 rpB=0 rpB=intarr(512,512) rpB=image acirc = !PI * 2.0 / float(nray) dp = findgen(nray) * acirc + acirc * (0.25 * (float(nray))) dpx = intarr(nray) dpy = intarr(nray) xcen = 255.5 & ycen = 255.5 & mk3rad = 104.4435 & radius=1.00 rnder = 0.5005 dpx = fix ( cos(dp) * mk3rad * radius + xcen + rnder ) ; For disk size dpy = fix ( sin(dp) * mk3rad * radius + ycen + rnder ) ; For disk size r0 = 1.25 dr = (255.5/104.44 - 1.1224) / 128.0 rmx= 2.00 rpix = fix((rmx-r0)/dr) + 1 & rpixm1 = rpix-1 rimg = fltarr(rpix,nray) fpix = float(nray)*float(rpix) for ii=0,rpixm1,1 do begin;{ RR=r0 + dr*float(ii) Rpx = fix ( cos(dp) * mk3rad * RR + xcen + rnder ) Rpy = fix ( sin(dp) * mk3rad * RR + ycen + rnder ) rimg(ii,0:nraym1) = rpB(Rpx,Rpy) endfor ;} avg = total(rimg) / fpix diff = rimg - avg sigma= sqrt ( total(diff*diff)/fpix) mn = fix(fix(avg/ 50.)* 50. - 2.5 *fix(sigma/ 50.)* 50.) mx = fix(fix(avg/100.)*100. + 6 *fix(sigma/100.)*100.) rimg= rimg*((rimg gt mn) and (rimg le mx)) ; Recompute the avg and sigma avg = total(rimg) / fpix diff = rimg - avg sigma= sqrt ( total(diff*diff)/fpix) mn = fix(fix(avg/ 50.)* 50. - 1.4*fix(sigma/ 50.)* 50.) mx = fix(fix(avg/100.)*100. + 4.5*fix(sigma/100.)*100.) mn = fix(fix((avg - 1.3 *sigma)/ 50.)* 50.) ;;; if(mn gt 0)then mn=0 mx = fix(fix((avg + 4.2 *sigma)/100.)* 100.) scale=fltarr(2) scale(0)=mn scale(1)=mx RETURN,scale END