import math


def TotalMagExp( params, zeroPoint=0, magOut=True, ell=0.0 ):
	"""Calculate the total magnitude (or flux if magOut=False) for an
	2D exponential with [I_0, h] = params, where I_0 is in counts/pixel
	and h is in pixels.  Optionally, the ellipticity can be specified.
	"""
	I_0 = params[0]
	h = params[1]
	totalFlux = 2 * math.pi * I_0 * (h*h) * (1.0 - ell)
	if magOut:
		return (zeroPoint - 2.5 * math.log10(totalFlux))
	else:
		return totalFlux