; ; CALLING SEQUENCE: dpm_512[,filelist=files,xdim=x,ydim=y] ; ; PARAMETERS: All parameters are optional. If none are provided, dpm_512 ; will default to resizing all .fts images in current directory ; filelist is optional filelist ; xdim and ydim are user provided sizes for cropped images. If ; they are not supplied, dpm_512 defaults to 512x512 ; ; NOTE: This procedure will resize a centered, square PICS or CHIP ; image to a size more suitable for analysis. It is ; recommended before running this program to use dpm_crop ; on the images to get them centered in a square array and ; then resize them using this program. ; ; HISTORY: Drafted by Tony Darnell, 12-MAY-99 ; ; PRO dpm_512,filelist=filelist,xdim=xdim,ydim=ydim path=curdir() IF (NOT KEYWORD_SET(xdim)) THEN xdim=512 IF (NOT KEYWORD_SET(ydim)) THEN ydim=512 IF (KEYWORD_SET(filelist)) THEN filelist=rd_tfile(filelist) $ ELSE BEGIN filelist=file_list(path,'*fts',/CD) filelist=strip_dirname(filelist) ENDELSE sz=SIZE(filelist) FOR i=0,sz(1)-1 DO BEGIN ;{ message,'Reading file: '+filelist(i),/INFORMATIONAL curr_image=readfits(filelist(i),curr_hdu) xsz=fxpar(curr_hdu,'NAXIS1') ysz=fxpar(curr_hdu,'NAXIS2') x_center=fxpar(curr_hdu,'CRPIX1') y_center=fxpar(curr_hdu,'CRPIX2') CATCH,file_err IF (file_err NE 0) THEN BEGIN ;{ MESSAGE,!ERR_STRING+' ,skipping this file',/INFORMATIONAL GOTO,leave_loop ENDIF ;} final_img=CONGRID(curr_image,xdim,ydim) fxaddpar,curr_hdu,'NAXIS1',xdim fxaddpar,curr_hdu,'NAXIS2',ydim fxaddpar,curr_hdu,'CRPIX1',xdim/2 fxaddpar,curr_hdu,'CRPIX2',ydim/2 ;filename=STRMID(filelist(i),0,STRLEN(filelist(i))-3) filename=filelist(i) IF (STRMID(filename,STRLEN(filename)-8,4) EQ 'crop') THEN $ filename=STRMID(filename,0,STRLEN(filename)-8) ELSE $ filename=STRMID(filename,0,STRLEN(filename)-3) filename=filename+'crop_512.fts' MESSAGE,'Writing file: '+filename,/INFORMATIONAL MESSAGE,'as '+STRING(xdim)+' by '+STRING(ydim)+' image.', $ /INFORMATIONAL writefits,filename,final_img,curr_hdu leave_loop: ENDFOR ;} ; ; Reset arrays so they take up less memory ; temp=0.0 final_img=0.0 curr_img=0.0 END