[Yt-svn] yt-commit r462 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Tue May 13 09:10:39 PDT 2008
Author: mturk
Date: Tue May 13 09:10:37 2008
New Revision: 462
URL: http://yt.spacepope.org/changeset/462
Log:
Added 'truncate' kwarg to IsBound, which if true (default) will truncate as
soon as it finds a bound clump, and if false will continue and return
kinetic/potential.
Modified:
trunk/yt/lagos/DerivedQuantities.py
Modified: trunk/yt/lagos/DerivedQuantities.py
==============================================================================
--- trunk/yt/lagos/DerivedQuantities.py (original)
+++ trunk/yt/lagos/DerivedQuantities.py Tue May 13 09:10:37 2008
@@ -155,7 +155,7 @@
add_quantity("BaryonSpinParameter", function=_BaryonSpinParameter,
combine_function=_combBaryonSpinParameter, n_ret=4)
-def _IsBound(data):
+def _IsBound(data, truncate = True):
# Kinetic energy
bv_x,bv_y,bv_z = data.quantities["BulkVelocity"]()
kinetic = 0.5 * (data["CellMass"] * (
@@ -179,10 +179,11 @@
potential += 2 * G * data['CellMass'][q] * pot.sum()
cells_done += (total_cells - q - 1)
pb.update(cells_done)
- if (potential > kinetic):
- break
+ if truncate and (potential > kinetic):
+ pb.finish()
+ return 1.0
pb.finish()
- return (kinetic < potential)
+ return (kinetic / potential)
def _combIsBound(data,bound):
return bound
add_quantity("IsBound",function=_IsBound,combine_function=_combIsBound,n_ret=1,
More information about the yt-svn
mailing list