[Yt-svn] commit/yt: sklemer: Correct units and semantics for Density and Dark_Matter_Density
Bitbucket
commits-noreply at bitbucket.org
Tue Jul 26 06:19:06 PDT 2011
1 new changeset in yt:
http://bitbucket.org/yt_analysis/yt/changeset/915bd243872f/
changeset: 915bd243872f
branch: yt
user: sklemer
date: 2011-07-26 09:00:24
summary: Correct units and semantics for Density and Dark_Matter_Density
(Corrects "TotalMassMsun" and "Matter_Density" as well)
affected #: 3 files (521 bytes)
--- a/yt/frontends/nyx/data_structures.py Wed Jul 20 15:56:11 2011 +0200
+++ b/yt/frontends/nyx/data_structures.py Tue Jul 26 09:00:24 2011 +0200
@@ -673,7 +673,8 @@
def _parse_fparameter_file(self):
"""
Parses the fortran parameter file for Nyx. Most of this will be useless,
- but this is where it keeps mu = mass per particle/m_hydrogen.
+ but this is where it keeps mu = mass per particle/m_hydrogen. Also it
+ contains the cosmological variables.
"""
# @todo: delete after new Nyx output
@@ -717,7 +718,9 @@
mylog.warning("Length units: setting 1.0 = 1.0 Mpc.")
self.units.update(mpc_conversion)
- self.units["Density"] = self.units["particle_mass"]/(self.units["cm"])**3
+ self.units["density"] = self.units["particle_mass"]/(self.units["cm"])**3
+ self.units["particle_mass_density"] = self.units["density"]
+ self.units["Density"] = 1
# @todo: enzo-isms
mylog.warning("Time units: setting 1.0 = Mpc/km s ~ 10^12 yr .")
--- a/yt/frontends/nyx/definitions.py Wed Jul 20 15:56:11 2011 +0200
+++ b/yt/frontends/nyx/definitions.py Tue Jul 26 09:00:24 2011 +0200
@@ -88,3 +88,4 @@
nyx_particle_field_names = ['particle_position_%s' % ax for ax in 'xyz'] + \
['particle_mass'] + \
['particle_velocity_%s' % ax for ax in 'xyz']
+
--- a/yt/frontends/nyx/fields.py Wed Jul 20 15:56:11 2011 +0200
+++ b/yt/frontends/nyx/fields.py Tue Jul 26 09:00:24 2011 +0200
@@ -44,11 +44,15 @@
add_nyx_field = add_field # alias for API
# Density
-# @todo: I think this should be called ``gas_density``
add_field("density", function=lambda a, b: None, take_log=True,
validators=[ValidateDataField("density")],
- units=r"\rm{M_{\odot}} / \rm{Mpc}^3")
-nyx_fields["density"]._projected_units =r"\rm{M_{\odot}} / \rm{Mpc}^2"
+ units=r"\rm{g}} / \rm{cm}^3",
+ projected_units =r"\rm{g}} / \rm{cm}^2")
+nyx_fields["density"]._projected_units =r"\rm{g}} / \rm{cm}^2"
+
+add_field("Density", function=lambda a, b: b["density"], take_log=True,
+ units=r"\rm{g}} / \rm{cm}^3",
+ projected_units =r"\rm{g}} / \rm{cm}^2")
# Particle mass in units of $ M_{\odot}
def _convertParticleMassMsun(data):
@@ -58,6 +62,11 @@
add_field("ParticleMassMsun", function=_particle_mass_m_sun,
validators=[ValidateSpatial(0), ValidateDataField("particle_mass")],
particle_type=True, convert_function=_convertParticleMassMsun, take_log=True, units=r"\rm{M_{\odot}}")
+
+add_field("Dark_Matter_Density", function=lambda a, b: b["particle_mass_density"], take_log=True,
+ units=r"\rm{g}} / \rm{cm}^3",particle_type=True,
+ projected_units =r"\rm{g}} / \rm{cm}^2")
+
# Energy Density
# @todo: ``energy_density``
@@ -141,3 +150,4 @@
data["ThermalEnergy"] / (kboltz * data["Density"]))
add_field("Temperature", function=_temperature, take_log=False,
units=r"\rm{Kelvin}")
+
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list