[Yt-svn] yt-commit r1148 - trunk/yt/extensions

britton at wrangler.dreamhost.com britton at wrangler.dreamhost.com
Sun Jan 25 15:50:03 PST 2009


Author: britton
Date: Sun Jan 25 15:50:02 2009
New Revision: 1148
URL: http://yt.spacepope.org/changeset/1148

Log:
Calculation of virial quantities should jump out and return zeros if the 
profile has less than two bins.


Modified:
   trunk/yt/extensions/HaloProfiler.py

Modified: trunk/yt/extensions/HaloProfiler.py
==============================================================================
--- trunk/yt/extensions/HaloProfiler.py	(original)
+++ trunk/yt/extensions/HaloProfiler.py	Sun Jan 25 15:50:02 2009
@@ -259,6 +259,12 @@
         for field in fields:
             temp_profile[field] = []
 
+        virial = {}
+        if (len(profile[overdensity_field]) < 2):
+            for field in fields:
+                virial[field] = 0.0
+            return virial
+
         for q in range(len(profile[overdensity_field])):
             good = True
             if (profile[overdensity_field][q] != profile[overdensity_field][q]):
@@ -283,7 +289,6 @@
                     index = q - 1
                     break
 
-        virial = {}
         for field in fields:
             slope = (temp_profile[field][index+1] - temp_profile[field][index]) / \
                 (overDensity[index+1] - overDensity[index])



More information about the yt-svn mailing list