from math import exp, pi


def gaussian2d(x, y, sigma):
    """The symmetric 2d unit gaussian function.

    .. math:: \\frac{1}{2\\pi\\sigma^2}e^{\\frac{x^2 + y^2}{2\\sigma^2}}
    """
    s2 = sigma * sigma
    ret = exp(-0.5 * (x*x + y*y)/s2) / (2 * pi * s2)
    return ret