;+ ; NAME: ; smei_sky_cleanedge_map ; PURPOSE: ; Wrapper for href=smei_sky_cleanedge_fov= for processing ; a single Fits skymap. ; CATEGORY: ; ucsd/camera/idl/stars ; CALLING SEQUENCE: PRO smei_sky_cleanedge_map, file, $ overwrite = overwrite , $ degrees = degrees , $ silent = silent ; INPUTS: ; file scalar; type; string ; fully-qualified file name of sky map ; OPTIONAL INPUTS: ; /degrees ; /silent ; /overwrite ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; smei_sky, smei_sky_cleanedge_fov, GetFileSpec, do_file ; PROCEDURE: ; MODIFICATION HISTORY: ; APR-2007, Paul Hick (UCSD/CASS) ;- InitVar, overwrite, /key IF (file_search(file))[0] EQ '' THEN BEGIN ; File does not exist: return count = 0 error = hide_env(file)+' not found' IF silent LE 1 THEN message, /info, error RETURN ENDIF eq_hdr = headfits(file) clnedge = fxpar(eq_hdr,'CLNEDGE') IF !err LT 0 THEN clnedge = 0 IF clnedge THEN BEGIN message, /info, 'fov edge already fixed' RETURN ENDIF ; Read the time map and thetax map ; Both maps have the same resolution smei_sky, file, /orbsecs , hdr=time_hdr, sky=time_map, /noplot, silent=silent smei_sky, file, /fovx , hdr=fovx_hdr, sky=fovx_map, /noplot, silent=silent, degrees=degrees smei_sky, file, /equatraw, sky=eq_sky, nbin=1, /noplot, silent=silent smei_sky, file, /northraw, sky=np_sky, nbin=1, /noplot, silent=silent smei_sky, file, /southraw, sky=sp_sky, nbin=1, /noplot, silent=silent smei_sky_cleanedge_fov, $ eq_sky = eq_sky , $ np_sky = np_sky , $ sp_sky = sp_sky , $ time_map = time_map , $ fovx_map = fovx_map , $ degrees = degrees , $ silent = silent ; Make a copy of the skymap by reading/writing Fits headers ; and binary data from source to destination file, only ; replacing the hires skymaps with the corrected maps. ; Also make sure the Fits keyword CLNEDGE is set. new_file = GetFileSpec(GetFileSpec(file,part='name'),part='name') new_file = filepath(root=getenv('TUB'),new_file+'_tmp.fts') exten_no = 0 sky = readfits(file, hdr, exten_no=exten_no, /silent) fxaddpar,hdr,'CLNEDGE','T',' Clean edge' REPEAT BEGIN CASE exten_no OF 0 : writefits, new_file, eq_sky, hdr 1 : writefits, new_file, np_sky, hdr, /append 2 : writefits, new_file, sp_sky, hdr, /append ELSE: writefits, new_file, sky, hdr, /append ENDCASE exten_no += 1 sky = readfits(file, hdr, exten_no=exten_no, /silent) ENDREP UNTIL n_elements(sky) EQ 1 CASE overwrite OF 0: message, /info, hide_env(new_file) 1: tmp = do_file(/move,new_file,file) ENDCASE RETURN & END