[Yt-svn] yt: Added catch for EmptyProfileData exception to halo profiler.

hg at spacepope.org hg at spacepope.org
Tue Oct 5 11:52:34 PDT 2010


hg Repository: yt
details:   yt/rev/813178613ebd
changeset: 3431:813178613ebd
user:      Britton Smith <brittonsmith at gmail.com>
date:
Tue Oct 05 14:52:24 2010 -0400
description:
Added catch for EmptyProfileData exception to halo profiler.

diffstat:

 yt/analysis_modules/halo_profiler/multi_halo_profiler.py |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r cd107625dbb6 -r 813178613ebd yt/analysis_modules/halo_profiler/multi_halo_profiler.py
--- a/yt/analysis_modules/halo_profiler/multi_halo_profiler.py	Tue Oct 05 12:10:47 2010 -0400
+++ b/yt/analysis_modules/halo_profiler/multi_halo_profiler.py	Tue Oct 05 14:52:24 2010 -0400
@@ -33,7 +33,7 @@
 from yt.convenience import \
     load
 from yt.data_objects.profiles import \
-    BinnedProfile1D
+    BinnedProfile1D, EmptyProfileData
 from yt.analysis_modules.halo_finding.api import \
     HaloFinder
 from .halo_filters import \
@@ -392,9 +392,13 @@
                                                                  max_grid['y-velocity'][max_cell],
                                                                  max_grid['z-velocity'][max_cell]])
 
-            profile = BinnedProfile1D(sphere, self.n_profile_bins, "RadiusMpc",
-                                            r_min, halo['r_max'],
-                                            log_space=True, lazy_reader=False)
+            try:
+                profile = BinnedProfile1D(sphere, self.n_profile_bins, "RadiusMpc",
+                                                r_min, halo['r_max'],
+                                                log_space=True, lazy_reader=False)
+            except EmptyProfileData:
+                mylog.error("Caught EmptyProfileData exception, returning None for this halo.")
+                return None
             for hp in self.profile_fields:
                 profile.add_fields(hp['field'], weight=hp['weight_field'], accumulation=hp['accumulation'])
 



More information about the yt-svn mailing list