;+ ; NAME: ; smei_sky_hdr_check ; PURPOSE: ; Align sky map headers for various routines ; CATEGORY: ; camera/idl/sky ; CALLING SEQUENCE: PRO smei_sky_hdr_check, hdrs, hdr ; INPUTS: ; hdrs structure; type: smei_sky_hdr ; hdr structure; type: smei_sky_hdr ; ; OUTPUTS: ; hdrs=hdrs structure or array; type: smei_sky_hdr ; ; INCLUDE: @compile_opt.pro ; On error, return to caller ; PROCEDURE: ; smei_sky_hdr_check, hdrs, hdr ; two headers to be compared ; MODIFICATION HISTORY: ; FEB-2010, John Clover (UCSD/CASS) ; Compares two hdr structures for matching cameras and ; returns them with the same dimensions ; Still ignorant of modes, and prefers c3 to c3s unless ; /prefer_smoothdark was used in caller (smei_sky) ; ;- camloca = intarr(3) camlocb = intarr(3) for i=1,3 do begin ;caveat, if /prefer_smoothdark not set, both smooth and unsmoothed ;c3 are in the list and will return two locations ;here I pick the first, which is not smoothed by default ;since you can force it to unsmoothed with prefer.. so ;instead assume that if it is not specified, that you should ;use the standard skymap camloca[i-1] = ((where(hdrs.camera EQ i))[0] GE 0) camlocb[i-1] = ((where(hdr.camera EQ i))[0] GE 0) end ; multiply arrays [1, 1, 0] * [1, 0, 0] returns [1, 0, 0] keep camera 1 combined = camloca*camlocb ; if there is no overlap, nullify both headers if ((where(combined EQ 1))[0] ne -1) then begin for i=0, n_elements(hdrs)-1 do begin ; camera # is in hdrs[i].cameras but here hdrs[i] if (combined[hdrs[i].camera-1] EQ 1) THEN boost, comba, i end for i=0, n_elements(hdr)-1 do begin if (combined[hdr[i].camera-1] EQ 1) THEN boost, combb, i end hdrs = hdrs[comba] hdr = hdr[combb] endif else begin ; no overlap, nullify both headers ; smei_sky_read returns -1 for null header hdrs = -1 hdr = -1 end END