[yt-svn] commit/yt: xarthisius: [image_write:write_bitmap] non square matrices require swapaxes instead of transpose

Bitbucket commits-noreply at bitbucket.org
Mon Oct 1 07:12:14 PDT 2012


1 new commit in yt:


https://bitbucket.org/yt_analysis/yt/changeset/7e4f7124641b/
changeset:   7e4f7124641b
branch:      yt
user:        xarthisius
date:        2012-10-01 11:36:00
summary:     [image_write:write_bitmap] non square matrices require swapaxes instead of transpose
affected #:  1 file

diff -r 80b349aff94364fda92e7a5623d2f6a6955fe8a0 -r 7e4f7124641b4852eb6666f052183053fcca7daf yt/visualization/image_writer.py
--- a/yt/visualization/image_writer.py
+++ b/yt/visualization/image_writer.py
@@ -152,8 +152,7 @@
         alpha_channel = 255*np.ones((s1,s2,1), dtype='uint8')
         bitmap_array = np.concatenate([bitmap_array, alpha_channel], axis=-1)
     if transpose:
-        for channel in range(bitmap_array.shape[2]):
-            bitmap_array[:,:,channel] = bitmap_array[:,:,channel].T
+        bitmap_array = bitmap_array.swapaxes(0,1)
     if filename is not None:
         au.write_png(bitmap_array.copy(), filename)
     else:

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