Beispiel #1
0
        `None` (default), use the ``H0`` attribute from
        :mod:`~astropy.cosmology.default_cosmology`.

    References
    ----------
    For an illuminating discussion on why you may or may not want to use
    little-h at all, see https://arxiv.org/pdf/1308.4150.pdf
    """
    if H0 is None:
        from .realizations import default_cosmology
        H0 = default_cosmology.get().H0

    h100_val_unit = u.Unit(100 / (H0.to_value(u.km / u.s / u.Mpc)) * littleh)

    return u.Equivalency([(h100_val_unit, None)], "with_H0", kwargs={"H0": H0})


# ===================================================================
# Enable the set of default equivalencies.
# If the cosmology package is imported, this is added to the list astropy-wide.

u.add_enabled_equivalencies(dimensionless_redshift())

# =============================================================================
# DOCSTRING

# This generates a docstring for this module that describes all of the
# standard units defined here.
if __doc__ is not None:
    __doc__ += _generate_unit_summary(_ns)
Beispiel #2
0
                              doc="Dex: Base 10 logarithmic unit")

dB = RegularFunctionUnit(['dB', 'decibel'],
                         0.1 * dex,
                         namespace=_ns,
                         doc="Decibel: ten per base 10 logarithmic unit")

mag = RegularFunctionUnit(['mag'],
                          -0.4 * dex,
                          namespace=_ns,
                          doc=("Astronomical magnitude: "
                               "-2.5 per base 10 logarithmic unit"))

_add_prefixes(mag, namespace=_ns, prefixes=True)

###########################################################################
# CLEANUP

del RegularFunctionUnit
del IrreducibleFunctionUnit

###########################################################################
# DOCSTRING

# This generates a docstring for this module that describes all of the
# standard units defined here.
from astropy.units.utils import generate_unit_summary as _generate_unit_summary

if __doc__ is not None:
    __doc__ += _generate_unit_summary(globals())
Beispiel #3
0
# These calls are what core.def_unit would do, but we need to use the callable
# unit versions.  The actual function unit classes get added in logarithmic.

dex = IrreducibleFunctionUnit(['dex'], namespace=_ns,
                              doc="Dex: Base 10 logarithmic unit")

dB = RegularFunctionUnit(['dB', 'decibel'], 0.1 * dex, namespace=_ns,
                         doc="Decibel: ten per base 10 logarithmic unit")

mag = RegularFunctionUnit(['mag'], -0.4 * dex, namespace=_ns,
                          doc=("Astronomical magnitude: "
                               "-2.5 per base 10 logarithmic unit"))

_add_prefixes(mag, namespace=_ns, prefixes=True)

###########################################################################
# CLEANUP

del RegularFunctionUnit
del IrreducibleFunctionUnit

###########################################################################
# DOCSTRING

# This generates a docstring for this module that describes all of the
# standard units defined here.
from astropy.units.utils import generate_unit_summary as _generate_unit_summary
if __doc__ is not None:
    __doc__ += _generate_unit_summary(globals())