Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 91034ee

Browse filesBrowse files
committed
Finish swapping np.float{,_} -> float; ma -> np.ma
plus other comments on the PR.
1 parent 71d9386 commit 91034ee
Copy full SHA for 91034ee
Expand file treeCollapse file tree

24 files changed

+153
-165
lines changed

‎examples/misc/rec_join_demo.py

Copy file name to clipboardExpand all lines: examples/misc/rec_join_demo.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
r1 = r[-10:]
1212

1313
# Create a new array
14-
r2 = np.empty(12, dtype=[('date', '|O4'), ('high', np.float),
15-
('marker', np.float)])
14+
r2 = np.empty(12, dtype=[('date', '|O4'), ('high', float), ('marker', float)])
1615
r2 = r2.view(np.recarray)
1716
r2.date = r.date[-17:-5]
1817
r2.high = r.high[-17:-5]

‎examples/pylab_examples/demo_ribbon_box.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/demo_ribbon_box.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def draw(self, renderer, *args, **kwargs):
121121
interpolation="bicubic",
122122
zorder=0.1,
123123
)
124-
gradient = np.zeros((2, 2, 4), dtype=np.float)
124+
gradient = np.zeros((2, 2, 4), dtype=float)
125125
gradient[:, :, :3] = [1, 1, 0.]
126126
gradient[:, :, 3] = [[0.1, 0.3], [0.3, 0.5]] # alpha channel
127127
patch_gradient.set_array(gradient)

‎examples/pylab_examples/dolphin.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/dolphin.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
vertices.extend([[float(x) for x in y.split(',')] for y in
7575
parts[i + 1:i + npoints + 1]])
7676
i += npoints + 1
77-
vertices = np.array(vertices, np.float)
77+
vertices = np.array(vertices, float)
7878
vertices[:, 1] -= 160
7979

8080
dolphin_path = Path(vertices, codes)

‎examples/units/units_scatter.py

Copy file name to clipboardExpand all lines: examples/units/units_scatter.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# create masked array
1616

1717

18-
xsecs = secs*np.ma.MaskedArray((1, 2, 3, 4, 5, 6, 7, 8), (1, 0, 1, 0, 0, 0, 1, 0), np.float)
18+
xsecs = secs*np.ma.MaskedArray((1, 2, 3, 4, 5, 6, 7, 8), (1, 0, 1, 0, 0, 0, 1, 0), float)
1919
#xsecs = secs*np.arange(1,10.)
2020

2121
fig = figure()

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
cycler)
127127

128128
import numpy
129-
import numpy.ma
130129
from matplotlib.externals.six.moves.urllib.request import urlopen
131130
from matplotlib.externals.six.moves import reload_module as reload
132131

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2357,7 +2357,7 @@ def stem(self, *args, **kwargs):
23572357

23582358
# Try a second one
23592359
try:
2360-
second = np.asarray(args[0], dtype=np.float)
2360+
second = np.asarray(args[0], dtype=float)
23612361
x, y = y, second
23622362
args = args[1:]
23632363
except (IndexError, ValueError):
@@ -4739,7 +4739,7 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
47394739
continue
47404740

47414741
N = len(xslice)
4742-
X = np.zeros((2 * N + 2, 2), np.float)
4742+
X = np.zeros((2 * N + 2, 2), float)
47434743

47444744
if interpolate:
47454745
def get_interp_point(ind):
@@ -4889,7 +4889,7 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
48894889
continue
48904890

48914891
N = len(yslice)
4892-
Y = np.zeros((2 * N + 2, 2), np.float)
4892+
Y = np.zeros((2 * N + 2, 2), float)
48934893

48944894
# the purpose of the next two lines is for when x2 is a
48954895
# scalar like 0 and we want the fill to go all the way
@@ -6203,7 +6203,7 @@ def _normalize_input(inp, ename='input'):
62036203

62046204
for m, c in zip(n, color):
62056205
if bottom is None:
6206-
bottom = np.zeros(len(m), np.float)
6206+
bottom = np.zeros(len(m), float)
62076207
if stacked:
62086208
height = m - bottom
62096209
else:
@@ -6222,14 +6222,14 @@ def _normalize_input(inp, ename='input'):
62226222

62236223
elif histtype.startswith('step'):
62246224
# these define the perimeter of the polygon
6225-
x = np.zeros(4 * len(bins) - 3, np.float)
6226-
y = np.zeros(4 * len(bins) - 3, np.float)
6225+
x = np.zeros(4 * len(bins) - 3, float)
6226+
y = np.zeros(4 * len(bins) - 3, float)
62276227

62286228
x[0:2*len(bins)-1:2], x[1:2*len(bins)-1:2] = bins, bins[:-1]
62296229
x[2*len(bins)-1:] = x[1:2*len(bins)-1][::-1]
62306230

62316231
if bottom is None:
6232-
bottom = np.zeros(len(bins)-1, np.float)
6232+
bottom = np.zeros(len(bins)-1, float)
62336233

62346234
y[1:2*len(bins)-1:2], y[2:2*len(bins):2] = bottom, bottom
62356235
y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
327327

328328
if edgecolors is None:
329329
edgecolors = facecolors
330-
linewidths = np.array([gc.get_linewidth()], np.float_)
330+
linewidths = np.array([gc.get_linewidth()], float)
331331

