hmf.core.units.parse_unit¶
- hmf.core.units.parse_unit(text: str) UnitBase[source]¶
Parse a unit string that may contain
littleh, e.g. from a config file.- Parameters:
text – A unit in astropy’s generic string format, e.g.
"Msun / littleh".- Returns:
The parsed unit. If it equals one of the shared constants of this module (e.g.
Msun_h), that constant itself is returned, so the result takes the boundary’s identity fast path.- Return type: