;------------------------------------------------------------------------------- ; IDL Procedure PHOT_TIMMI.PRO ; ; This IDL procedure takes de-dithered, flatfielded observation made at the ; ESO 3.6m and places a box of width 2*APSIZE+1 around the star. A frame of ; pixels is created around the object, with outer width of 4*APSIZE+1 and ; inner width of 2*APSIZE+1. The total counts within the box minus the ; (average counts/pixel in ; the frame) * (2*APSIZE+1)^2 are then ouput as ; the background corrected flux from the object, as well as the noise/pixel ; estimate given by the value of Sigma(Frame) * sqrt((2*APSIZE+1)^2). ; ; CML 2/29/96 ;------------------------------------------------------------------------------ pro phot_timmi,array,apsize,framesize,xguess,yguess,xpos,ypos, $ fsvalue,bkvalue,bknoise ;------------------------------------------------------------------------------ ;Estimate Centroid If Not Already Given - Get Close Enough For Routine to Work if((xguess eq 0) and (yguess eq 0)) then begin window,0,xsize=2*64,ysize=2*64,title='Object Image + Contour' tvscl,alog10(array>0+.01) center,array,xguess,yguess print,xguess,yguess endif ;----------------------------------------------------------------------------- ;Make Best Estimate of Centroid ;Use for Well-Peaked Sources findmax,array,'max',xguess-3,xguess+3,yguess-3,yguess+3,xpos,ypos,maxval ;------------------------------------------------------------------------------- ;Estimate Signal = Sum Over Aperature of Radius Apsize theta=findgen(720)/720.*2.*!pi x = xpos+(apsize*cos(theta)) y = ypos+(apsize*sin(theta)) appix=(polyfillv(x,y,64,64)) fsvalue = total(array(appix)) Napp = n_elements(appix) ;print,'Apsize = ',apsize,' # of pixels = ',Napp ;------------------------------------------------------------------------------ ;Create Frame of Data Around Object For Background Analysis Frame1 = array(5:12,5:59) & Frame1 = Frame1(0:*) Frame2 = array(53:61,5:59) & Frame2 = Frame2(0:*) Frame = [Frame1,Frame2] Nframe = n_elements(Frame) ;print,'Nframe = ',nframe ;------------------------------------------------------------------------------ ;Estimate Background in Signal = Background/pixel * (# of Pixels in Comet Box) ;Estimate Total Noise on Signal = (Noise/Pixel) * sqrt(# of pixels in Comet Box) resistant_mean,Frame,3.0,bkvalue,bknoise,num_rej bkvalue = bkvalue * Napp bknoise = bknoise * sqrt(Nframe) * sqrt(Napp) ; N.B. - Sigma Returned By Res_Mean ; is Sigma of the Mean, equal to ; Sigma of the Dist/sqrt(Nframe) ;print,'Resistant Mean(Frame) = ',bkvalue/Napp ;print,'Median(Frame) = ',med(frame) ;------------------------------------------------------------------------------ ;Subtract Background From Observation fsvalue = fsvalue - bkvalue ;------------------------------------------------------------------------------ ;print,apsize,fsvalue return end