; NAME: ; gaussFitByCol.Pro ; ; PURPOSE: ; To fit a gaussian to each column of a spectrum ; ; DESCRIPTION: ; Given a 2-D spectrum, it fits a gaussian (using GAUSSFIT) to each column of ; rectified spectral data. ; ; CALLING SEQUENCE: ; gaussFitByCol, image, traceCtr, boxHalfWidth, gaussCoefs ; ; INPUTS: ; image - The 2-D spectrum. ; traceCtr - The row of the center of the trace (assumes data has been rectified). ; boxHalfWidth - The number of pixels in column space to extract around the traceCtr ; ; OUTPUTS: ; gaussCoefs - The coefficients from GAUSSFIT for each column. ; ; REVISON HISTORY: ; 29-APR-2004, CBO, SwRI ;- pro gaussFitByCol, image, traceCtr, boxHalfWidth, gaussCoefs ; This procedure will loop over the columns in the image and fit a gaussian to an extracted ; region around traceCtr. sz = SIZE(image,/DIM) nCol = sz[0] nRow = sz[1] gaussCoefs = fltarr(3,nCol) begRow = traceCtr - boxHalfWidth endRow = traceCtr + boxHalfWidth rows = findgen(2*boxHalfWidth + 1) + begRow for i = 0, nCol-1 do begin $ resG = gaussfit(rows, image[i, begRow:endRow], a, nterms=3) gaussCoefs[*,i] = a end end pro gaussFitByColDRIVE file = '/Users/colkin/Work04/Pluto_3um/Reduction/maxRowBS6060' readcol, file, list1, list2, maxrow, format="A, A, F" num = n_elements(list1) boxHalfWidth = 22. dir = '/Users/colkin/Work04/Pluto_3um/BackgroundSubt3/' dirOut = '/Users/colkin/Work04/Pluto_3um/GaussFits3/' for i=0, num-1 do begin d1 = readfits(dir+list1[i]) gaussFitByCol, d1, maxrow[i], boxHalfWidth, gaussCoefs writefits, dirOut+list1[i], gaussCoefs endfor end pro gaussFitByColTRITON file = "/Users/colkin/Work04/Triton_NIRSPEC/Reduction/filePairs" readcol, file, list1, list2, maxrow, format="A, A, F" num = n_elements(list1) boxHalfWidth = 22. dir = '/Users/colkin/Work04/Triton_NIRSPEC/BackgroundSubt/' dirOut = '/Users/colkin/Work04/Triton_NIRSPEC/GaussFits/' for i=0, num-1 do begin d1 = readfits(dir+list1[i]) gaussFitByCol, d1, maxrow[i], boxHalfWidth, gaussCoefs writefits, dirOut+list1[i], gaussCoefs endfor end