Package cosmolopy :: Module magnitudes

Module magnitudes

source code

Conversions between fluxes, luminosities and AB magnitudes.
Functions
 
nu_lambda(coordinate)
Convert between frequency and wavelength, nu to lambda or lambda to nu.
source code
 
f_nu_lambda(flux, coordinate)
Convert f_nu to f_lambda or f_lambda to f_nu.
source code
 
f_nu_from_magAB(magAB)
Convert apparent magnitude into flux (erg s^-1 cm^-2 Hz^-1).
source code
 
L_nu_from_magAB(magAB)
Convert absolute magnitude into luminosity (erg s^-1 Hz^-1).
source code
 
magnitude_AB_from_L_nu(luminosity_nu)
Convert luminosity (erg s^-1 Hz^-1) into absolute magnitude.
source code
 
distance_modulus(z, **cosmo)
Distance modulus mu = m-M.
source code
 
magnitude_AB(z, f_lambda, wavelength, **cosmo)
The apparent and absolute AB magnitude given a flux.
source code
 
magnitude_AB1450(z, f_lambda, wavelength, nu_power=-0.5, **cosmo)
Extrapolate to the AB magnitude at 1450 Angstroms.
source code
Variables
  MAB0 = 48.599934377717773
  __package__ = 'cosmolopy'
Function Details

nu_lambda(coordinate)

source code 

Convert between frequency and wavelength, nu to lambda or lambda to nu.

Either:
given lambda returns 'nu' or given nu returns lambda.
Units are:
Hz for nu and Ang for lambda.

Works because nu = c/lambda and lambda = c/nu, and I use c in units of Angs/s.

Usage

>>> from cosmolopy import magnitudes
>>> nu = magnitudes.nu_lambda(1216.)
>>> lam = magnitudes.nu_lambda(nu)
>>> lam
1216.0

f_nu_lambda(flux, coordinate)

source code 

Convert f_nu to f_lambda or f_lambda to f_nu.

Either:
given f_lambda and lambda returns f_nu and 'nu' or given f_nu and nu returns f_lambda and lambda.
Units are:
erg s^-1 cm^-2 Hz^-1 for f_nu and erg s^-1 cm^-2 Ang^-1 for f_lambda.

Works because f_nu = f_lambda * lambda**2/c and f_lambda = f_nu * nu**2/c, and I use c in units of Angs/s.

Usage

>>> from cosmolopy import magnitudes
>>> fnu, nu = magnitudes.f_nu_lambda(2.0, 1216.)
>>> flam, lam = magnitudes.f_nu_lambda(fnu, nu)
>>> flam, lam
(2.0, 1216.0)

f_nu_from_magAB(magAB)

source code 

Convert apparent magnitude into flux (erg s^-1 cm^-2 Hz^-1).

Usage

Check that the AB magnitude zero point is 3631 Jy:

>>> from cosmolopy import magnitudes
>>> "%.4g" % (magnitudes.f_nu_from_magAB(0.0)/1e-23)
'3631'

L_nu_from_magAB(magAB)

source code 

Convert absolute magnitude into luminosity (erg s^-1 Hz^-1).

Usage

Check that the AB magnitude zero point is 3631 Jy:

>>> from cosmolopy import magnitudes
>>> import math
>>> L_nu = magnitudes.L_nu_from_magAB(0.0)
>>> "%.4g" % (L_nu/(1e-23 * 4. * math.pi * (10*cc.pc_cm)**2))
'3631'

magnitude_AB_from_L_nu(luminosity_nu)

source code 

Convert luminosity (erg s^-1 Hz^-1) into absolute magnitude.

Usage

Check that the AB magnitude zero point is 3631 Jy:

>>> import numpy, math
>>> from cosmolopy import magnitudes, cc
>>> L_nu = 3631e-23 * (4. * math.pi * (10*cc.pc_cm)**2)
>>> "%.3f" % numpy.abs(magnitudes.magnitude_AB_from_L_nu(L_nu))
'0.000'

distance_modulus(z, **cosmo)

source code 

Distance modulus mu = m-M.

The distance modulus is the difference between the apparent and absolute magnitudes,

mu = 5 log(d/10 pc)

Usage

>>> from cosmolopy import fidcosmo, magnitudes
>>> "mu(z=6) = %.4g" % magnitudes.distance_modulus(6.0, **fidcosmo)
'mu(z=6) = 48.86'

