;------------------------------------------------------------------------------- ; IDL Procedure PHOTIRAS.PRO ; ; This IDL procedure takes de-dithered, flatfielded observation made at the IRTF ; 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 photiras,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*256,ysize=2*256,title='Object Image + Contour' tvscl,alog10(array>0+.01) center,array,xguess,yguess print,xguess,yguess endif ;------------------------------------------------------------------------------- ;Make Best Estimate of Centroid ;Use for Phaethon findmax,array,'max',xguess-5,xguess+5,yguess-5,yguess+5,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,55,55)) fsvalue = total(array(appix)) Napp = n_elements(appix) ;print,'Apsize = ',apsize,' # of pixels = ',Napp ;------------------------------------------------------------------------------- ;Create Frame of Data Around Object For Background Analysis Frame = array(15:30,10:30) 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 ;------------------------------------------------------------------------------- return end