; NAME: ; Rectify.Pro ; ; PURPOSE: ; Returns an rectified image in lambda, p space. ; ; DESCRIPTION: ; Given a 2-D spectrum, it transforms the image such that the spectrum is ; dispersed along columns and the star trace is along one row. ; ; CALLING SEQUENCE: ; RECTIFY, xg, yg, nLam, nP, d ; ; INPUTS: ; nLam - delta lambda for the output grid ; nP - delta p for the output grid ; filename - the name of the file to be rectified ; ; OUTPUTS: ; ; REVISON HISTORY: ; 27-APR-2004, CBO, SwRI ;- pro RECTIFY,xg, yg, nLam, nP, fileName ; This procedure will rectify a 2-D spectral image (image). First a grid of wavelength ; and slit position is created from the user-specified beginning and end points and increment. ; The grid of wavelength (lamg) and slit position (pg) are transformed to a grid of ; CCD x and y coordinates using parx and pary. The data are rotated because we ; want our spectrum to be dispersed along columns. The data corresponding to the grid ; coordinates are extracted and then smoothed back by a factor of scale factor to the original ; nLam by nP. The resulting image is returned in dg. ; Note the slit position is determined by the position of the trace at y=512. superFlat = readfits('/Users/colkin/Work04/Pluto_3um/Reduction/Flatten/SuperFlat.fits') d = readfits('/Users/colkin/Data/12aug01_CD1/spec/'+fileName)/superFlat rd = rotate(d, 3) dg = rd[xg, yg] dgf = fltarr(nLam, nP) dgf = rebin(dg, nLam, nP) writefits, '/Users/colkin/Work04/Pluto_3um/Rectified6/'+fileName, dgf atv, dgf end pro rectifyDRIVE, list1 parx = readfits('/Users/colkin/Work04/Pluto_3um/Reduction/Rectify/xMapParams8.fits') pary = readfits('/Users/colkin/Work04/Pluto_3um/Reduction/Rectify/yMapParams7.fits') lamBeg = 2.85 lamEnd = 3.72 pBeg = 200. pEnd = 430. nLam = 1024. nP=300. scaleFactor = 8. nLam2 = scaleFactor*nLam nP2 = scaleFactor*nP lamg = replicate(1.0, nP2)##(lamBeg + ((lamEnd - lamBeg)/nLam2)*findgen(nLam2)) pg = (((pEnd - pBeg)/nP2)*findgen(nP2) + pBeg)##replicate(1.0, (nLam2)) BIVARIATEQUARTIC, parx, lamg, pg, xg BIVARIATEQUARTIC, pary, lamg, pg, yg for i=0, n_elements(list1)-1 do rectify, xg, yg, nLam, nP, list1[i] end pro rectifyDRIVETriton, name dir = "/Users/colkin/Work04/Triton_NIRSPEC/Reduction/Rectify/" parx = readfits(dir+'xMapParams3.fits') pary = readfits(dir+'yMapParams3.fits') lamBeg = 1.91 lamEnd = 2.43 pBeg = 170. pEnd = 464. nLam = 1024. nP=300. scaleFactor = 8. nLam2 = scaleFactor*nLam nP2 = scaleFactor*nP lamg = replicate(1.0, nP2)##(lamBeg + ((lamEnd - lamBeg)/nLam2)*findgen(nLam2)) pg = (((pEnd - pBeg)/nP2)*findgen(nP2) + pBeg)##replicate(1.0, (nLam2)) BIVARIATEQUARTIC, parx, lamg, pg, xg BIVARIATEQUARTIC, pary, lamg, pg, yg superFlat = readfits('/Users/colkin/Work04/Triton_NIRSPEC/Reduction/superFlat.fits') for i=0, n_elements(name)-1 do begin d = readfits(name[i])/superFlat rd = rotate(d, 3) dg = rd[xg, yg] dgf = fltarr(nLam, nP) dgf = rebin(dg, nLam, nP) filename = strmid(name[i], 36, 15) writefits, '/Users/colkin/Work04/Triton_NIRSPEC/Rectified1/'+filename, dgf atv, dgf end end