Skip to content

Commit e932fb6

Browse files
committed
Fixed alias np.float which is deprecated in NumPy 1.20
1 parent 7a99cb2 commit e932fb6

File tree

8 files changed

+21
-20
lines changed

8 files changed

+21
-20
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
(see PR #61).
1111
- Removed unused `QwtPlotItem.defaultIcon` method.
1212
- Added various minor optimizations for axes/ticks drawing features.
13-
- Fixed `QwtPlot.canvasMap` when `axisScaleDiv` returns None
13+
- Fixed `QwtPlot.canvasMap` when `axisScaleDiv` returns None.
14+
- Fixed alias `np.float` which is deprecated in NumPy 1.20.
1415

1516
## Version 0.8.3
1617

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def array2d_to_qpolygonf(xdata, ydata):
122122
:return: Polyline
123123
:rtype: QtGui.QPolygonF
124124
"""
125-
dtype = np.float
125+
dtype = np.float64
126126
if not (
127127
xdata.size == ydata.size == xdata.shape[0] == ydata.shape[0]
128128
and xdata.dtype == ydata.dtype == dtype

qwt/plot_curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def array2d_to_qpolygonf(xdata, ydata):
7373
:return: Polyline
7474
:rtype: QtGui.QPolygonF
7575
"""
76-
dtype = np.float
76+
dtype = np.float64
7777
if not (
7878
xdata.size == ydata.size == xdata.shape[0] == ydata.shape[0]
7979
and xdata.dtype == ydata.dtype == dtype

qwt/tests/cpudemo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,28 +319,28 @@ def __init__(self, *args, unattended=False):
319319
curve.setColor(Qt.red)
320320
curve.attach(self)
321321
self.curves["System"] = curve
322-
self.data["System"] = np.zeros(self.HISTORY, np.float)
322+
self.data["System"] = np.zeros(self.HISTORY, float)
323323

324324
curve = CpuCurve("User")
325325
curve.setColor(Qt.blue)
326326
curve.setZ(curve.z() - 1.0)
327327
curve.attach(self)
328328
self.curves["User"] = curve
329-
self.data["User"] = np.zeros(self.HISTORY, np.float)
329+
self.data["User"] = np.zeros(self.HISTORY, float)
330330

331331
curve = CpuCurve("Total")
332332
curve.setColor(Qt.black)
333333
curve.setZ(curve.z() - 2.0)
334334
curve.attach(self)
335335
self.curves["Total"] = curve
336-
self.data["Total"] = np.zeros(self.HISTORY, np.float)
336+
self.data["Total"] = np.zeros(self.HISTORY, float)
337337

338338
curve = CpuCurve("Idle")
339339
curve.setColor(Qt.darkCyan)
340340
curve.setZ(curve.z() - 3.0)
341341
curve.attach(self)
342342
self.curves["Idle"] = curve
343-
self.data["Idle"] = np.zeros(self.HISTORY, np.float)
343+
self.data["Idle"] = np.zeros(self.HISTORY, float)
344344

345345
self.showCurve(self.curves["System"], True)
346346
self.showCurve(self.curves["User"], True)

qwt/tests/data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ def __init__(self, *args, unattended=False):
3333

3434
# Initialize data
3535
self.x = np.arange(0.0, 100.1, 0.5)
36-
self.y = np.zeros(len(self.x), np.float)
37-
self.z = np.zeros(len(self.x), np.float)
36+
self.y = np.zeros(len(self.x), float)
37+
self.z = np.zeros(len(self.x), float)
3838

3939
self.setTitle("A Moving QwtPlot Demonstration")
4040
self.insertLegend(QwtLegend(), QwtPlot.BottomLegend)

qwt/tests/errorbar.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ def setData(self, *args):
100100
if len(args) > 3:
101101
dy = args[3]
102102

103-
self.__x = np.asarray(x, np.float)
103+
self.__x = np.asarray(x, float)
104104
if len(self.__x.shape) != 1:
105105
raise RuntimeError("len(asarray(x).shape) != 1")
106106

107-
self.__y = np.asarray(y, np.float)
107+
self.__y = np.asarray(y, float)
108108
if len(self.__y.shape) != 1:
109109
raise RuntimeError("len(asarray(y).shape) != 1")
110110
if len(self.__x) != len(self.__y):
@@ -113,14 +113,14 @@ def setData(self, *args):
113113
if dx is None:
114114
self.__dx = None
115115
else:
116-
self.__dx = np.asarray(dx, np.float)
116+
self.__dx = np.asarray(dx, float)
117117
if len(self.__dx.shape) not in [0, 1, 2]:
118118
raise RuntimeError("len(asarray(dx).shape) not in [0, 1, 2]")
119119

120120
if dy is None:
121121
self.__dy = dy
122122
else:
123-
self.__dy = np.asarray(dy, np.float)
123+
self.__dy = np.asarray(dy, float)
124124
if len(self.__dy.shape) not in [0, 1, 2]:
125125
raise RuntimeError("len(asarray(dy).shape) not in [0, 1, 2]")
126126

@@ -282,7 +282,7 @@ def __init__(self, parent=None, title=None):
282282
grid.setPen(QPen(Qt.black, 0, Qt.DotLine))
283283

284284
# calculate data and errors for a curve with error bars
285-
x = np.arange(0, 10.1, 0.5, np.float)
285+
x = np.arange(0, 10.1, 0.5, float)
286286
y = np.sin(x)
287287
dy = 0.2 * abs(y)
288288
# dy = (0.15 * abs(y), 0.25 * abs(y)) # uncomment for asymmetric error bars

qwt/tests/eventfilter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ def __insertCurve(self, orientation, color, base):
201201
curve.setSymbol(
202202
QwtSymbol(QwtSymbol.Ellipse, QBrush(Qt.gray), QPen(color), QSize(8, 8))
203203
)
204-
fixed = base * np.ones(10, np.float)
205-
changing = np.arange(0, 95.0, 10.0, np.float) + 5.0
204+
fixed = base * np.ones(10, float)
205+
changing = np.arange(0, 95.0, 10.0, float) + 5.0
206206
if orientation == Qt.Horizontal:
207207
curve.setData(changing, fixed)
208208
else:
@@ -324,8 +324,8 @@ def __move(self, pos):
324324
curve = self.__selectedCurve
325325
if not curve:
326326
return
327-
xData = np.zeros(curve.dataSize(), np.float)
328-
yData = np.zeros(curve.dataSize(), np.float)
327+
xData = np.zeros(curve.dataSize(), float)
328+
yData = np.zeros(curve.dataSize(), float)
329329
for i in range(curve.dataSize()):
330330
if i == self.__selectedPoint:
331331
xData[i] = self.__plot.invTransform(curve.xAxis(), pos.x())

qwt/tests/mapdemo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ def __init__(self, *args):
4444
self.setCentralWidget(self.plot)
4545
# Initialize map data
4646
self.count = self.i = 1000
47-
self.xs = np.zeros(self.count, np.float)
48-
self.ys = np.zeros(self.count, np.float)
47+
self.xs = np.zeros(self.count, float)
48+
self.ys = np.zeros(self.count, float)
4949
self.kappa = 0.2
5050
self.curve = QwtPlotCurve("Map")
5151
self.curve.attach(self.plot)

0 commit comments

Comments
 (0)