[yt-svn] commit/yt-3.0: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Jun 3 12:52:39 PDT 2013
5 new commits in yt-3.0:
https://bitbucket.org/yt_analysis/yt-3.0/commits/bcd7cd3dd612/
Changeset: bcd7cd3dd612
Branch: yt-3.0
User: MatthewTurk
Date: 2013-06-03 19:41:47
Summary: Missed a masking operator here, as otherwise we would always read the whole field.
Affected #: 1 file
diff -r ada7c2c608f1bb724bfa274539a0321b76df503c -r bcd7cd3dd612baf132c4598fada9ce87953a28e4 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -341,7 +341,7 @@
else:
rv[field] = np.empty(size, dtype="float64")
if size == 0: continue
- rv[field][:] = vals[field]
+ rv[field][:] = vals[field][mask]
return rv
def _read_particle_selection(self, chunks, selector, fields):
https://bitbucket.org/yt_analysis/yt-3.0/commits/72b584eb3706/
Changeset: 72b584eb3706
Branch: yt-3.0
User: MatthewTurk
Date: 2013-06-03 20:29:51
Summary: Adding particle deposition fields, comoving & h units, to RAMSES.
Affected #: 2 files
diff -r bcd7cd3dd612baf132c4598fada9ce87953a28e4 -r 72b584eb3706c3fe8c7e5c59e6c801140db55cd7 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -418,6 +418,9 @@
unit_l = self.parameters['unit_l']
for unit in mpc_conversion.keys():
self.units[unit] = unit_l * mpc_conversion[unit] / mpc_conversion["cm"]
+ self.units['%sh' % unit] = self.units[unit] * self.hubble_constant
+ self.units['%shcm' % unit] = (self.units['%sh' % unit] /
+ (1 + self.current_redshift))
for unit in sec_conversion.keys():
self.time_units[unit] = self.parameters['unit_t'] / sec_conversion[unit]
diff -r bcd7cd3dd612baf132c4598fada9ce87953a28e4 -r 72b584eb3706c3fe8c7e5c59e6c801140db55cd7 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -36,7 +36,9 @@
import yt.data_objects.universal_fields
from yt.utilities.physical_constants import \
boltzmann_constant_cgs, \
- mass_hydrogen_cgs
+ mass_hydrogen_cgs, \
+ mass_sun_cgs
+import numpy as np
RAMSESFieldInfo = FieldInfoContainer.create_with_fallback(FieldInfo, "RFI")
add_field = RAMSESFieldInfo.add_field
@@ -121,7 +123,7 @@
KnownRAMSESFields["particle_mass"]._units = r"\mathrm{g}"
def _convertParticleMassMsun(data):
- return 1.0/1.989e33
+ return 1.0/mass_sun_cgs
add_field("ParticleMass", function=TranslationFunc("particle_mass"),
particle_type=True)
add_field("ParticleMassMsun",
@@ -133,3 +135,46 @@
rv *= mass_hydrogen_cgs/boltzmann_constant_cgs
return rv
add_field("Temperature", function=_Temperature, units=r"\rm{K}")
+
+
+# We now set up a couple particle fields. This should eventually be abstracted
+# into a single particle field function that adds them all on and is used
+# across frontends, but that will need to wait until moving to using
+# Coordinates, or vector fields.
+
+def particle_count(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, method = "count")
+ return d
+RAMSESFieldInfo.add_field(("deposit", "%s_count" % "all"),
+ function = particle_count,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Count}" % "all",
+ projection_conversion = '1')
+
+def particle_mass(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ return d
+
+RAMSESFieldInfo.add_field(("deposit", "%s_mass" % "all"),
+ function = particle_mass,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Mass}" % "all",
+ units = r"\mathrm{g}",
+ projected_units = r"\mathrm{g}\/\mathrm{cm}",
+ projection_conversion = 'cm')
+
+def particle_density(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ d /= data["CellVolume"]
+ return d
+
+RAMSESFieldInfo.add_field(("deposit", "%s_density" % "all"),
+ function = particle_density,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Density}" % "all",
+ units = r"\mathrm{g}/\mathrm{cm}^{3}",
+ projected_units = r"\mathrm{g}/\mathrm{cm}^{-2}",
+ projection_conversion = 'cm')
https://bitbucket.org/yt_analysis/yt-3.0/commits/e527800d99b2/
Changeset: e527800d99b2
Branch: yt-3.0
User: MatthewTurk
Date: 2013-06-03 21:02:13
Summary: This corrects a pernicious bug that crept in to the RAMSES oct filling.
Note that this is actually not precisely that same as before, because we now
iterate in Fortran order, whereas implicitly before we iterated in C order.
While we could in principle write a single "for ii" loop, we do not do that
here so that we can remain clear about the order of filling, and because we
would need to have a reverse-ordering test anyway.
Affected #: 1 file
diff -r 72b584eb3706c3fe8c7e5c59e6c801140db55cd7 -r e527800d99b2fa73e2f73a97b6939c6126e21f00 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -705,13 +705,15 @@
source = source_fields[key]
for n in range(dom.n):
o = &dom.my_octs[n]
- for ii in range(8):
- # We iterate and check here to keep our counts consistent
- # when filling different levels.
- if mask[o.domain_ind, ii] == 0: continue
- if o.level == level:
- dest[local_filled] = source[o.file_ind, ii]
- local_filled += 1
+ for i in range(2):
+ for j in range(2):
+ for k in range(2):
+ ii = ((k*2)+j)*2+i
+ if mask[o.domain_ind, ii] == 0: continue
+ if o.level == level:
+ dest[local_filled] = \
+ source[o.file_ind, ii]
+ local_filled += 1
return local_filled
cdef class ARTOctreeContainer(RAMSESOctreeContainer):
https://bitbucket.org/yt_analysis/yt-3.0/commits/2de0b1d9c4dd/
Changeset: 2de0b1d9c4dd
Branch: yt-3.0
User: MatthewTurk
Date: 2013-06-03 21:24:56
Summary: Adding Enzo particle deposition fields.
Affected #: 1 file
diff -r e527800d99b2fa73e2f73a97b6939c6126e21f00 -r 2de0b1d9c4dd42949d103bf4b350f293d6fe749d yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -653,3 +653,39 @@
function=TranslationFunc(("CenOstriker","position_%s" % ax)),
particle_type = True)
+def particle_count(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, method = "count")
+ return d
+EnzoFieldInfo.add_field(("deposit", "%s_count" % "all"),
+ function = particle_count,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Count}" % "all",
+ projection_conversion = '1')
+
+def particle_mass(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ return d
+
+EnzoFieldInfo.add_field(("deposit", "%s_mass" % "all"),
+ function = particle_mass,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Mass}" % "all",
+ units = r"\mathrm{g}",
+ projected_units = r"\mathrm{g}\/\mathrm{cm}",
+ projection_conversion = 'cm')
+
+def particle_density(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ d /= data["CellVolume"]
+ return d
+
+EnzoFieldInfo.add_field(("deposit", "%s_density" % "all"),
+ function = particle_density,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Density}" % "all",
+ units = r"\mathrm{g}/\mathrm{cm}^{3}",
+ projected_units = r"\mathrm{g}/\mathrm{cm}^{-2}",
+ projection_conversion = 'cm')
https://bitbucket.org/yt_analysis/yt-3.0/commits/d540495296df/
Changeset: d540495296df
Branch: yt-3.0
User: ngoldbaum
Date: 2013-06-03 21:52:29
Summary: Merged in MatthewTurk/yt-3.0 (pull request #40)
Fields and RAMSES fix
Affected #: 5 files
diff -r 49f1241d1fd80b4294a520be53e790d1db72fe54 -r d540495296df584372b5c2ab42e90b43c6bdf058 yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -653,3 +653,39 @@
function=TranslationFunc(("CenOstriker","position_%s" % ax)),
particle_type = True)
+def particle_count(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, method = "count")
+ return d
+EnzoFieldInfo.add_field(("deposit", "%s_count" % "all"),
+ function = particle_count,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Count}" % "all",
+ projection_conversion = '1')
+
+def particle_mass(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ return d
+
+EnzoFieldInfo.add_field(("deposit", "%s_mass" % "all"),
+ function = particle_mass,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Mass}" % "all",
+ units = r"\mathrm{g}",
+ projected_units = r"\mathrm{g}\/\mathrm{cm}",
+ projection_conversion = 'cm')
+
+def particle_density(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ d /= data["CellVolume"]
+ return d
+
+EnzoFieldInfo.add_field(("deposit", "%s_density" % "all"),
+ function = particle_density,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Density}" % "all",
+ units = r"\mathrm{g}/\mathrm{cm}^{3}",
+ projected_units = r"\mathrm{g}/\mathrm{cm}^{-2}",
+ projection_conversion = 'cm')
diff -r 49f1241d1fd80b4294a520be53e790d1db72fe54 -r d540495296df584372b5c2ab42e90b43c6bdf058 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -418,6 +418,9 @@
unit_l = self.parameters['unit_l']
for unit in mpc_conversion.keys():
self.units[unit] = unit_l * mpc_conversion[unit] / mpc_conversion["cm"]
+ self.units['%sh' % unit] = self.units[unit] * self.hubble_constant
+ self.units['%shcm' % unit] = (self.units['%sh' % unit] /
+ (1 + self.current_redshift))
for unit in sec_conversion.keys():
self.time_units[unit] = self.parameters['unit_t'] / sec_conversion[unit]
diff -r 49f1241d1fd80b4294a520be53e790d1db72fe54 -r d540495296df584372b5c2ab42e90b43c6bdf058 yt/frontends/ramses/fields.py
--- a/yt/frontends/ramses/fields.py
+++ b/yt/frontends/ramses/fields.py
@@ -36,7 +36,9 @@
import yt.data_objects.universal_fields
from yt.utilities.physical_constants import \
boltzmann_constant_cgs, \
- mass_hydrogen_cgs
+ mass_hydrogen_cgs, \
+ mass_sun_cgs
+import numpy as np
RAMSESFieldInfo = FieldInfoContainer.create_with_fallback(FieldInfo, "RFI")
add_field = RAMSESFieldInfo.add_field
@@ -121,7 +123,7 @@
KnownRAMSESFields["particle_mass"]._units = r"\mathrm{g}"
def _convertParticleMassMsun(data):
- return 1.0/1.989e33
+ return 1.0/mass_sun_cgs
add_field("ParticleMass", function=TranslationFunc("particle_mass"),
particle_type=True)
add_field("ParticleMassMsun",
@@ -133,3 +135,46 @@
rv *= mass_hydrogen_cgs/boltzmann_constant_cgs
return rv
add_field("Temperature", function=_Temperature, units=r"\rm{K}")
+
+
+# We now set up a couple particle fields. This should eventually be abstracted
+# into a single particle field function that adds them all on and is used
+# across frontends, but that will need to wait until moving to using
+# Coordinates, or vector fields.
+
+def particle_count(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, method = "count")
+ return d
+RAMSESFieldInfo.add_field(("deposit", "%s_count" % "all"),
+ function = particle_count,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Count}" % "all",
+ projection_conversion = '1')
+
+def particle_mass(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ return d
+
+RAMSESFieldInfo.add_field(("deposit", "%s_mass" % "all"),
+ function = particle_mass,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Mass}" % "all",
+ units = r"\mathrm{g}",
+ projected_units = r"\mathrm{g}\/\mathrm{cm}",
+ projection_conversion = 'cm')
+
+def particle_density(field, data):
+ pos = np.column_stack([data["particle_position_%s" % ax] for ax in 'xyz'])
+ d = data.deposit(pos, [data["ParticleMass"]], method = "sum")
+ d /= data["CellVolume"]
+ return d
+
+RAMSESFieldInfo.add_field(("deposit", "%s_density" % "all"),
+ function = particle_density,
+ validators = [ValidateSpatial()],
+ display_name = "\\mathrm{%s Density}" % "all",
+ units = r"\mathrm{g}/\mathrm{cm}^{3}",
+ projected_units = r"\mathrm{g}/\mathrm{cm}^{-2}",
+ projection_conversion = 'cm')
diff -r 49f1241d1fd80b4294a520be53e790d1db72fe54 -r d540495296df584372b5c2ab42e90b43c6bdf058 yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -341,7 +341,7 @@
else:
rv[field] = np.empty(size, dtype="float64")
if size == 0: continue
- rv[field][:] = vals[field]
+ rv[field][:] = vals[field][mask]
return rv
def _read_particle_selection(self, chunks, selector, fields):
diff -r 49f1241d1fd80b4294a520be53e790d1db72fe54 -r d540495296df584372b5c2ab42e90b43c6bdf058 yt/geometry/oct_container.pyx
--- a/yt/geometry/oct_container.pyx
+++ b/yt/geometry/oct_container.pyx
@@ -705,13 +705,15 @@
source = source_fields[key]
for n in range(dom.n):
o = &dom.my_octs[n]
- for ii in range(8):
- # We iterate and check here to keep our counts consistent
- # when filling different levels.
- if mask[o.domain_ind, ii] == 0: continue
- if o.level == level:
- dest[local_filled] = source[o.file_ind, ii]
- local_filled += 1
+ for i in range(2):
+ for j in range(2):
+ for k in range(2):
+ ii = ((k*2)+j)*2+i
+ if mask[o.domain_ind, ii] == 0: continue
+ if o.level == level:
+ dest[local_filled] = \
+ source[o.file_ind, ii]
+ local_filled += 1
return local_filled
cdef class ARTOctreeContainer(RAMSESOctreeContainer):
Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/
--
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