[yt-svn] commit/yt: MatthewTurk: Adding check for no fields / ptypes in Gadget.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Aug 11 10:18:22 PDT 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/668704ca4a85/
Changeset:   668704ca4a85
Branch:      yt
User:        MatthewTurk
Date:        2014-08-11 15:41:32
Summary:     Adding check for no fields / ptypes in Gadget.
Affected #:  1 file

diff -r 77bbb0c5a38e27dd1855f23710a631765ca31f05 -r 668704ca4a85a154d2113fc7978eda970ba98eab yt/frontends/sph/io.py
--- a/yt/frontends/sph/io.py
+++ b/yt/frontends/sph/io.py
@@ -344,21 +344,26 @@
                         for ptype in self._ptypes):
                 continue
             pos += 4
+            any_ptypes = False
             for ptype in self._ptypes:
                 if field == "Mass" and ptype not in self.var_mass:
                     continue
                 if (ptype, field) not in field_list:
                     continue
                 offsets[(ptype, field)] = pos
+                any_ptypes = True
                 if field in self._vector_fields:
                     pos += 3 * pcount[ptype] * fs
                 else:
                     pos += pcount[ptype] * fs
             pos += 4
+            if not any_ptypes: pos -= 8
         if file_size is not None:
             if file_size != pos:
                 mylog.warning("Your Gadget-2 file may have extra " +
-                              "columns or different precision!")
+                              "columns or different precision!" +
+                              " (%s file vs %s computed)",
+                              file_size, pos)
         return offsets
 
     def _identify_fields(self, domain):

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