[units] add ssfrK unit (used in SK plots)
This commit is contained in:
@@ -41,7 +41,7 @@ def unit_str(unit, base=None, prefix="", format=" [{unit}]"):
|
||||
"""
|
||||
if unit == U.none:
|
||||
return ""
|
||||
elif not base is None:
|
||||
elif base is not None:
|
||||
coeff = unit.express(base)
|
||||
u_str = unit_str(base, prefix=convert_exp(coeff) + " ")
|
||||
elif len(unit.latex) > 0:
|
||||
@@ -51,11 +51,8 @@ def unit_str(unit, base=None, prefix="", format=" [{unit}]"):
|
||||
else:
|
||||
u_str = r"${}{}$".format(prefix, unit.latex.replace("text", "math"))
|
||||
elif len(unit.name) > 0:
|
||||
try:
|
||||
base_str = ".".join(map(parse_exp_unit, unit.name.split(".")))
|
||||
u_str = r"${}{}$".format(prefix, base_str)
|
||||
except:
|
||||
u_str = r"${}{}$".format(prefix, unit.name)
|
||||
base_str = ".".join(map(parse_exp_unit, unit.name.split(".")))
|
||||
u_str = r"${}{}$".format(prefix, base_str)
|
||||
else:
|
||||
base_str = ".".join(
|
||||
map(parse_exp_unit, unit._decompose_base_units().split("."))
|
||||
@@ -92,3 +89,10 @@ U.ssfrG = create_unit(
|
||||
U.uG = create_unit(
|
||||
"μG", base_unit=1e-10 * U.T, descr="Micro Gauss", latex="\\mu\\mathrm{G}"
|
||||
)
|
||||
|
||||
U.ssfrK = create_unit(
|
||||
"Msun.year^-1.kpc^-2",
|
||||
base_unit=U.Msun / U.year / U.kpc ** 2,
|
||||
descr="Surfacic SFR",
|
||||
latex="\mathrm{M}_{\odot}.\mathrm{yr}^{-1}.\mathrm{kpc}^{-2}",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user