def __init__(self, n=1., Ie=1., I0=None, Re=1., rsamp=None, **kwargs) : """ Parameters of the Sersic law: n, Ie, Re n is adimensional and can be anything from 0 to infinity It usually has values between 1 and 8 for real galaxies Re in parsec Ie in Lsun.pc-2 the surface brightness at 1 Re or I0 in Lsun.pc-2 the central surface brightness bn is adimensional and derived from n Other Parameters: rhoL is in Lsun.pc-3 Ltot in Lsun rho_average is also in Lsun/pc3 """ self.n = nfloat(n) self.Re = Re self.bn = self.get_bn() if I0 is None : self.Ie = Ie self.get_I0() else : self.I0 = I0 self.get_Ie() ## Compute the total 1D luminosity self.get_Ltot() ## Compute some input numbers for the Prugniel-Simien function if 'pPS97' in kwargs : self.pPS97 = kwargs.pop('pPS97') else : self.pPS97 = 1.0 - 0.6097 / self.n + 0.05463 / (self.n * self.n) self.rho0PS97 = self.I0 * self.bn**(self.n * (1. - self.pPS97)) \ * gamma(2. * self.n) / (2. * self.Re * gamma(self.n * (3. - self.pPS97))) self.r, self.rre, self.Nr = self.get_radii(rsamp) ## We derive the projected Sersic profile (direct evaluation) self.rhop = self.get_Sersic(self.r) ## we then derive the spatial luminosity profile from Simonneau et al self.rhoL = self.get_rhoSersic(self.r) ## we then derive the spatial luminosity profile from Abel deprojection self.rhoAbel = self.get_rhoAbel(self.r) self.rhoPS97 = self.get_rhoPS97(self.r) self.Mint = self.get_MintSersic(self.r) self.MintPS97 = self.get_MintPS97(self.r) self.MintAbel = self.get_MintAbel(self.r)
def get_bn(self, n=None) : """ Return the value of b_n, corresponding to a Sersic n index b_n can be derived in two ways: * a linear function of n using coefficients present in self._coef_bn_n * a fraction representation using coefficients present in self._coef_bn_invn The first function is used for n < 0.36, the second one for all other values of n """ if n is None : n = self.n else : n = nfloat(n) self.n = n if (n > 0.36) : bn_poly = np.poly1d(self._coef_bn_invn) return (2.0 * n + bn_poly(1. / n)) else : bn_poly = np.poly1d(self._coef_bn_n) return (bn_poly(n))
from pygme.utils.iodata import get_package_data __version__ = '1.1.2 (August 21, 2013)' #__version__ = '1.1.2 (August 14, 2013)' #__version__ = '1.1.1 (August 30, 2012)' #__version__ = '1.1.0 (March 3, 2012)' ## Version 1.1.3 : Fixing some docstrings ## Version 1.1.2 : Fixing bug in Integrated Luminosity ## Version 1.1.0 : small fix on the get_I0 function ###################################################################### ## Some useful values ###################################################################### Ggrav = 0.0043225524 # value from Remco in (km/s)2. Msun-1 . pc facPC = nfloat(pi / 0.648) ###################################################################### ## Tabulated function to get deprojected Sersic ###################### ## Derive the h1/2/3 functions ###################################################################### def hfunc_Abel(n) : """ Provides the parameters for an Abel integration of a Sersic function It returns a set of factors which depends on the input Sersic n """ X = get_package_data("Abel_param.dat", asfile=False) ndata = X[:,0] nudata = X[:,1] kdata = X[:,2] a0data = X[:,3]