[yt-svn] commit/yt: 7 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Aug 27 09:31:05 PDT 2015
7 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/311803d41a5a/
Changeset: 311803d41a5a
Branch: yt
User: ngoldbaum
Date: 2015-08-19 19:30:28+00:00
Summary: Add scale factor as a unit valid for cosmology simulations
Affected #: 1 file
diff -r d5816147380b81418aec9ccc7ac0f551e8ddce21 -r 311803d41a5a7ec7d09c05deb55d1ed4d728c575 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -683,6 +683,7 @@
self.unit_registry.add("code_velocity", 1.0, dimensions.velocity)
self.unit_registry.add("code_metallicity", 1.0,
dimensions.dimensionless)
+ self.unit_registry.add("a", 1.0, dimensions.dimensionless)
def set_units(self):
"""
@@ -700,6 +701,7 @@
self.unit_registry.add(new_unit, self.unit_registry.lut[my_unit][0] /
(1 + self.current_redshift),
length, "\\rm{%s}/(1+z)" % my_unit)
+ self.unit_registry.modify('a', 1/(1+self.current_redshift))
self.set_code_units()
https://bitbucket.org/yt_analysis/yt/commits/8bd247d86e0c/
Changeset: 8bd247d86e0c
Branch: yt
User: ngoldbaum
Date: 2015-08-19 19:33:20+00:00
Summary: Ensure gadget velocity units are scaled by a**(1/2)
Affected #: 1 file
diff -r 311803d41a5a7ec7d09c05deb55d1ed4d728c575 -r 8bd247d86e0ca563a2b8bc17447259d659e2beb5 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -218,12 +218,21 @@
self.length_unit = self.quan(length_unit[0], length_unit[1])
unit_base = self._unit_base or {}
+
+ if self.cosmological_simulation:
+ # see http://www.mpa-garching.mpg.de/gadget/gadget-list/0113.html
+ # for why we need to include a factor of square root of the
+ # scale factor
+ vel_units = "cm/s * sqrt(a)"
+ else:
+ vel_units = "cm/s"
+
if "velocity" in unit_base:
velocity_unit = unit_base["velocity"]
elif "UnitVelocity_in_cm_per_s" in unit_base:
- velocity_unit = (unit_base["UnitVelocity_in_cm_per_s"], "cm/s")
+ velocity_unit = (unit_base["UnitVelocity_in_cm_per_s"], vel_units)
else:
- velocity_unit = (1e5, "cm/s")
+ velocity_unit = (1e5, vel_units)
velocity_unit = _fix_unit_ordering(velocity_unit)
self.velocity_unit = self.quan(velocity_unit[0], velocity_unit[1])
https://bitbucket.org/yt_analysis/yt/commits/4db654627383/
Changeset: 4db654627383
Branch: yt
User: ngoldbaum
Date: 2015-08-19 19:33:43+00:00
Summary: Ensure time units are based on the internal comoving velocity units
Affected #: 1 file
diff -r 8bd247d86e0ca563a2b8bc17447259d659e2beb5 -r 4db654627383a15db60df8d7e8ea4de8034fc011 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -250,7 +250,23 @@
mass_unit = (1.0, "1e10*Msun/h")
mass_unit = _fix_unit_ordering(mass_unit)
self.mass_unit = self.quan(mass_unit[0], mass_unit[1])
- self.time_unit = self.length_unit / self.velocity_unit
+ if self.cosmological_simulation:
+ # self.velocity_unit is the unit to rescale on-disk velocities, The
+ # actual internal velocity unit is really in comoving comoving units
+ # since the time unit is derived from the internal velocity unit, we
+ # infer the internal velocity unit here and name it vel_unit
+ #
+ # see http://www.mpa-garching.mpg.de/gadget/gadget-list/0113.html
+ if 'velocity' in unit_base:
+ vel_unit = unit_base['velocity']
+ elif "UnitVelocity_in_cm_per_s" in unit_base:
+ vel_unit = (unit_base['UnitVelocity_in_cm_per_s'], 'cmcm/s')
+ else:
+ vel_unit = (1, 'kmcm/s')
+ vel_unit = self.quan(*vel_unit)
+ else:
+ vel_unit = self.velocity_unit
+ self.time_unit = self.length_unit / vel_unit
@staticmethod
def _validate_header(filename):
https://bitbucket.org/yt_analysis/yt/commits/71472f502d72/
Changeset: 71472f502d72
Branch: yt
User: ngoldbaum
Date: 2015-08-19 19:34:08+00:00
Summary: Bring the scaling of the gadget mass unit out of the unit symbol
Affected #: 1 file
diff -r 4db654627383a15db60df8d7e8ea4de8034fc011 -r 71472f502d72d6a95b28e13602e1710468e821d0 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -247,7 +247,7 @@
mass_unit = (unit_base["UnitMass_in_g"], "g/h")
else:
# Sane default
- mass_unit = (1.0, "1e10*Msun/h")
+ mass_unit = (1e10, "Msun/h")
mass_unit = _fix_unit_ordering(mass_unit)
self.mass_unit = self.quan(mass_unit[0], mass_unit[1])
if self.cosmological_simulation:
https://bitbucket.org/yt_analysis/yt/commits/b383222eee91/
Changeset: b383222eee91
Branch: yt
User: ngoldbaum
Date: 2015-08-19 19:34:31+00:00
Summary: Reformat the gadget unit attributes before exiting the dataset initializer
Affected #: 1 file
diff -r 71472f502d72d6a95b28e13602e1710468e821d0 -r b383222eee915337edc06754881149bcc13abebc yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -108,6 +108,14 @@
raise RuntimeError("units_override is not supported for GadgetDataset. "+
"Use unit_base instead.")
super(GadgetDataset, self).__init__(filename, dataset_type)
+ if self.cosmological_simulation:
+ self.time_unit.convert_to_units('s/h')
+ self.length_unit.convert_to_units('kpccm/h')
+ self.mass_unit.convert_to_units('g/h')
+ else:
+ self.time_unit.convert_to_units('s')
+ self.length_unit.convert_to_units('kpc')
+ self.mass_unit.convert_to_units('Msun')
def _setup_binary_spec(self, spec, spec_dict):
if isinstance(spec, str):
https://bitbucket.org/yt_analysis/yt/commits/8097072897b9/
Changeset: 8097072897b9
Branch: yt
User: ngoldbaum
Date: 2015-08-19 21:01:11+00:00
Summary: Correct typo
Affected #: 1 file
diff -r b383222eee915337edc06754881149bcc13abebc -r 8097072897b90c25fcef44358ca06b90ab9c8d31 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -260,7 +260,7 @@
self.mass_unit = self.quan(mass_unit[0], mass_unit[1])
if self.cosmological_simulation:
# self.velocity_unit is the unit to rescale on-disk velocities, The
- # actual internal velocity unit is really in comoving comoving units
+ # actual internal velocity unit is really in comoving units
# since the time unit is derived from the internal velocity unit, we
# infer the internal velocity unit here and name it vel_unit
#
https://bitbucket.org/yt_analysis/yt/commits/14a4cacf4dfa/
Changeset: 14a4cacf4dfa
Branch: yt
User: chummels
Date: 2015-08-27 16:30:51+00:00
Summary: Merged in ngoldbaum/yt (pull request #1710)
Gadget cosmology simulation unit fixes
Affected #: 2 files
diff -r 5e5edba3739c1b8c9f8ee2d32e87304bc64557bf -r 14a4cacf4dfaa1b0af3830e7d2efa1ab69db1b35 yt/data_objects/static_output.py
--- a/yt/data_objects/static_output.py
+++ b/yt/data_objects/static_output.py
@@ -683,6 +683,7 @@
self.unit_registry.add("code_velocity", 1.0, dimensions.velocity)
self.unit_registry.add("code_metallicity", 1.0,
dimensions.dimensionless)
+ self.unit_registry.add("a", 1.0, dimensions.dimensionless)
def set_units(self):
"""
@@ -700,6 +701,7 @@
self.unit_registry.add(new_unit, self.unit_registry.lut[my_unit][0] /
(1 + self.current_redshift),
length, "\\rm{%s}/(1+z)" % my_unit)
+ self.unit_registry.modify('a', 1/(1+self.current_redshift))
self.set_code_units()
diff -r 5e5edba3739c1b8c9f8ee2d32e87304bc64557bf -r 14a4cacf4dfaa1b0af3830e7d2efa1ab69db1b35 yt/frontends/gadget/data_structures.py
--- a/yt/frontends/gadget/data_structures.py
+++ b/yt/frontends/gadget/data_structures.py
@@ -108,6 +108,14 @@
raise RuntimeError("units_override is not supported for GadgetDataset. "+
"Use unit_base instead.")
super(GadgetDataset, self).__init__(filename, dataset_type)
+ if self.cosmological_simulation:
+ self.time_unit.convert_to_units('s/h')
+ self.length_unit.convert_to_units('kpccm/h')
+ self.mass_unit.convert_to_units('g/h')
+ else:
+ self.time_unit.convert_to_units('s')
+ self.length_unit.convert_to_units('kpc')
+ self.mass_unit.convert_to_units('Msun')
def _setup_binary_spec(self, spec, spec_dict):
if isinstance(spec, str):
@@ -218,12 +226,21 @@
self.length_unit = self.quan(length_unit[0], length_unit[1])
unit_base = self._unit_base or {}
+
+ if self.cosmological_simulation:
+ # see http://www.mpa-garching.mpg.de/gadget/gadget-list/0113.html
+ # for why we need to include a factor of square root of the
+ # scale factor
+ vel_units = "cm/s * sqrt(a)"
+ else:
+ vel_units = "cm/s"
+
if "velocity" in unit_base:
velocity_unit = unit_base["velocity"]
elif "UnitVelocity_in_cm_per_s" in unit_base:
- velocity_unit = (unit_base["UnitVelocity_in_cm_per_s"], "cm/s")
+ velocity_unit = (unit_base["UnitVelocity_in_cm_per_s"], vel_units)
else:
- velocity_unit = (1e5, "cm/s")
+ velocity_unit = (1e5, vel_units)
velocity_unit = _fix_unit_ordering(velocity_unit)
self.velocity_unit = self.quan(velocity_unit[0], velocity_unit[1])
@@ -238,10 +255,26 @@
mass_unit = (unit_base["UnitMass_in_g"], "g/h")
else:
# Sane default
- mass_unit = (1.0, "1e10*Msun/h")
+ mass_unit = (1e10, "Msun/h")
mass_unit = _fix_unit_ordering(mass_unit)
self.mass_unit = self.quan(mass_unit[0], mass_unit[1])
- self.time_unit = self.length_unit / self.velocity_unit
+ if self.cosmological_simulation:
+ # self.velocity_unit is the unit to rescale on-disk velocities, The
+ # actual internal velocity unit is really in comoving units
+ # since the time unit is derived from the internal velocity unit, we
+ # infer the internal velocity unit here and name it vel_unit
+ #
+ # see http://www.mpa-garching.mpg.de/gadget/gadget-list/0113.html
+ if 'velocity' in unit_base:
+ vel_unit = unit_base['velocity']
+ elif "UnitVelocity_in_cm_per_s" in unit_base:
+ vel_unit = (unit_base['UnitVelocity_in_cm_per_s'], 'cmcm/s')
+ else:
+ vel_unit = (1, 'kmcm/s')
+ vel_unit = self.quan(*vel_unit)
+ else:
+ vel_unit = self.velocity_unit
+ self.time_unit = self.length_unit / vel_unit
@staticmethod
def _validate_header(filename):
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