[Yt-svn] yt-commit r1138 - in trunk/yt: lagos raven
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Fri Jan 23 09:38:13 PST 2009
Author: mturk
Date: Fri Jan 23 09:38:12 2009
New Revision: 1138
URL: http://yt.spacepope.org/changeset/1138
Log:
Fixes for ParameterFileStorage in parallel; now it should work -- all the
processes are allowed to read, but only root can create/write.
Experimenting with things in the load_object method in the hierarchy; it now
also allows a "_fix_pickle" method as some in-between of the full __reduce__
protocol and nothing at all. Added a _fix_pickle method to Profiles.
The _reconstruct_pf method now actually returns a parameterfile.
Added AngularMomentum[XYZ] fields to UniversalFields.
Sphere Callback now by-default has unfilled circles. Also, looks like the x,y
were transposed incorrectly in that.
Pretty sure this closes #188.
Modified:
trunk/yt/lagos/HierarchyType.py
trunk/yt/lagos/OutputTypes.py
trunk/yt/lagos/ParallelTools.py
trunk/yt/lagos/Profiles.py
trunk/yt/lagos/UniversalFields.py
trunk/yt/raven/Callbacks.py
Modified: trunk/yt/lagos/HierarchyType.py
==============================================================================
--- trunk/yt/lagos/HierarchyType.py (original)
+++ trunk/yt/lagos/HierarchyType.py Fri Jan 23 09:38:12 2009
@@ -178,7 +178,8 @@
return
obj = cPickle.loads(obj.read())
if iterable(obj) and len(obj) == 2:
- return obj[1] # Just the object, not the pf
+ obj = obj[1] # Just the object, not the pf
+ if hasattr(obj, '_fix_pickle'): obj._fix_pickle()
return obj
def get_data(self, node, name):
Modified: trunk/yt/lagos/OutputTypes.py
==============================================================================
--- trunk/yt/lagos/OutputTypes.py (original)
+++ trunk/yt/lagos/OutputTypes.py Fri Jan 23 09:38:12 2009
@@ -495,3 +495,4 @@
def _reconstruct_pf(*args, **kwargs):
pfs = ParameterFileStore()
pf = pfs.get_pf_hash(*args)
+ return pf
Modified: trunk/yt/lagos/ParallelTools.py
==============================================================================
--- trunk/yt/lagos/ParallelTools.py (original)
+++ trunk/yt/lagos/ParallelTools.py Fri Jan 23 09:38:12 2009
@@ -38,7 +38,8 @@
ytcfg["yt","__parallel_rank"] = str(MPI.COMM_WORLD.rank)
ytcfg["yt","__parallel_size"] = str(MPI.COMM_WORLD.size)
ytcfg["yt","__parallel"] = "True"
- ytcfg["yt","StoreParameterFiles"] = "False"
+ # I believe we do not need to turn this off manually
+ #ytcfg["yt","StoreParameterFiles"] = "False"
# Now let's make sure we have the right options set.
if MPI.COMM_WORLD.rank > 0:
if ytcfg.getboolean("lagos","serialize"):
Modified: trunk/yt/lagos/Profiles.py
==============================================================================
--- trunk/yt/lagos/Profiles.py (original)
+++ trunk/yt/lagos/Profiles.py Fri Jan 23 09:38:12 2009
@@ -158,6 +158,10 @@
data.append(source[field][pointI].ravel().astype('float64'))
return na.concatenate(data, axis=0)
+ def _fix_pickle(self):
+ if isinstance(self._data_source, tuple):
+ self._data_source = self._data_source[1]
+
# @todo: Fix accumulation with overriding
class BinnedProfile1D(BinnedProfile):
def __init__(self, data_source, n_bins, bin_field,
Modified: trunk/yt/lagos/UniversalFields.py
==============================================================================
--- trunk/yt/lagos/UniversalFields.py (original)
+++ trunk/yt/lagos/UniversalFields.py Fri Jan 23 09:38:12 2009
@@ -496,6 +496,19 @@
add_field("AngularMomentumMSUNKMSMPC", function=_AngularMomentum,
units=r"M_{\odot}\rm{km}\rm{Mpc}/\rm{s}", vector_field=True)
+def _AngularMomentumX(field, data):
+ return data["CellMass"] * data["SpecificAngularMomentumX"]
+add_field("AngularMomentumX", function=_AngularMomentumX,
+ units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=True)
+def _AngularMomentumY(field, data):
+ return data["CellMass"] * data["SpecificAngularMomentumY"]
+add_field("AngularMomentumY", function=_AngularMomentumY,
+ units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=True)
+def _AngularMomentumZ(field, data):
+ return data["CellMass"] * data["SpecificAngularMomentumZ"]
+add_field("AngularMomentumZ", function=_AngularMomentumZ,
+ units=r"\rm{g}\/\rm{cm}^2/\rm{s}", vector_field=True)
+
def _ParticleSpecificAngularMomentum(field, data):
"""
Calculate the angular of a particle velocity. Returns a vector for each
Modified: trunk/yt/raven/Callbacks.py
==============================================================================
--- trunk/yt/raven/Callbacks.py (original)
+++ trunk/yt/raven/Callbacks.py Fri Jan 23 09:38:12 2009
@@ -507,6 +507,8 @@
text = None, text_args = None):
self.center = center
self.radius = radius
+ if circle_args is None: circle_args = {}
+ if 'fill' not in circle_args: circle_args['fill'] = False
self.circle_args = circle_args
self.text = text
self.text_args = text_args
@@ -524,15 +526,12 @@
center_x = (self.center[xi] - x0)*dx
center_y = (self.center[yi] - y0)*dy
# origin = lower? not sure why center_y and center_x are reversed
- cir = Circle((center_y, center_x), radius, fill=False,
- **self.circle_args)
+ cir = Circle((center_x, center_y), radius, **self.circle_args)
plot._axes.add_patch(cir)
if self.text is not None:
plot._axes.text(center_x, center_y, "%s" % halo.id,
**self.text_args)
-
-
class HopCircleCallback(PlotCallback):
def __init__(self, hop_output, axis, max_number=None,
annotate=False, min_size=20, font_size=8, print_halo_size=False,
More information about the yt-svn
mailing list