mirror of
https://github.com/Richard-Sti/csiborgtools.git
synced 2024-12-22 21:58:02 +00:00
change density to mass/mpc^3
This commit is contained in:
parent
5fa429ceb0
commit
859e3f4eb2
1 changed files with 7 additions and 7 deletions
|
@ -234,7 +234,7 @@ class BoxUnits:
|
||||||
|
|
||||||
def box2dens(self, density):
|
def box2dens(self, density):
|
||||||
r"""
|
r"""
|
||||||
Convert density from box units to :math:`M_\odot / \mathrm{pc}^3`
|
Convert density from box units to :math:`M_\odot / \mathrm{Mpc}^3`
|
||||||
(with :math:`h=0.705`).
|
(with :math:`h=0.705`).
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -248,11 +248,11 @@ class BoxUnits:
|
||||||
Density in :math:`M_\odot / \mathrm{pc}^3`.
|
Density in :math:`M_\odot / \mathrm{pc}^3`.
|
||||||
"""
|
"""
|
||||||
return (density * self._unit_d / self._Msuncgs
|
return (density * self._unit_d / self._Msuncgs
|
||||||
* (units.pc.to(units.cm))**3)
|
* (units.Mpc.to(units.cm))**3)
|
||||||
|
|
||||||
def dens2box(self, density):
|
def dens2box(self, density):
|
||||||
r"""
|
r"""
|
||||||
Convert density from :math:`M_\odot / \mathrm{pc}^3`
|
Convert density from :math:`M_\odot / \mathrm{Mpc}^3`
|
||||||
(with :math:`h=0.705`) to box units.
|
(with :math:`h=0.705`) to box units.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@ -266,16 +266,16 @@ class BoxUnits:
|
||||||
Density in box units.
|
Density in box units.
|
||||||
"""
|
"""
|
||||||
return (density / self._unit_d * self._Msuncgs
|
return (density / self._unit_d * self._Msuncgs
|
||||||
/ (units.pc.to(units.cm))**3)
|
/ (units.Mpc.to(units.cm))**3)
|
||||||
|
|
||||||
|
|
||||||
def convert_from_boxunits(data, names, boxunits):
|
def convert_from_boxunits(data, names, boxunits):
|
||||||
r"""
|
r"""
|
||||||
Convert columns named `names` in array `data` from box units to physical
|
Convert columns named `names` in array `data` from box units to physical
|
||||||
units, such that
|
units, such that
|
||||||
- length -> Mpc,
|
- length -> :math:`Mpc`,
|
||||||
- mass -> solar mass,
|
- mass -> :math:`M_\odot`,
|
||||||
- density -> solar mass per cubed kpc.
|
- density -> :math:`M_\odot / \mathrm{Mpc}^3`.
|
||||||
Any other conversions are currently not implemented. Note that the array
|
Any other conversions are currently not implemented. Note that the array
|
||||||
is passed by reference and directly modified, even though it is also
|
is passed by reference and directly modified, even though it is also
|
||||||
explicitly returned. Additionally centres the box coordinates on the
|
explicitly returned. Additionally centres the box coordinates on the
|
||||||
|
|
Loading…
Reference in a new issue