magnitude_AB(z, f_lambda, wavelength, **cosmo)

source code 

The apparent and absolute AB magnitude given a flux.

Inputs

z: array or scalar
the redshift of the source. Set to None to get absolute magnitude from a luminosity.
f_lambda: array or scalar
observed flux from the source in units of erg s^-1 cm^-2 Ang^-1
wavelength: array or scalar
the observed wavelength of the flux measurement(s) in Angstroms

Returns

Returns ab (apparent), and AB (absolute) magnitudes.

Notes

Note that here you pass fluxes that are per unit wavelength, not per unit frequency. To get the absolute magnitude for a luminosity specified in units of erg s^-1 Ang^-1, set z=None.

Usage

Check that the AB magnitude zero point is 3631 Jy:

>>> from cosmolopy import fidcosmo, magnitudes, cc, cd
>>> import numpy, math
>>> L_nu = 3631e-23 * (4. * math.pi * (10*cc.pc_cm)**2)
>>> nu = magnitudes.nu_lambda(1216.)
>>> L_lambda, lamb = magnitudes.f_nu_lambda(L_nu, nu)
>>> mAB, MAB = magnitudes.magnitude_AB(None, L_lambda, 1216., **fidcosmo)
>>> "%.3f" % numpy.abs(MAB)
'0.000'

Find the apparent (and absolute, which should be zero) magnitudes of a 3631 Jy source at z=6.0:

>>> from cosmolopy import fidcosmo, magnitudes, cc, cd
>>> import numpy, math
>>> L_nu = 3631e-23 * (4. * math.pi * (10*cc.pc_cm)**2)
>>> nu = magnitudes.nu_lambda(1216.)
>>> L_lambda, lamb = magnitudes.f_nu_lambda(L_nu, nu)
>>> dl = cd.luminosity_distance(6.0, **fidcosmo)
>>> f_lambda = L_lambda/(4. * math.pi * (dl*cc.Mpc_cm)**2 * (1. + 6.0))
>>> mAB, MAB = magnitudes.magnitude_AB(6.0, f_lambda, 7.*1216., **fidcosmo)
>>> "%.3f, %.3f" % (mAB, MAB)
'48.865, 0.000'

magnitude_AB1450(z, f_lambda, wavelength, nu_power=-0.5, **cosmo)

source code 

Extrapolate to the AB magnitude at 1450 Angstroms.

Inputs

z: array or scalar
the redshift of the source
f_lambda: array or scalar
observed flux from the source in units of erg s^-1 cm^-2 Ang^-1
wavelength: array or scalar
the observed wavelength of the flux measurement(s) in Angstroms.
nu_power:
the powerlaw index (f_nu ~ nu^nu_power) used to extrapolate the flux to 1450 Angstroms.

Returns

Apparent and absolute magnitudes extrapolated to 1450 Angstroms.

Notes

Follows Fan et al. 2003:

We extrapolate the continuum to rest-frame 1450A, assuming a continuum shape f_nu ~ nu^-0.5 to calculate AB_1450.

Usage

Find the apparent and absolute rest-frame 1450 Angstrom magnitudes of source with a flux of 3631 Jy at rest-frame 1216 Angstroms at z=6.0:

>>> from cosmolopy import fidcosmo, magnitudes, cc, cd
>>> import numpy, math
>>> L_nu = 3631e-23 * (4. * math.pi * (10*cc.pc_cm)**2)
>>> nu = magnitudes.nu_lambda(1216.)
>>> L_lambda, lamb = magnitudes.f_nu_lambda(L_nu, nu)
>>> dl = cd.luminosity_distance(6.0, **fidcosmo)
>>> f_lambda = L_lambda/(4. * math.pi * (dl*cc.Mpc_cm)**2 * (1. + 6.0))
>>> mAB, MAB = magnitudes.magnitude_AB1450(6.0, f_lambda, 7.*1216.,
...                                        **fidcosmo)
>>> "%.3f, %.3f" % (mAB, MAB)
'48.769, -0.096'

And is that offset from an absolute magnitude of zero consisten with our assumed powerlaw index?

>>> "%.3f" %(-2.5 * numpy.log10((1216./1450)**0.5))
'0.096'