[Yt-svn] commit/yt: 2 new changesets

Bitbucket commits-noreply at bitbucket.org
Fri Jun 10 01:15:36 PDT 2011


2 new changesets in yt:

http://bitbucket.org/yt_analysis/yt/changeset/2448ae93167b/
changeset:   2448ae93167b
branch:      yt
user:        MatthewTurk
date:        2011-06-10 10:13:56
summary:     Adding a fallback for sys.argv, in case it does not exist.
affected #:  1 file (115 bytes)

--- a/yt/funcs.py	Thu Jun 09 10:55:14 2011 -0700
+++ b/yt/funcs.py	Fri Jun 10 01:13:56 2011 -0700
@@ -435,6 +435,10 @@
 # If we recognize one of the arguments on the command line as indicating a
 # different mechanism for handling tracebacks, we attach one of those handlers
 # and remove the argument from sys.argv.
+#
+# This fallback is for Paraview:
+if not hasattr(sys, 'argv') or sys.argv is None: sys.argv = []
+# Now, we check.
 if "--paste" in sys.argv:
     sys.excepthook = paste_traceback
     del sys.argv[sys.argv.index("--paste")]


http://bitbucket.org/yt_analysis/yt/changeset/4000b281e743/
changeset:   4000b281e743
branch:      yt
user:        MatthewTurk
date:        2011-06-10 10:15:28
summary:     Merging
affected #:  1 file (708 bytes)

--- a/yt/data_objects/derived_quantities.py	Fri Jun 10 01:13:56 2011 -0700
+++ b/yt/data_objects/derived_quantities.py	Fri Jun 10 01:15:28 2011 -0700
@@ -224,6 +224,23 @@
     amz = data["SpecificAngularMomentumZ"]*data["CellMassMsun"]
     j_mag = [amx.sum(), amy.sum(), amz.sum()]
     return [j_mag]
+
+def _StarAngularMomentumVector(data):
+    """
+    This function returns the mass-weighted average angular momentum vector 
+    for stars.
+    """
+    is_star = data["creation_time"] > 0
+    star_mass = data["ParticleMassMsun"][is_star]
+    sLx = data["ParticleSpecificAngularMomentumX"][is_star]
+    sLy = data["ParticleSpecificAngularMomentumY"][is_star]
+    sLz = data["ParticleSpecificAngularMomentumZ"][is_star]
+    amx = sLx * star_mass
+    amy = sLy * star_mass
+    amz = sLz * star_mass
+    j_mag = [amx.sum(), amy.sum(), amz.sum()]
+    return [j_mag]
+
 def _combAngularMomentumVector(data, j_mag):
     if len(j_mag.shape) < 2: j_mag = na.expand_dims(j_mag, 0)
     L_vec = j_mag.sum(axis=0)
@@ -232,6 +249,9 @@
 add_quantity("AngularMomentumVector", function=_AngularMomentumVector,
              combine_function=_combAngularMomentumVector, n_ret=1)
 
+add_quantity("StarAngularMomentumVector", function=_StarAngularMomentumVector,
+             combine_function=_combAngularMomentumVector, n_ret=1)
+
 def _BaryonSpinParameter(data):
     """
     This function returns the spin parameter for the baryons, but it uses

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

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