From f60fa3b5346e7e989b89d89fd4d8729b4b38c057 Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Sun, 18 Apr 2021 10:16:09 -0700 Subject: [PATCH] Use clip_array instead of np.clip in GLVolumeItem --- examples/GLVolumeItem.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/GLVolumeItem.py b/examples/GLVolumeItem.py index ae2e90ff..42350844 100644 --- a/examples/GLVolumeItem.py +++ b/examples/GLVolumeItem.py @@ -11,6 +11,7 @@ import numpy as np import pyqtgraph as pg from pyqtgraph.Qt import QtCore, QtGui import pyqtgraph.opengl as gl +from pyqtgraph.functions import clip_array app = pg.mkQApp("GLVolumeItem Example") w = gl.GLViewWidget() @@ -39,8 +40,8 @@ def psi(i, j, k, offset=(50,50,100)): data = np.fromfunction(psi, (100,100,200)) -positive = np.log(np.clip(data, 0, data.max())**2) -negative = np.log(np.clip(-data, 0, -data.min())**2) +positive = np.log(clip_array(data, 0, data.max())**2) +negative = np.log(clip_array(-data, 0, -data.min())**2) d2 = np.empty(data.shape + (4,), dtype=np.ubyte) d2[..., 0] = positive * (255./positive.max())