Skip to content

Commit

Permalink
Since numpy 1.20 the aliases np.int and np.float are deprecated (…
Browse files Browse the repository at this point in the history
…see https://numpy.org/devdocs/release/1.20.0-notes.html#using-the-aliases-of-builtin-types-like-np-int-is-deprecated). The buildin types should be used instead. Since numpy 1.24 an AttributeError exception is thrown when `np.int` or `np.float` is used.
  • Loading branch information
Tim Riddermann committed Feb 28, 2023
1 parent 71ed075 commit 516539a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions samples/floatcanvas/BouncingBall.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from wx.lib.floatcanvas import FloatCanvas
print("using installed version:", wx.lib.floatcanvas.__version__)
elif ver == 'local':
## import a local version
## import a local version
import sys
sys.path.append("..")
from floatcanvas import NavCanvas
Expand Down Expand Up @@ -49,7 +49,7 @@ def GetOutlinePoints(self):

class Ball(MovingObjectMixin, FloatCanvas.Circle):
def __init__(self, XY, Velocity, Radius=2.0, **kwargs):
self.Velocity = np.asarray(Velocity, np.float).reshape((2,))
self.Velocity = np.asarray(Velocity, float).reshape((2,))
self.Radius = Radius
self.Moving = False
FloatCanvas.Circle.__init__(self, XY, Diameter=Radius*2, FillColor="red", **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion samples/floatcanvas/PixelBitmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def __init__(self, Bitmap, XY, Position = 'tl'):
else:
raise FC.FloatCanvasError("PixelBitmap takes only a wx.Bitmap or a wx.Image as input")

self.XY = np.asarray(XY, dtype=np.int).reshape((2,))
self.XY = np.asarray(XY, dtype=int).reshape((2,))
self.Position = Position

(self.Width, self.Height) = self.Bitmap.GetWidth(), self.Bitmap.GetHeight()
Expand Down
6 changes: 3 additions & 3 deletions wx/lib/plot/polyobjects.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def _drawmarkers(self, dc, coords, marker, size=1):
def _circle(self, dc, coords, size=1):
fact = 2.5 * size
wh = 5.0 * size
rect = np.zeros((len(coords), 4), np.float) + [0.0, 0.0, wh, wh]
rect = np.zeros((len(coords), 4), float) + [0.0, 0.0, wh, wh]
rect[:, 0:2] = coords - [fact, fact]
dc.DrawEllipseList(rect.astype(np.int32))

Expand All @@ -627,7 +627,7 @@ def _dot(self, dc, coords, size=1):
def _square(self, dc, coords, size=1):
fact = 2.5 * size
wh = 5.0 * size
rect = np.zeros((len(coords), 4), np.float) + [0.0, 0.0, wh, wh]
rect = np.zeros((len(coords), 4), float) + [0.0, 0.0, wh, wh]
rect[:, 0:2] = coords - [fact, fact]
dc.DrawRectangleList(rect.astype(np.int32))

Expand Down Expand Up @@ -1199,7 +1199,7 @@ def _draw_outliers(self, dc, printerScale):
size = 0.5
fact = 2.5 * size
wh = 5.0 * size
rect = np.zeros((len(pt_data), 4), np.float) + [0.0, 0.0, wh, wh]
rect = np.zeros((len(pt_data), 4), float) + [0.0, 0.0, wh, wh]
rect[:, 0:2] = pt_data - [fact, fact]
dc.DrawRectangleList(rect.astype(np.int32))

Expand Down

0 comments on commit 516539a

Please sign in to comment.