def gaussian_fcn(g, x1, x2):
    """Evaluate Gaussian on the given grid.

    Parameters:
    x1, x2: grid (as produced by numpy.mgrid f.e.)
    g: Gaussian object or list of Gaussian paramters
    """
    from math import radians, sin, cos
    from .const import fwsig
    import numpy as N
    if isinstance(g, list):
        A, C1, C2, S1, S2, Th = g
    else:
        A = g.peak_flux
        C1, C2 = g.centre_pix
        S1, S2, Th = g.size_pix
    S1 = S1 / fwsig
    S2 = S2 / fwsig
    Th = Th + 90.0
    th = radians(Th)
    cs = cos(th)
    sn = sin(th)
    f1 = ((x1 - C1) * cs + (x2 - C2) * sn) / S1
    f2 = (-(x1 - C1) * sn + (x2 - C2) * cs) / S2
    return A * N.exp(-(f1 * f1 + f2 * f2) / 2)
