[Yt-svn] yt-commit r1477 - trunk/yt/extensions
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Tue Oct 6 14:53:24 PDT 2009
Author: britton
Date: Tue Oct 6 14:53:21 2009
New Revision: 1477
URL: http://yt.enzotools.org/changeset/1477
Log:
Created fake profile object to be associated with profile data read in from
disk. This allows the dataset pf to be attached to the profile for use with
the halo filters.
Modified:
trunk/yt/extensions/HaloProfiler.py
Modified: trunk/yt/extensions/HaloProfiler.py
==============================================================================
--- trunk/yt/extensions/HaloProfiler.py (original)
+++ trunk/yt/extensions/HaloProfiler.py Tue Oct 6 14:53:21 2009
@@ -568,6 +568,7 @@
fields.pop(0)
profile = {}
+ profile_obj = FakeProfile(self.pf)
for field in fields:
profile[field] = []
@@ -593,8 +594,10 @@
for field in fields:
profile[field] = na.array(profile[field])
+ profile_obj._data = profile
+
if len(profile[fields[0]]) > 1:
- return profile
+ return profile_obj
else:
return None
@@ -756,3 +759,17 @@
del add_x_pdy, add_y_pdy, add2_x_pdy, add2_y_pdy
del add_x_field, add_y_field, add2_x_field, add2_y_field
del add_x_weight_field, add_y_weight_field, add2_x_weight_field, add2_y_weight_field
+
+class FakeProfile(lagos.ParallelAnalysisInterface):
+ """
+ This is used to mimic a profile object when reading profile data from disk.
+ """
+ def __init__(self, pf):
+ self.pf = pf
+ self._data = {}
+
+ def __getitem__(self, key):
+ return self._data[key]
+
+ def keys(self):
+ return self._data.keys()
More information about the yt-svn
mailing list