[Yt-svn] yt-commit r500 - trunk/yt/lagos

mturk at wrangler.dreamhost.com mturk at wrangler.dreamhost.com
Wed May 28 16:27:38 PDT 2008


Author: mturk
Date: Wed May 28 16:27:38 2008
New Revision: 500
URL: http://yt.spacepope.org/changeset/500

Log:
Added AngularMomentumVector to the quantities.



Modified:
   trunk/yt/lagos/DerivedQuantities.py

Modified: trunk/yt/lagos/DerivedQuantities.py
==============================================================================
--- trunk/yt/lagos/DerivedQuantities.py	(original)
+++ trunk/yt/lagos/DerivedQuantities.py	Wed May 28 16:27:38 2008
@@ -134,6 +134,18 @@
 add_quantity("BulkVelocity", function=_BulkVelocity,
              combine_function=_combBulkVelocity, n_ret=4)
 
+def _AngularMomentumVector(data):
+    am = data["SpecificAngularMomentum"]*data["CellMassMsun"]
+    j_mag = am.sum(axis=1)
+    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)
+    L_vec_norm = L_vec / na.sqrt((L_vec**2.0).sum())
+    return L_vec_norm
+add_quantity("AngularMomentumVector", function=_AngularMomentumVector,
+             combine_function=_combAngularMomentumVector, n_ret=1)
+
 def _BaryonSpinParameter(data):
     am = data["SpecificAngularMomentum"]*data["CellMassMsun"]
     j_mag = am.sum(axis=1)



More information about the yt-svn mailing list