332332
return self.draw_path_collection(
333333
gc, master_transform, paths, [], offsets, offsetTrans, facecolors,

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2303,7 +2303,7 @@ def pts_to_prestep(x, *args):
23032303
# do normalization
23042304
vertices = _step_validation(x, *args)
23052305
# create the output array
2306-
steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), np.float)
2306+
steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), float)
23072307
# do the to step conversion logic
23082308
steps[0, 0::2], steps[0, 1::2] = vertices[0, :], vertices[0, :-1]
23092309
steps[1:, 0::2], steps[1:, 1:-1:2] = vertices[1:, :], vertices[1:, 1:]
@@ -2343,7 +2343,7 @@ def pts_to_poststep(x, *args):
23432343
# do normalization
23442344
vertices = _step_validation(x, *args)
23452345
# create the output array
2346-
steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), np.float)
2346+
steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), float)
23472347
# do the to step conversion logic
23482348
steps[0, ::2], steps[0, 1:-1:2] = vertices[0, :], vertices[0, 1:]
23492349
steps[1:, 0::2], steps[1:, 1::2] = vertices[1:, :], vertices[1:, :-1]
@@ -2384,7 +2384,7 @@ def pts_to_midstep(x, *args):
23842384
# do normalization
23852385
vertices = _step_validation(x, *args)
23862386
# create the output array
2387-
steps = np.zeros((vertices.shape[0], 2 * len(x)), np.float)
2387+
steps = np.zeros((vertices.shape[0], 2 * len(x)), float)
23882388
steps[0, 1:-1:2] = 0.5 * (vertices[0, :-1] + vertices[0, 1:])
23892389
steps[0, 2::2] = 0.5 * (vertices[0, :-1] + vertices[0, 1:])
23902390
steps[0, 0] = vertices[0, 0]

‎lib/matplotlib/collections.py

Copy file name to clipboardExpand all lines: lib/matplotlib/collections.py
+8-8Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Collection(artist.Artist, cm.ScalarMappable):
7676
(i.e., a call to set_array has been made), at draw time a call to
7777
scalar mappable will be made to set the face colors.
7878
"""
79-
_offsets = np.array([], np.float_)
79+
_offsets = np.array([], float)
8080
# _offsets must be a Nx2 array!
8181
_offsets.shape = (0, 2)
8282
_transOffset = transforms.IdentityTransform()
@@ -129,7 +129,7 @@ def __init__(self,
129129
self.set_zorder(zorder)
130130

131131
self._uniform_offsets = None
132-
self._offsets = np.array([[0, 0]], np.float_)
132+
self._offsets = np.array([[0, 0]], float)
133133
if offsets is not None:
134134
offsets = np.asanyarray(offsets)
135135
offsets.shape = (-1, 2) # Make it Nx2
@@ -197,7 +197,7 @@ def get_datalim(self, transData):
197197
offsets = transOffset.transform_non_affine(offsets)
198198
transOffset = transOffset.get_affine()
199199

200-
offsets = np.asanyarray(offsets, np.float_)
200+
offsets = np.asanyarray(offsets, float)
201201
if isinstance(offsets, np.ma.MaskedArray):
202202
offsets = offsets.filled(np.nan)
203203
# get_path_collection_extents handles nan but not masked arrays
@@ -239,7 +239,7 @@ def _prepare_points(self):
239239
ys = self.convert_yunits(offsets[:, 1])
240240
offsets = list(zip(xs, ys))
241241

242-
offsets = np.asanyarray(offsets, np.float_)
242+
offsets = np.asanyarray(offsets, float)
243243
offsets.shape = (-1, 2) # Make it Nx2
244244

245245
if not transform.is_affine:
@@ -428,7 +428,7 @@ def set_offsets(self, offsets):
428428
429429
ACCEPTS: float or sequence of floats
430430
"""
431-
offsets = np.asanyarray(offsets, np.float_)
431+
offsets = np.asanyarray(offsets, float)
432432
offsets.shape = (-1, 2) # Make it Nx2
433433
#This decision is based on how they are initialized above
434434
if self._uniform_offsets is None:
@@ -1162,7 +1162,7 @@ def set_segments(self, segments):
11621162

11631163
for seg in segments:
11641164
if not isinstance(seg, np.ma.MaskedArray):
1165-
seg = np.asarray(seg, np.float_)
1165+
seg = np.asarray(seg, float)
11661166
_segments.append(seg)
11671167

11681168
if self._uniform_offsets is not None:
@@ -1752,7 +1752,7 @@ def __init__(self, meshWidth, meshHeight, coordinates,
17521752
# By converting to floats now, we can avoid that on every draw.
17531753
self._coordinates = self._coordinates.reshape(
17541754
(meshHeight + 1, meshWidth + 1, 2))
1755-
self._coordinates = np.array(self._coordinates, np.float_)
1755+
self._coordinates = np.array(self._coordinates, float)
17561756

17571757
def get_paths(self):
17581758
if self._paths is None:
@@ -1850,7 +1850,7 @@ def draw(self, renderer):
18501850
ys = self.convert_yunits(self._offsets[:, 1])
18511851
offsets = list(zip(xs, ys))
18521852

1853-
offsets = np.asarray(offsets, np.float_)
1853+
offsets = np.asarray(offsets, float)
18541854
offsets.shape = (-1, 2) # Make it Nx2
18551855

18561856
self.update_scalarmappable()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.