[yt-svn] commit/yt: brittonsmith: Merged in hegan/yt/yt-3.0 (pull request #845)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Apr 28 11:41:45 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/5affa74d80f3/
Changeset:   5affa74d80f3
Branch:      yt-3.0
User:        brittonsmith
Date:        2014-04-28 20:41:29
Summary:     Merged in hegan/yt/yt-3.0 (pull request #845)

exiting gracefully when no halos are found
Affected #:  2 files

diff -r 3cb702b86a173b0c5165ee771e674bde9e850a82 -r 5affa74d80f34e32c9137bd4ed03821b7ac17570 yt/analysis_modules/halo_analysis/halo_catalog.py
--- a/yt/analysis_modules/halo_analysis/halo_catalog.py
+++ b/yt/analysis_modules/halo_analysis/halo_catalog.py
@@ -351,6 +351,14 @@
         if self.halos_pf is None:
             # Find the halos and make a dataset of them
             self.halos_pf = self.finder_method(self.data_pf)
+            if self.halos_pf is None:
+                mylog.warning('No halos were found for {0}'.format(\
+                        self.data_pf.basename))
+                if save_catalog:
+                    self.halos_pf = self.data_pf
+                    self.save_catalog()
+                    self.halos_pf = None
+                return
 
             # Assign pf and data sources appropriately
             self.data_source = self.halos_pf.all_data()

diff -r 3cb702b86a173b0c5165ee771e674bde9e850a82 -r 5affa74d80f34e32c9137bd4ed03821b7ac17570 yt/analysis_modules/halo_analysis/halo_finding_methods.py
--- a/yt/analysis_modules/halo_analysis/halo_finding_methods.py
+++ b/yt/analysis_modules/halo_analysis/halo_finding_methods.py
@@ -25,6 +25,7 @@
 from .operator_registry import \
     finding_method_registry
 
+
 def add_finding_method(name, function):
     finding_method_registry[name] = HaloFindingMethod(function)
     
@@ -75,8 +76,14 @@
     
     rh = RockstarHaloFinder(pf)
     rh.run()
+
+
     halos_pf = RockstarDataset("rockstar_halos/halos_0.0.bin")
-    halos_pf.create_field_info()
+    try:
+        halos_pf.create_field_info()
+    except ValueError:
+        return None
+
     return halos_pf
 add_finding_method("rockstar", _rockstar_method)
 
@@ -87,6 +94,8 @@
 
     num_halos = len(halo_list)
 
+    if num_halos == 0: return None
+
     # Set up fields that we want to pull from identified halos and their units
     new_fields = ['particle_identifier', 'particle_mass', 'particle_position_x', 
         'particle_position_y','particle_position_z',

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