lfkit.utils.units#

Unit conversion utilities used across LFKit.

This module provides small, self-contained helpers for converting between astronomical and cosmological unit systems commonly needed in luminosity function and correction calculations.

Currently supported conversions include:

  • Megaparsec to kilometers.

  • Gigayear to seconds.

  • Hubble constant from km/s/Mpc to 1/Gyr.

These helpers are intentionally lightweight and avoid external dependencies. They are designed for internal use by cosmology and correction modules.

Functions

h0_km_s_mpc_to_gyr_inv(h0_km_s_mpc)

Convert a Hubble constant from km/s/Mpc to 1/Gyr.

km_per_mpc()

Return the number of kilometers in one megaparsec.

mag_to_maggies(m_ab)

Converts AB magnitudes to maggies (linear flux units).

magerr_to_ivar_maggies(m_ab, sigma_m)

Converts magnitude uncertainties to inverse variance in maggies.

maggies_to_mag(maggies, *[, floor])

Convert maggies to magnitudes with a safety floor.

sec_per_gyr()

Return the number of seconds in one gigayear.