Given the nontrivial parameters for evaluation a 2D Gaussian as a
    polynomial, compute the equivalent ellipse parameters (major, minor, pa)

    Inputs: (a, b, c), where z = exp (ax² + bxy + cy²)

    Returns:

    * mjr: major axis (sigma not FWHM) of the Gaussian
    * mnr: minor axis (sigma not FWHM) of the Gaussian
    * pa: position angle (from +x to +y) of the Gaussian, radians

def abcell (a, b, c):
    """Given the nontrivial parameters for evaluation a 2D Gaussian as a
    polynomial, compute the equivalent ellipse parameters (major, minor, pa)

    Inputs: (a, b, c), where z = exp (ax² + bxy + cy²)

    Returns:

    * mjr: major axis (sigma not FWHM) of the Gaussian
    * mnr: minor axis (sigma not FWHM) of the Gaussian
    * pa: position angle (from +x to +y) of the Gaussian, radians

    """
    from numpy import arctan2, sqrt

    bad = _abccheck (a, b, c)
    pa = 0.5 * arctan2 (b, a - c)

    t1 = np.sqrt ((a - c)**2 + b**2)
    t2 = -t1 - a - c
    bad |= (t2 <= 0)
    mjr = t2**-0.5

    t2 = t1 - a - c
    bad |= (t2 <= 0)
    mnr = t2**-0.5

    w = np.where (bad)
    mjr[w] = np.nan
    mnr[w] = np.nan
    pa[w] = np.nan

    return ellnorm (mjr, mnr, pa)