pro conv_reg,reg1,img1,reg2,img2 if n_params(0) eq 0 then begin print,'conv_reg,reg1,img1,reg2,img2' return endif ; read circular region center into x1, y1, r1 read_reg,reg1,x1,y1,r1 ; read headers of image fits files h1 = headfits(img1) h2 = headfits(img2) ; extract astrometric keyword values from fits headers extast,h1,astr1 extast,h2,astr2 ; Get average of x and y plate scale (i.e., degrees/pixel) to scale ; radius of region rcd1 = (abs(astr1.cdelt(0))+abs(astr1.cdelt(1)))/2 rcd2 = (abs(astr2.cdelt(0))+abs(astr2.cdelt(1)))/2 ; Transform center of region from img1 pixels to img2 pixels xy2ad,x1,y1,astr1,ra,dec ad2xy,ra,dec,astr2,x2,y2 ; Scale radius r2 = r1*rcd1/rcd2 ; Let user know what we did h = ['# Input region: '+reg1,'# Input image: '+img1,$ '# Output image: '+img2] for i=0, n_elements(ra)-1 do begin h = [h,'# (ra,dec) = ('+strn(ra)+','+strn(dec)+')'] endfor ; Write out new region write_reg,reg2,x2,y2,r2,h=h return end