FUNCTION shapelets_surface_brightness, x, y, decomp ; ; This function takes a decomp structure and outputs the value of the ; image surface brightness at the given x and y (assumed relative to the ; centroid of the object, so that (0, 0) in x and y is the origin). ; ; NOTE that X and Y *can be vectors OR 2D arrays*, and the code will ; produce an output array of the same dimensions. Note this code ; does not integrate over pixels. ; ; The point of this function is that it does this quite quickly, in a ; vector-style way... ; if (n_elements(x) ne n_elements(y)) then message,"X and Y inputs must share same dimensions!" if (n_elements(x) eq 1) then begin xarr = replicate(x, 1) ; This is to turn scalar inputs into yarr = replicate(y, 1) ; one-element arrays endif else begin xarr = x yarr = y endelse coeffs = decomp.coeffs basis = shapelets_phi([decomp.n_max, 0], xarr, yarr, /ARRAY, BETA=decomp.beta) coeffs = reform(coeffs, [1, 1, size(coeffs, /DIMENSIONS)]) coeffs = rebin(coeffs, [size(xarr, /DIMENSIONS), n_elements(coeffs)]) if decomp.n_max gt 0L then begin terms = basis[*, *, 0L:decomp.n_coeffs-1L] * coeffs sum = total(terms, 3) endif else begin terms = basis * coeffs sum = terms endelse return, sum END
Return to the shapelets web page or the code help menu.
| Last modified on 2nd Mar 2009 by Richard Massey. |