Function: FILLGAUSS2D Purpose: Fill array with values of (rotated) 2-d Gauss Category: CONVOLUTION File: fillgauss2d.c Author: M. Vogelaar Use: INTEGER FILLGAUSS2D( beam , Input REAL ARRAY phi , Input REAL maxconv , Input INTEGER gridspac, Input REAL ARRAY amplitude, Input REAL cutoffratio, Input REAL normalize, Input INTEGER NconX , Output INTEGER NconY , Output INTEGER confie , Output REAL ARRAY ) FILLGAUSS2D Returns a negative value if it was not possible to create an array with function values needed for convolution. Else, the array 'confie' is filled with convolution data in NconX*NconY box. If beam First element contains the major-, second contains the minor axis, both FWHM and in physical units. phi Position angle of the major axis (WRT. POSITIVE X-AXIS) in degrees. maxconv Max. length of array containing the convolut- ion function data. gridspac First element contains the grid spacing in X-direction, second in Y-direction in the same units as the beam. amplitude Maximum value in gauss. If 'normalize' is unequal to 0, the amplitude is set to 1.0. cutoffratio This value determines where to cutoff the gaussian convolution function. normalize If unequal to 0, the convolution function will be normalized i.e. values are scaled so that the total area will be 1. NconX Length in X-direction of function. NconY Length in Y-direction of function. confie A one dimensional array with length NconX * NconY ( smaller than 'maxconv' ), containing the calculated values of a two dimensional gaussian in a region given by the beam sizes. Description: This routine calculates the convolution function according to the user defined axis sizes of a gaussian that can be written as: f(x,y) = A exp[ -C{ (x/xh)^2 + (y/yh)^2 } ] where xh, yh are beamwidths at half power. So f(0.5*xh, 0) = 0.5 * A ==> C = 4 * Ln(2). The cutoff ratio determines the boundaries of the gaussian: For 1 dimension you can write: f(x) = A exp[ -4 Ln(2).(x/xh)^2 ] The value for which f(x) = cutoffratio . A, can be calculated with: x = xh. SQRT[ Ln(cutoffratio) / 4.Ln(2) ] Values smaller than cutoff are set to zero. Updates: Aug 30, 1992: MV, Document created