| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 46d6e6c commit 71d9386
15 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,6 +126,7 @@ | |||
| 126 | 126 | cycler) | |
| 127 | 127 | ||
| 128 | 128 | import numpy | |
| 129 | + import numpy.ma | ||
| 129 | 130 | from matplotlib.externals.six.moves.urllib.request import urlopen | |
| 130 | 131 | from matplotlib.externals.six.moves import reload_module as reload | |
| 131 | 132 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5387,7 +5387,7 @@ def pcolor(self, *args, **kwargs): | |||
| 5387 | 5387 | ||
| 5388 | 5388 | if t and any(t.contains_branch_seperately(self.transData)): | |
| 5389 | 5389 | trans_to_data = t - self.transData | |
| 5390 | - pts = np.vstack([x, y]).T.astype(np.float) | ||
| 5390 | + pts = np.vstack([x, y]).T.astype(float) | ||
| 5391 | 5391 | transformed_pts = trans_to_data.transform(pts) | |
| 5392 | 5392 | x = transformed_pts[..., 0] | |
| 5393 | 5393 | y = transformed_pts[..., 1] | |
@@ -5537,7 +5537,7 @@ def pcolormesh(self, *args, **kwargs): | |||
| 5537 | 5537 | ||
| 5538 | 5538 | if t and any(t.contains_branch_seperately(self.transData)): | |
| 5539 | 5539 | trans_to_data = t - self.transData | |
| 5540 | - pts = np.vstack([X, Y]).T.astype(np.float) | ||
| 5540 | + pts = np.vstack([X, Y]).T.astype(float) | ||
| 5541 | 5541 | transformed_pts = trans_to_data.transform(pts) | |
| 5542 | 5542 | X = transformed_pts[..., 0] | |
| 5543 | 5543 | Y = transformed_pts[..., 1] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ | |||
| 12 | 12 | from operator import itemgetter | |
| 13 | 13 | ||
| 14 | 14 | import numpy as np | |
| 15 | - from numpy import ma | ||
| 16 | 15 | ||
| 17 | 16 | import matplotlib | |
| 18 | 17 | ||
@@ -1917,7 +1916,7 @@ def update_datalim(self, xys, updatex=True, updatey=True): | |||
| 1917 | 1916 | ||
| 1918 | 1917 | if iterable(xys) and not len(xys): | |
| 1919 | 1918 | return | |
| 1920 | - if not ma.isMaskedArray(xys): | ||
| 1919 | + if not isinstance(xys, np.ma.MaskedArray): | ||
| 1921 | 1920 | xys = np.asarray(xys) | |
| 1922 | 1921 | self.dataLim.update_from_data_xy(xys, self.ignore_existing_data_limits, | |
| 1923 | 1922 | updatex=updatex, updatey=updatey) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,10 +12,7 @@ | |||
| 12 | 12 | def _fn_name(): return sys._getframe(1).f_code.co_name | |
| 13 | 13 | import io | |
| 14 | 14 | ||
| 15 | - try: | ||
| 16 | - from hashlib import md5 | ||
| 17 | - except ImportError: | ||
| 18 | - from md5 import md5 #Deprecated in 2.5 | ||
| 15 | + from hashlib import md5 | ||
| 19 | 16 | ||
| 20 | 17 | from tempfile import mkstemp | |
| 21 | 18 | from matplotlib import verbose, __version__, rcParams, checkdep_ghostscript | |
@@ -44,10 +41,6 @@ def _fn_name(): return sys._getframe(1).f_code.co_name | |||
| 44 | 41 | import numpy as np | |
| 45 | 42 | import binascii | |
| 46 | 43 | import re | |
| 47 | - try: | ||
| 48 | - set | ||
| 49 | - except NameError: | ||
| 50 | - from sets import Set as set | ||
| 51 | 44 | ||
| 52 | 45 | if sys.platform.startswith('win'): cmd_split = '&' | |
| 53 | 46 | else: cmd_split = ';' | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,7 +31,6 @@ | |||
| 31 | 31 | from weakref import ref, WeakKeyDictionary | |
| 32 | 32 | ||
| 33 | 33 | import numpy as np | |
| 34 | - import numpy.ma as ma | ||
| 35 | 34 | ||
| 36 | 35 | ||
| 37 | 36 | class MatplotlibDeprecationWarning(UserWarning): | |
@@ -677,7 +676,7 @@ def is_string_like(obj): | |||
| 677 | 676 | if isinstance(obj, six.string_types): | |
| 678 | 677 | return True | |
| 679 | 678 | # numpy strings are subclass of str, ma strings are not | |
| 680 | - if ma.isMaskedArray(obj): | ||
| 679 | + if isinstance(obj, np.ma.MaskedArray): | ||
| 681 | 680 | if obj.ndim == 0 and obj.dtype.kind in 'SU': | |
| 682 | 681 | return True | |
| 683 | 682 | else: | |
@@ -1728,7 +1727,7 @@ def delete_masked_points(*args): | |||
| 1728 | 1727 | for i, x in enumerate(args): | |
| 1729 | 1728 | if (not is_string_like(x)) and iterable(x) and len(x) == nrecs: | |
| 1730 | 1729 | seqlist[i] = True | |
| 1731 | - if ma.isMA(x): | ||
| 1730 | + if isinstance(x, np.ma.MaskedArray): | ||
| 1732 | 1731 | if x.ndim > 1: | |
| 1733 | 1732 | raise ValueError("Masked arrays must be 1-D") | |
| 1734 | 1733 | else: | |
@@ -1739,8 +1738,8 @@ def delete_masked_points(*args): | |||
| 1739 | 1738 | if seqlist[i]: | |
| 1740 | 1739 | if x.ndim > 1: | |
| 1741 | 1740 | continue # Don't try to get nan locations unless 1-D. | |
| 1742 | - if ma.isMA(x): | ||
| 1743 | - masks.append(~ma.getmaskarray(x)) # invert the mask | ||
| 1741 | + if isinstance(x, np.ma.MaskedArray): | ||
| 1742 | + masks.append(~np.ma.getmaskarray(x)) # invert the mask | ||
| 1744 | 1743 | xd = x.data | |
| 1745 | 1744 | else: | |
| 1746 | 1745 | xd = x | |
@@ -1758,7 +1757,7 @@ def delete_masked_points(*args): | |||
| 1758 | 1757 | if seqlist[i]: | |
| 1759 | 1758 | margs[i] = x.take(igood, axis=0) | |
| 1760 | 1759 | for i, x in enumerate(margs): | |
| 1761 | - if seqlist[i] and ma.isMA(x): | ||
| 1760 | + if seqlist[i] and isinstance(x, np.ma.MaskedArray): | ||
| 1762 | 1761 | margs[i] = x.filled() | |
| 1763 | 1762 | return margs | |
| 1764 | 1763 | ||
@@ -2344,7 +2343,7 @@ def pts_to_poststep(x, *args): | |||
| 2344 | 2343 | # do normalization | |
| 2345 | 2344 | vertices = _step_validation(x, *args) | |
| 2346 | 2345 | # create the output array | |
| 2347 | - steps = ma.zeros((vertices.shape[0], 2 * len(x) - 1), np.float) | ||
| 2346 | + steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), np.float) | ||
| 2348 | 2347 | # do the to step conversion logic | |
| 2349 | 2348 | steps[0, ::2], steps[0, 1:-1:2] = vertices[0, :], vertices[0, 1:] | |
| 2350 | 2349 | steps[1:, 0::2], steps[1:, 1::2] = vertices[1:, :], vertices[1:, :-1] | |
@@ -2385,7 +2384,7 @@ def pts_to_midstep(x, *args): | |||
| 2385 | 2384 | # do normalization | |
| 2386 | 2385 | vertices = _step_validation(x, *args) | |
| 2387 | 2386 | # create the output array | |
| 2388 | - steps = ma.zeros((vertices.shape[0], 2 * len(x)), np.float) | ||
| 2387 | + steps = np.zeros((vertices.shape[0], 2 * len(x)), np.float) | ||
| 2389 | 2388 | steps[0, 1:-1:2] = 0.5 * (vertices[0, :-1] + vertices[0, 1:]) | |
| 2390 | 2389 | steps[0, 2::2] = 0.5 * (vertices[0, :-1] + vertices[0, 1:]) | |
| 2391 | 2390 | steps[0, 0] = vertices[0, 0] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,6 @@ | |||
| 15 | 15 | from matplotlib.externals.six.moves import zip | |
| 16 | 16 | import warnings | |
| 17 | 17 | import numpy as np | |
| 18 | - import numpy.ma as ma | ||
| 19 | 18 | import matplotlib as mpl | |
| 20 | 19 | import matplotlib.cbook as cbook | |
| 21 | 20 | import matplotlib.colors as mcolors | |
@@ -199,7 +198,7 @@ def get_datalim(self, transData): | |||
| 199 | 198 | transOffset = transOffset.get_affine() | |
| 200 | 199 | ||
| 201 | 200 | offsets = np.asanyarray(offsets, np.float_) | |
| 202 | - if np.ma.isMaskedArray(offsets): | ||
| 201 | + if isinstance(offsets, np.ma.MaskedArray): | ||
| 203 | 202 | offsets = offsets.filled(np.nan) | |
| 204 | 203 | # get_path_collection_extents handles nan but not masked arrays | |
| 205 | 204 | offsets.shape = (-1, 2) # Make it Nx2 | |
@@ -252,7 +251,7 @@ def _prepare_points(self): | |||
| 252 | 251 | # This might have changed an ndarray into a masked array. | |
| 253 | 252 | transOffset = transOffset.get_affine() | |
| 254 | 253 | ||
| 255 | - if np.ma.isMaskedArray(offsets): | ||
| 254 | + if isinstance(offsets, np.ma.MaskedArray): | ||
| 256 | 255 | offsets = offsets.filled(np.nan) | |
| 257 | 256 | # Changing from a masked array to nan-filled ndarray | |
| 258 | 257 | # is probably most efficient at this point. | |
@@ -875,14 +874,14 @@ def __init__(self, verts, sizes=None, closed=True, **kwargs): | |||
| 875 | 874 | ||
| 876 | 875 | def set_verts(self, verts, closed=True): | |
| 877 | 876 | '''This allows one to delay initialization of the vertices.''' | |
| 878 | - if np.ma.isMaskedArray(verts): | ||
| 879 | - verts = verts.astype(np.float_).filled(np.nan) | ||
| 877 | + if isinstance(verts, np.ma.MaskedArray): | ||
| 878 | + verts = verts.astype(float).filled(np.nan) | ||
| 880 | 879 | # This is much faster than having Path do it one at a time. | |
| 881 | 880 | if closed: | |
| 882 | 881 | self._paths = [] | |
| 883 | 882 | for xy in verts: | |
| 884 | 883 | if len(xy): | |
| 885 | - if np.ma.isMaskedArray(xy): | ||
| 884 | + if isinstance(xy, np.ma.MaskedArray): | ||
| 886 | 885 | xy = np.ma.concatenate([xy, xy[0:1]]) | |
| 887 | 886 | else: | |
| 888 | 887 | xy = np.asarray(xy) | |
@@ -1162,7 +1161,7 @@ def set_segments(self, segments): | |||
| 1162 | 1161 | _segments = [] | |
| 1163 | 1162 | ||
| 1164 | 1163 | for seg in segments: | |
| 1165 | - if not np.ma.isMaskedArray(seg): | ||
| 1164 | + if not isinstance(seg, np.ma.MaskedArray): | ||
| 1166 | 1165 | seg = np.asarray(seg, np.float_) | |
| 1167 | 1166 | _segments.append(seg) | |
| 1168 | 1167 | ||
@@ -1779,7 +1778,7 @@ def convert_mesh_to_paths(meshWidth, meshHeight, coordinates): | |||
| 1779 | 1778 | """ | |
| 1780 | 1779 | Path = mpath.Path | |
| 1781 | 1780 | ||
| 1782 | - if ma.isMaskedArray(coordinates): | ||
| 1781 | + if isinstance(coordinates, np.ma.MaskedArray): | ||
| 1783 | 1782 | c = coordinates.data | |
| 1784 | 1783 | else: | |
| 1785 | 1784 | c = coordinates | |
@@ -1800,7 +1799,7 @@ def convert_mesh_to_triangles(self, meshWidth, meshHeight, coordinates): | |||
| 1800 | 1799 | with its own color. This is useful for experiments using | |
| 1801 | 1800 | `draw_qouraud_triangle`. | |
| 1802 | 1801 | """ | |
| 1803 | - if ma.isMaskedArray(coordinates): | ||
| 1802 | + if isinstance(coordinates, np.ma.MaskedArray): | ||
| 1804 | 1803 | p = coordinates.data | |
| 1805 | 1804 | else: | |
| 1806 | 1805 | p = coordinates | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -891,12 +891,12 @@ def process_value(value): | |||
| 891 | 891 | # (list, tuple, deque, ndarray, Series, ...) | |
| 892 | 892 | result = result.copy() | |
| 893 | 893 | elif result.dtype.itemsize > 2: | |
| 894 | - result = result.astype(np.float) | ||
| 894 | + result = result.astype(float) | ||
| 895 | 895 | else: | |
| 896 | 896 | result = result.astype(np.float32) | |
| 897 | 897 | else: | |
| 898 | 898 | is_scalar = True | |
| 899 | - result = ma.array([value]).astype(np.float) | ||
| 899 | + result = ma.array([value]).astype(float) | ||
| 900 | 900 | return result, is_scalar | |
| 901 | 901 | ||
| 902 | 902 | def __call__(self, value, clip=None): | |
@@ -1121,7 +1121,7 @@ def _transform_vmin_vmax(self): | |||
| 1121 | 1121 | Calculates vmin and vmax in the transformed system. | |
| 1122 | 1122 | """ | |
| 1123 | 1123 | vmin, vmax = self.vmin, self.vmax | |
| 1124 | - arr = np.array([vmax, vmin]).astype(np.float) | ||
| 1124 | + arr = np.array([vmax, vmin]).astype(float) | ||
| 1125 | 1125 | self._upper, self._lower = self._transform(arr) | |
| 1126 | 1126 | ||
| 1127 | 1127 | def inverse(self, value): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,10 +48,6 @@ | |||
| 48 | 48 | ||
| 49 | 49 | import json | |
| 50 | 50 | import os, sys, warnings | |
| 51 | - try: | ||
| 52 | - set | ||
| 53 | - except NameError: | ||
| 54 | - from sets import Set as set | ||
| 55 | 51 | from collections import Iterable | |
| 56 | 52 | import matplotlib | |
| 57 | 53 | from matplotlib import afm | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -12,7 +12,6 @@ | |||
| 12 | 12 | import warnings | |
| 13 | 13 | ||
| 14 | 14 | import numpy as np | |
| 15 | - from numpy import ma | ||
| 16 | 15 | from matplotlib import verbose | |
| 17 | 16 | from . import artist, colors as mcolors | |
| 18 | 17 | from .artist import Artist | |
@@ -628,17 +627,17 @@ def recache_always(self): | |||
| 628 | 627 | def recache(self, always=False): | |
| 629 | 628 | if always or self._invalidx: | |
| 630 | 629 | xconv = self.convert_xunits(self._xorig) | |
| 631 | - if ma.isMaskedArray(self._xorig): | ||
| 632 | - x = ma.asarray(xconv, np.float_).filled(np.nan) | ||
| 630 | + if isinstance(self._xorig, np.ma.MaskedArray): | ||
| 631 | + x = np.ma.asarray(xconv, np.float_).filled(np.nan) | ||
| 633 | 632 | else: | |
| 634 | 633 | x = np.asarray(xconv, np.float_) | |
| 635 | 634 | x = x.ravel() | |
| 636 | 635 | else: | |
| 637 | 636 | x = self._x | |
| 638 | 637 | if always or self._invalidy: | |
| 639 | 638 | yconv = self.convert_yunits(self._yorig) | |
| 640 | - if ma.isMaskedArray(self._yorig): | ||
| 641 | - y = ma.asarray(yconv, np.float_).filled(np.nan) | ||
| 639 | + if isinstance(self._yorig, np.ma.MaskedArray): | ||
| 640 | + y = np.ma.asarray(yconv, np.float_).filled(np.nan) | ||
| 642 | 641 | else: | |
| 643 | 642 | y = np.asarray(yconv, np.float_) | |
| 644 | 643 | y = y.ravel() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,10 +22,6 @@ | |||
| 22 | 22 | import os, sys | |
| 23 | 23 | from matplotlib.externals.six import unichr | |
| 24 | 24 | from math import ceil | |
| 25 | - try: | ||
| 26 | - set | ||
| 27 | - except NameError: | ||
| 28 | - from sets import Set as set | ||
| 29 | 25 | import unicodedata | |
| 30 | 26 | from warnings import warn | |
| 31 | 27 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments