Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


next up previous contents index
Next: matrix - Tool Up: mathematics - Module Previous: gaussian1d - Function


gaussian2d - Function



Package utility
Module mathematics


Calculate two-dimensional Gaussian


Synopsis
gaussian2d(x, y, height, center, fwhm, pa)

include "gaussian.g"



Description

The gaussian2d function evaluates two-dimensional Gaussians. You can specify the peak height of the Gaussian, the center of the Gaussian, the width of the major and minor axes and the position-angle of the Gaussian.

The width of the Gaussian is defined to be the full width at half-maximum (FWHM). If you prefer to use ``natural'' widths a constant fwhm_to_natural is provided1.5. To get a natural width, multiply the FWHM by this constant 1.6. Similarly the FWHM is derived by dividing the natural width by this constant.

The ``position angle'' is the angle, measured counter-clockwise, between the ``x'' axis and the major axis of the Gaussian. This angle is in radians.

The major axis of the Gaussian is considered to be the first axis of the specified FWHM, whether or not that width is in fact wider than the second axis. If you care about this, you should be careful to ensure that the first width is not smaller than the second.

You can evaluate the Gaussian at a number of positions by passing the function a vector for ``x'' and ``y'' instead of just scalars.



Arguments

x in values at which to evaluate the Gaussian
    Allowed: double
    Default: no default
y in values at which to evaluate the Gaussian
    Allowed: numeric
    Default: no default
height in maximum value of the Gaussian
    Allowed: double
    Default: 1.0
center in location of the maximum value of the Gaussian
    Allowed: double vector
    Default: [0.0,0.0]
fwhm in width of the gaussian
    Allowed: double vector
    Default: [1.0,1.0]/fwhm_to_natural
pa in position angle (from y-axis to major-axis) (radians)
    Allowed: double
    Default: 0.0


Returns
The ``z'' values or fail


Example
First evaluate a 2-D Gaussian onto a [100,100] array.
      include 'gaussian.g';
      z := array(0, 100, 100);
      x := 1:100
      for (i in 1:100) {
        y := array(x[i], 100);
        z[,i] := gaussian2d(x, y, center=[50, 50], fwhm=[30, 15], pa=30*pi/180)
      }
And then show it in a plotter:
      include 'pgplotter.g';
      pg := pgplotter();
      pg.env(1, 100, 1, 100, 1, 0);
      pg.gray(z, 1, 0, [0, 1, 0, 0, 0, 1])


See Also
gaussian1d



next up previous contents index
Next: matrix - Tool Up: mathematics - Module Previous: gaussian1d - Function   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15