[yt-svn] commit/yt: jmoloney: Fixed 'next' and 'previous' pointers in cosmology splices to point to the correct outputs.

Bitbucket commits-noreply at bitbucket.org
Thu Aug 2 14:33:28 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/4fc8fc9b8c10/
changeset:   4fc8fc9b8c10
branch:      stable
user:        jmoloney
date:        2012-08-02 22:07:37
summary:     Fixed 'next' and 'previous' pointers in cosmology splices to point to the correct outputs.
affected #:  1 file

diff -r e55966f1addde8b88e75fbf82d4170e6b4426416 -r 4fc8fc9b8c10170b232e0aba44989477be82e9bb yt/analysis_modules/cosmological_observation/cosmology_splice.py
--- a/yt/analysis_modules/cosmological_observation/cosmology_splice.py
+++ b/yt/analysis_modules/cosmological_observation/cosmology_splice.py
@@ -184,7 +184,23 @@
 
         mylog.info("create_cosmology_splice: Used %d data dumps to get from z = %f to %f." %
                    (len(cosmology_splice), far_redshift, near_redshift))
-
+        
+        # change the 'next' and 'previous' pointers to point to the correct outputs for the created
+        # splice
+        for i, output in enumerate(cosmology_splice):
+            if len(cosmology_splice) == 1:
+                output['previous'] = None
+                output['next'] = None
+            elif i == 0:
+                output['previous'] = None
+                output['next'] = cosmology_splice[i + 1]
+            elif i == len(cosmology_splice) - 1:
+                output['previous'] = cosmology_splice[i - 1]
+                output['next'] = None
+            else:
+                output['previous'] = cosmology_splice[i - 1]
+                output['next'] = cosmology_splice[i + 1]
+        
         self.splice_outputs.sort(key=lambda obj: obj['time'])
         return cosmology_splice

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