[yt-svn] commit/yt: 5 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed May 4 11:04:21 PDT 2016


5 new commits in yt:

https://bitbucket.org/yt_analysis/yt/commits/3b7077a3124f/
Changeset:   3b7077a3124f
Branch:      yt
User:        yihaochen
Date:        2016-03-04 23:31:35+00:00
Summary:     Try to guess and load particle file for FLASH dataset
Affected #:  1 file

diff -r 2d7b93e59428f2dc6d4cde5030cacc4b113c6ea4 -r 3b7077a3124f82c08823951b230074211c43f6a1 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -192,7 +192,12 @@
         self.particle_filename = particle_filename
 
         if self.particle_filename is None:
-            self._particle_handle = self._handle
+            try:
+                self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
+                self.particle_filename = filename.replace('plt_cnt', 'part')
+                mylog.info('Particle File Found: %s' % self.particle_filename.split('/')[-1])
+            except:
+                self._particle_handle = self._handle
         else:
             try:
                 self._particle_handle = HDF5FileHandler(self.particle_filename)


https://bitbucket.org/yt_analysis/yt/commits/798c914a68be/
Changeset:   798c914a68be
Branch:      yt
User:        yihaochen
Date:        2016-04-29 22:10:28+00:00
Summary:     check if the particle file has the same time as the plot file
Affected #:  1 file

diff -r 3b7077a3124f82c08823951b230074211c43f6a1 -r 798c914a68beabbebc0b5551b7ce0d9dcefd8e27 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -192,6 +192,7 @@
         self.particle_filename = particle_filename
 
         if self.particle_filename is None:
+            # try to guess the particle filename
             try:
                 self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
                 self.particle_filename = filename.replace('plt_cnt', 'part')
@@ -199,10 +200,18 @@
             except:
                 self._particle_handle = self._handle
         else:
+            # particle_filename is specified by user
             try:
                 self._particle_handle = HDF5FileHandler(self.particle_filename)
             except:
                 raise IOError(self.particle_filename)
+        # Check if the particle file has the same time
+        if self._particle_handle != self._handle:
+            part_time = self._particle_handle.handle.get('real scalars')[0][1]
+            plot_time = self._handle.handle.get('real scalars')[0][1]
+            if part_time != plot_time:
+                raise IOError('%s and  %s are not at the same time.' % (self.particle_filename, filename))
+
         # These should be explicitly obtained from the file, but for now that
         # will wait until a reorganization of the source tree and better
         # generalization.


https://bitbucket.org/yt_analysis/yt/commits/9d4bd75250e8/
Changeset:   9d4bd75250e8
Branch:      yt
User:        yihaochen
Date:        2016-04-29 22:49:21+00:00
Summary:     Use np.isclose to avoid floating-point comparison problem
Affected #:  1 file

diff -r 798c914a68beabbebc0b5551b7ce0d9dcefd8e27 -r 9d4bd75250e8d7858b796f975b77e630f8a3f104 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -196,7 +196,7 @@
             try:
                 self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
                 self.particle_filename = filename.replace('plt_cnt', 'part')
-                mylog.info('Particle File Found: %s' % self.particle_filename.split('/')[-1])
+                mylog.info('Particle file found: %s' % self.particle_filename.split('/')[-1])
             except:
                 self._particle_handle = self._handle
         else:
@@ -209,7 +209,7 @@
         if self._particle_handle != self._handle:
             part_time = self._particle_handle.handle.get('real scalars')[0][1]
             plot_time = self._handle.handle.get('real scalars')[0][1]
-            if part_time != plot_time:
+            if not np.isclose(part_time, plot_time):
                 raise IOError('%s and  %s are not at the same time.' % (self.particle_filename, filename))
 
         # These should be explicitly obtained from the file, but for now that


https://bitbucket.org/yt_analysis/yt/commits/a9afd11b472e/
Changeset:   a9afd11b472e
Branch:      yt
User:        yihaochen
Date:        2016-05-03 15:10:06+00:00
Summary:     Catch IOError only
Affected #:  1 file

diff -r 9d4bd75250e8d7858b796f975b77e630f8a3f104 -r a9afd11b472e1e5fbafd52342c8fb972b8858923 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -197,7 +197,7 @@
                 self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
                 self.particle_filename = filename.replace('plt_cnt', 'part')
                 mylog.info('Particle file found: %s' % self.particle_filename.split('/')[-1])
-            except:
+            except IOError:
                 self._particle_handle = self._handle
         else:
             # particle_filename is specified by user


https://bitbucket.org/yt_analysis/yt/commits/dedf4c47220e/
Changeset:   dedf4c47220e
Branch:      yt
User:        ngoldbaum
Date:        2016-05-04 18:04:02+00:00
Summary:     Merged in yihaochen/yt (pull request #2153)

Try to guess and load particle file for FLASH dataset. Closes #1179
Affected #:  1 file

diff -r 236cd5cc2b6a0b7b96ebe64a9a223f14bc86728e -r dedf4c47220e9551cf8ce24f10c9259da92f4361 yt/frontends/flash/data_structures.py
--- a/yt/frontends/flash/data_structures.py
+++ b/yt/frontends/flash/data_structures.py
@@ -192,12 +192,26 @@
         self.particle_filename = particle_filename
 
         if self.particle_filename is None:
-            self._particle_handle = self._handle
+            # try to guess the particle filename
+            try:
+                self._particle_handle = HDF5FileHandler(filename.replace('plt_cnt', 'part'))
+                self.particle_filename = filename.replace('plt_cnt', 'part')
+                mylog.info('Particle file found: %s' % self.particle_filename.split('/')[-1])
+            except IOError:
+                self._particle_handle = self._handle
         else:
+            # particle_filename is specified by user
             try:
                 self._particle_handle = HDF5FileHandler(self.particle_filename)
             except:
                 raise IOError(self.particle_filename)
+        # Check if the particle file has the same time
+        if self._particle_handle != self._handle:
+            part_time = self._particle_handle.handle.get('real scalars')[0][1]
+            plot_time = self._handle.handle.get('real scalars')[0][1]
+            if not np.isclose(part_time, plot_time):
+                raise IOError('%s and  %s are not at the same time.' % (self.particle_filename, filename))
+
         # These should be explicitly obtained from the file, but for now that
         # will wait until a reorganization of the source tree and better
         # generalization.

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160504/eae6e6fb/attachment.html>


More information about the yt-svn mailing list