pro inbingo,num,file1,file2,fileflux ; Eclipse observation: Input for BINGO photometry. ; manual selection of bright points (BPs) ; and local background samples (LBs) ; ; Parameter: serial number of the observed image (input) ; filenames for output. ; Image form: fltarr(1024,1024) ; Output: 2 ASCII files (seq.no, x, y, value): ; file1 of BPs and file2 of LBs. ; 1 ASCII file with fluxes and "full" areas of BPs ; if n_params() ne 4 then begin print,'usage: inbingo, imag.number,file1,file2,fileflux' stop endif ; !!!! TO BE CHANGED WITH RESPECT TO WHERE THE IMAGES ARE STORED !!!! stra=string('/scratch/sob/') strb=string('imn.') ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! window,0,xsize=512,ysize=512 scale=0.124 ; scale arcsec/pix ; reading the input image ima=fltarr(1024,1024) dcn=strtrim(num,2) if strlen(dcn) eq 3 then str='0'+dcn if strlen(dcn) eq 2 then str='00'+dcn if strlen(dcn) eq 1 then str='000'+dcn print,'Now reading image:' print,strb+str openr,1,stra+strb+str readu,1,ima close,1 ; selection of zoomed area ima=ima(250:761,315:826) ; area of interest... tvscl,ima newbox: print,'set the center position for zoom' cursor,x0,y0,/device,/down print,'center position is at',x0,y0 dx=50 ; setting parameters of zoom window dy=50 fact=5. ; the following block assures that the zoom is always inside the array uly=y0+dy lly=y0-dy ulx=x0+dx llx=x0-dx if uly gt 511 then begin y0=511-dy print,'top limit: new center position',x0,y0 endif if lly lt 0 then begin y0=dy print,'bottom limit: new center position',x0,y0 endif if ulx gt 511 then begin x0=511-dx print,'right limit: new center position',x0,y0 endif if llx lt 0 then begin x0=dx print,'left limit: new center position',x0,y0 endif box=ima(x0-dx:x0+dx,y0-dy:y0+dy) ; selected box zoo=rebin(box,fact*(2*dx+1),fact*(2*dy+1),/sample) ; zoom window,2,xsize=fact*(2*dx+1),ysize=fact*(2*dy+1) tvscl,zoo print,'do you accept this box? (y/n) if get_kbrd(1) eq 'n' then goto,newbox ; From now, all the coordinates are related to the selected box! ; selection of pixels representing BPs and LBs bpsel: corner=intarr(4,100) x=fltarr(100) y=fltarr(100) v=fltarr(100) xloadct print,'NOW SELECT BRIGHT FEATURES' n=0 curs1: print,'selection - left, middle; quit - right (mouse)' cursor,xr,yr,/device,/down if (!err eq 1) or (!err eq 2) then begin n=n+1 xx=fix(xr/fact) yy=fix(yr/fact) print,n,xx,yy,box(xx,yy) x(n)=xx*scale y(n)=yy*scale v(n)=box(xx,yy) print,'mark the lower-left corner of the flux area' cursor,xc,yc,/device,/down corner(0,n)=fix(xc/fact) corner(1,n)=fix(yc/fact) print,'mark the upper-right corner of the flux area' cursor,xc,yc,/device,/down corner(2,n)=fix(xc/fact) corner(3,n)=fix(yc/fact) goto,curs1 endif print,'selected',n,'bright features' corner=corner(*,0:n) x=x(0:n) y=y(0:n) v=v(0:n) print,'selection ok? (y/n)' if get_kbrd(1) eq 'n' then goto,bpsel openw,1,file1 printf,1,n for i= 1,n do printf,1,i,x(i),y(i),v(i) close,1 nbp=n lbsel: x=fltarr(100) y=fltarr(100) v=fltarr(100) xloadct print,'NOW SELECT BACKGROUND POINTS' n=0 curs2: print,'selection - left, middle; quit - right (mouse)' cursor,xr,yr,/device,/down if (!err eq 1) or (!err eq 2) then begin n=n+1 xx=fix(xr/fact) yy=fix(yr/fact) print,n,xx,yy,box(xx,yy) x(n)=xx*scale y(n)=yy*scale v(n)=box(xx,yy) goto,curs2 endif print,'selected',n,'background points' x=x(0:n) y=y(0:n) v=v(0:n) print,'selection ok? (y/n)' if get_kbrd(1) eq 'n' then goto,lbsel openw,1,file2 printf,1,n for i= 1,n do printf,1,i,x(i),y(i),v(i) close,1 print,'end of selection' ; running BINGO spawn,'bingo3.exe' ; computing flux of BPs backg=fltarr(2,nbp) openr,1,'BACK.TMP' readf,1,backg ; the "background" value on n-th BP is in backg(1,n-1) print,backg(1,*) close,1 openw,1,fileflux printf,1,'fluxes and areas of BPs:' print,'fluxes and areas of BPs:' for i=1,nbp do begin flbox=box(corner(0,i):corner(2,i),corner(1,i):corner(3,i)) flux=total(flbox(where(flbox ge backg(1,i-1)))) area=n_elements(flbox(where(flbox ge backg(1,i-1)))) print,i,flux,area printf,1,i,flux,area endfor close,1 end