[Yt-svn] yt-commit r639 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Mon Jun 30 17:23:28 PDT 2008
Author: mturk
Date: Mon Jun 30 17:23:28 2008
New Revision: 639
URL: http://yt.spacepope.org/changeset/639
Log:
Facilities for doing 'hybrid profiles' -- of particle and cell data -- have
been added. As of right now it is quite limited, only being able to add the
mass-enclosed field.
I only see this being extended to angular momentum after this.
You can -- and have been able to since the last commit -- still do
particle-type binning and particle-type field-adding. So, for instance, bin
particles based on ParticleRadiusCode and then displaying the binned field
'creation_time' or something.
Modified:
trunk/yt/lagos/Profiles.py
Modified: trunk/yt/lagos/Profiles.py
==============================================================================
--- trunk/yt/lagos/Profiles.py (original)
+++ trunk/yt/lagos/Profiles.py Mon Jun 30 17:23:28 2008
@@ -25,6 +25,11 @@
from yt.lagos import *
+_field_mapping = {
+ "total_mass": ("CellMassMsun", "ParticleMassMsun"),
+ "hybrid_radius": ("RadiusCode", "ParticleRadiusCode"),
+ }
+
def preserve_source_parameters(func):
def save_state(*args, **kwargs):
# Temporarily replace the 'field_parameters' for a
@@ -113,14 +118,20 @@
self._data[key] = value
def _get_field(self, source, field, check_cut):
- if check_cut:
- if field in fieldInfo and fieldInfo[field].particle_type:
- pointI = self._data_source._get_particle_indices(source)
+ # This is where we will iterate to get all contributions to a field
+ # which is how we will implement hybrid particle/cell fields
+ # but... we default to just the field.
+ data = []
+ for field in _field_mapping.get(field, (field,)):
+ if check_cut:
+ if field in fieldInfo and fieldInfo[field].particle_type:
+ pointI = self._data_source._get_particle_indices(source)
+ else:
+ pointI = self._data_source._get_point_indices(source)
else:
- pointI = self._data_source._get_point_indices(source)
- else:
- pointI = slice(None)
- return source[field][pointI].ravel().astype('float64')
+ pointI = slice(None)
+ data.append(source[field][pointI].ravel().astype('float64'))
+ return na.concatenate(data, axis=0)
# @todo: Fix accumulation with overriding
class BinnedProfile1D(BinnedProfile):
More information about the yt-svn
mailing list