[yt-svn] commit/yt-3.0: MatthewTurk: Adding early bail-out in case of no particles in RAMSES field reader.

Bitbucket commits-noreply at bitbucket.org
Tue Aug 28 03:44:47 PDT 2012


1 new commit in yt-3.0:


https://bitbucket.org/yt_analysis/yt-3.0/changeset/f1e5ae1e3f83/
changeset:   f1e5ae1e3f83
branch:      yt-3.0
user:        MatthewTurk
date:        2012-08-28 12:44:40
summary:     Adding early bail-out in case of no particles in RAMSES field reader.
affected #:  1 file

diff -r ca74dd8e5133a931efd33830d379e85fdc23eb90 -r f1e5ae1e3f83d621a000e1071c652753c0dcd703 yt/frontends/ramses/data_structures.py
--- a/yt/frontends/ramses/data_structures.py
+++ b/yt/frontends/ramses/data_structures.py
@@ -108,6 +108,10 @@
         return self._hydro_offset
 
     def _read_particle_header(self):
+        if not os.path.exists(self.part_fn):
+            self.local_particle_count = 0
+            self.particle_field_offsets = {}
+            return
         f = open(self.part_fn, "rb")
         hvals = {}
         attrs = ( ('ncpu', 1, 'I'),
@@ -345,8 +349,10 @@
         # TODO: Add additional fields
         self.fluid_field_list = [ "Density", "x-velocity", "y-velocity",
 	                        "z-velocity", "Pressure", "Metallicity" ]
-        self.particle_field_list = \
-            self.domains[0].particle_field_offsets.keys()
+        pfl = set([])
+        for domain in self.domains:
+            pfl.update(set(domain.particle_field_offsets.keys()))
+        self.particle_field_list = list(pfl)
         self.field_list = self.fluid_field_list + self.particle_field_list
     
     def _setup_classes(self):

Repository URL: https://bitbucket.org/yt_analysis/yt-3.0/

--

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