; NAME: ; makeNormalizedGauss.Pro ; ; PURPOSE: ; To construct an image of column-wise normalized gaussians. ; ; DESCRIPTION: ; Given a list of file names and the half width of the row length, it will construct ; an image of column-wise normalized gaussians. For the Pluto 3um nirspec data, I ; suggest the following: ; rangelow = 38. ; rangehigh = 996. ; boxhalfwidth = 22. ; This will chop off the ends of the image that do not contain data in the rectified ; images and uses a boxwidth equal to that used in the gaussian fits. ; ; CALLING SEQUENCE: ; makeNormalizedGauss, fn, boxHalfWidth, rangelow, rangehigh ; ; INPUTS: ; fn - A list of file names ; boxHalfWidth - The number of pixels in rows to make the gaussian ; rangelow - The lowest column number to include ; rangehigh - The highest column number to include ; ; OUTPUTS: ; The output is a 2-D image of column-wise normalized gaussians saved as ; a FITS file. ; ; REVISON HISTORY: ; 29-APR-2004, CBO, SwRI ;- pro makeNormalizedGauss, fn, boxHalfWidth, rangelow, rangehigh, dirIn, dirOut num = N_ELEMENTS(fn) begRow = -boxHalfWidth rows = FINDGEN(2*boxHalfWidth + 1) + begRow cols = FINDGEN(rangehigh-rangelow+1)+rangelow numcol = N_ELEMENTS(cols) numrows = N_ELEMENTS(rows) centers=FLTARR(num) for i = 0, num-1 do begin g = READFITS(dirIn+fn[i]) resCtr = GOODPOLY(cols, g[1,rangelow:rangehigh], 2, 3.0, ctrfit, xused, yused) ; goodpoly fit good to fraction of pixel resW = GOODPOLY(cols, g[2,rangelow:rangehigh], 2, 3.0, wfit, xused, yused) ; goodpoly fit good to fraction of pixel meanCtr = round(mean(ctrfit)) ;the mean center needs to be an integer ;so I can extract the corresponding pixels ;to do the optimal extraction. centers[i] = meanCtr print, centers[i] plot, g[1,rangelow:rangehigh] oplot, ctrfit gaussImage = FLTARR(numCol, n_elements(rows)) for j=0, numcol-1 do begin gauss = EXP(-((rows + meanCtr- ctrfit[j])/wfit[j])^2/2) area = TOTAL(gauss) gaussImage[j, *] = gauss/area end WRITEFITS, dirout+fn[i], gaussImage end WRITEFITS, dirout+'centers.fits', centers end pro makeNormalizedGaussDRIVE, fn, boxHalfWidth, rangelow, rangehigh, dirIn, dirOut dirIn = "/Users/colkin/Work04/Triton_NIRSPEC/GaussFits/" dirOut = "/Users/colkin/Work04/Triton_NIRSPEC/NormalizedGaussians/" file = "/Users/colkin/Work04/Triton_NIRSPEC/Reduction/filePairs" readcol, file, fn, list2, maxrow, format="A, A, F" num = n_elements(list1) boxHalfWidth = 22. rangelow = 98. rangehigh = 935. makeNormalizedGauss, fn, boxHalfWidth, rangelow, rangehigh, dirIn, dirOut end