def luminosity_correction(self):
        """
        The galaxev templates are in L_sun/Angstrom, with L_sun = 3.826e26W
          so we change to the appropriate flux at each relevent redshift. We
          also multiply by 1e11, so that the flux is appropriate for a galaxy
          of mass 1e11 M_sun.
        
        Our SED code gives correct magnitudes if the SED is in units of
          ergs/s/cm/cm/Angstrom, and our distance class gives distances in
          Mpc/h, so we will need to use the conversion Mpc = 3.08568e24cm
          and assume a value for h.

        The conversion factor is conv = flux_density/luminosity_density and
          the templates should therefore be multiplied by conv to get the
          correct flux_density. The factor of (1+z) accounts for the fact that
          these are _densities_.

                    1e11   3.826e33
            conv =  ----- ----------
                    (1+z) 4 pi Dl**2
        """
        from stellarpop import distances
        from math import pi
        dist = distances.Distance()
        dist.h = 0.7
        dist.OMEGA_M = 0.3
        dist.OMEGA_L = 0.7
        cm_per_Mpc = 3.08568e24
        corr = []
        for z in self.redshifts:
            if z == 0:
                dl = 1e-5 * cm_per_Mpc
            else:
                dl = dist.Dl(z) * cm_per_Mpc
            conv = 1 / (4 * pi * dl**2)
            conv *= 3.826e33
            corr.append(conv)

        return corr
Example #2
0
    filtermag = tools.VegaFilterMagnitude(f1, SED, z1)
#    vegatmp = tools.getSED('Vega')
#    vegaAB = tools.ABFilterMagnitude(f1,vegatmp,0.)
else:
    filtermag = tools.ABFilterMagnitude(f1, SED, z1)
magoffset = m1 - filtermag
#print magoffset

if vega:
    m2 = tools.VegaFilterMagnitude(f2, SED, z2) + magoffset
else:
    m2 = tools.ABFilterMagnitude(f2, SED, z2) + magoffset
if z1 != z2:
    from stellarpop import distances
    from math import log10
    dist = distances.Distance()
    dist.OMEGA_M = Om
    dist.OMEGA_L = OL
    dist.h = H0 / 100.
    if z2 != 0.:
        dimming = dist.Dl(z1) / dist.Dl(z2)
    else:
        dimming = dist.Dl(z1) / 1e-5
    m2 -= 5. * log10(dimming)

if convert:
    vegatmp = tools.getSED('Vega')
    vegatmp = (vegatmp[0], vegatmp[1])
    vegaAB = tools.ABFilterMagnitude(f2, vegatmp, 0.)
    if vega:
        m2 += vegaAB