FUNCTION feb19th,filename,dark,azimuth,zenang,debug=debug COMMON ffstuff,ffimg ; Verify good image file name provided. imf=rfindfile(filename,count=nimf) IF nimf EQ 0 THEN BEGIN MESSAGE,'Could not find '+filename,/INFORMATIONAL RETURN,-1 ENDIF ; Load image, squeeze, and subtract dark frame. rdkimg,filename,hb,im sqim=squeeze2(im) corrim=(sqim-dark)>0 ; Identify and subtract approximate shade brightness value OPENR,sun,'\data\doe\shade2.dat',/GET_LUN nshade=0L READU,sun,nshade shade=LONARR(nshade) READU,sun,shade FREE_LUN,sun shback=mean(corrim(shade)) IF KEYWORD_SET(debug) THEN HELP,shback shcorrim=(corrim-shback)>0 ; Apply uniformity correction IF N_ELEMENTS(ffimg) EQ 0 THEN BEGIN getffimg,1996,2,19 ENDIF fffix=REBIN(ffimg(512:767,0:255),128,128) ffshcorrim=shcorrim*FLOAT(fffix)/100. ; Apply calibration factor getsens,1996,2,19,sens0,sens1,/nointeractive IF KEYWORD_SET(debug) THEN HELP,sens0(2) calfac=sens0(2)/(4.*60.045) ; extra binning, 60-s exposure time calfac=calfac*2.0 ; account for loss of signal caused by stretching rim=ROUND(calfac*ffshcorrim) ; Select useful region of image for storage OPENR,uun,'\data\doe\useful2.dat',/GET_LUN nuseful=0L READU,uun,nuseful useful=LONARR(nuseful) READU,uun,useful FREE_LUN,uun one2two,useful,rim,ux,uy rux=REPLICATE(MIN(ux)-1,2)+[0,69] ruy=REPLICATE(MIN(uy)-1,2)+[0,59] sel=rim-rim sel(useful)=rim(useful) sub=sel(rux(0):rux(1),ruy(0):ruy(1)) IF N_PARAMS() GT 2 THEN BEGIN col=REBIN(INDGEN(128),128,128) row=TRANSPOSE(col) sel=FLTARR(128,128) azimuth=FLTARR(70,60) zenang=azimuth cr2az,1996,2,19,0,2,col,row,azim,zen,/degrees,bin=4,site=3 sel(useful)=azim(useful) azimuth=sel(rux(0):rux(1),ruy(0):ruy(1)) sel(useful)=zen(useful) zenang=sel(rux(0):rux(1),ruy(0):ruy(1)) ENDIF RETURN,sub END