[Yt-svn] yt-commit r1014 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Tue Dec 16 10:08:26 PST 2008
Author: mturk
Date: Tue Dec 16 10:08:26 2008
New Revision: 1014
URL: http://yt.spacepope.org/changeset/1014
Log:
Added a few things to the Clump setup. There's now a "ClumpStorage" object,
mostly undocumented, but that is pickle-able. You can then use this to create
ExtractedRegions directly from pickled objects. ExtractedRegions now have a
force_refresh option, which can keep you from re-freshing if you create, set
the _grids and _indices attributes, which you can do with an unpickled
ClumpStorage.
This ... would be a good set of methods to put into a subclass of Pickler and
Unpickler. (See #169 and my roadmap email for more info)
Modified:
trunk/yt/lagos/BaseDataTypes.py
trunk/yt/lagos/Clump.py
Modified: trunk/yt/lagos/BaseDataTypes.py
==============================================================================
--- trunk/yt/lagos/BaseDataTypes.py (original)
+++ trunk/yt/lagos/BaseDataTypes.py Tue Dec 16 10:08:26 2008
@@ -1234,7 +1234,7 @@
else:
pointI = self._get_point_indices(grid)
if grid[field].size == 1: # dx, dy, dz, cellvolume
- t = grid[field] * na.ones(grid.ActiveDimensions)
+ t = grid[field] * na.ones(grid.ActiveDimensions, dtype='float64')
return t[pointI].ravel()
return grid[field][pointI].ravel()
@@ -1355,7 +1355,7 @@
ExtractedRegions are arbitrarily defined containers of data, useful
for things like selection along a baryon field.
"""
- def __init__(self, base_region, indices, **kwargs):
+ def __init__(self, base_region, indices, force_refresh=True, **kwargs):
cen = base_region.get_field_parameter("center")
AMR3DData.__init__(self, center=cen,
fields=None, pf=base_region.pf, **kwargs)
@@ -1363,7 +1363,7 @@
# It is not cyclic
self._base_indices = indices
self._grids = None
- self._refresh_data()
+ if force_refresh: self._refresh_data()
def _get_cut_particle_mask(self, grid):
# Override to provide a warning
@@ -1720,8 +1720,8 @@
else:
fields_to_get = ensure_list(field)
for field in fields_to_get:
- mylog.debug("Flushing field %s to %s possible grids",
- field, len(self._grids))
+ #mylog.debug("Flushing field %s to %s possible grids",
+ #field, len(self._grids))
for grid in self._grids:
self._flush_data_to_grid(grid, field)
Modified: trunk/yt/lagos/Clump.py
==============================================================================
--- trunk/yt/lagos/Clump.py (original)
+++ trunk/yt/lagos/Clump.py Tue Dec 16 10:08:26 2008
@@ -124,3 +124,15 @@
fmt_dict['min_density'] = clump.data["NumberDensity"].min()
fmt_dict['max_density'] = clump.data["NumberDensity"].max()
f_ptr.write(__clump_info_template % fmt_dict)
+
+class ClumpStorage(object):
+ def __init__(self, clump):
+ # This is to see if it's extracted
+ # We don't care about the base region,
+ # so we skip that.
+ if hasattr(clump.data, '_indices'):
+ self.indices = clump.data._indices
+ self.grids = [g.id-1 for g in clump.data._grids]
+ self.children = []
+ if clump.children is not None:
+ self.children = [ClumpStorage(child) for child in clump.children]
More information about the yt-svn
mailing list