[hdf-compass] 80/295: use stride for large array when plotting

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun May 8 10:35:28 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository hdf-compass.

commit 4972c2a1c011caa66c75818d2a9dacbcf90bc78f
Author: jreadey <jreadey at hdfgroup.org>
Date:   Tue May 26 21:26:21 2015 -0700

    use stride for large array when plotting
---
 compass_viewer/array/plot.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/compass_viewer/array/plot.py b/compass_viewer/array/plot.py
index caabba7..21a32db 100644
--- a/compass_viewer/array/plot.py
+++ b/compass_viewer/array/plot.py
@@ -86,7 +86,14 @@ class ContourPlotFrame(PlotFrame):
         
     def draw_figure(self):
         import pylab
-        xx = np.arange(self.data.shape[1])
-        yy = np.arange(self.data.shape[0])
-        out = self.axes.contourf(xx, yy, self.data, 25)
+        
+        maxElements = 500  # don't attempt plot more than 500x500 elements
+        rows = self.data.shape[0]
+        cols = self.data.shape[1]
+        row_stride = rows/maxElements + 1
+        col_stride = cols/maxElements + 1
+        data = self.data[::row_stride, ::col_stride]
+        xx = np.arange(0, self.data.shape[1], col_stride)
+        yy = np.arange(0, self.data.shape[0], row_stride)
+        out = self.axes.contourf(xx, yy, data, 25)
         pylab.colorbar(out)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/hdf-compass.git



More information about the debian-science-commits mailing list