Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Some general cleanups #6573
Conversation
mdboom
added the
needs_review
label
Jun 11, 2016
|
On 2016/06/10 8:56 PM, Antony Lee wrote:
What is the advantage of this change? |
jenshnielsen
commented on the diff
Jun 11, 2016
| from .path import Path | ||
| DEBUG = False | ||
| -# we need this later, but this is very expensive to set up | ||
| -MINFLOAT = np.MachAr(float).xmin |
jenshnielsen
Owner
|
|
re: |
|
On 2016/06/11 5:48 AM, Antony Lee wrote:
I have no objection to making the change; your rationale is fine. |
tacaswell
and 2 others
commented on an outdated diff
Jun 12, 2016
| @@ -2344,7 +2343,7 @@ def pts_to_poststep(x, *args): | ||
| # do normalization | ||
| vertices = _step_validation(x, *args) | ||
| # create the output array | ||
| - steps = ma.zeros((vertices.shape[0], 2 * len(x) - 1), np.float) | ||
| + steps = np.zeros((vertices.shape[0], 2 * len(x) - 1), np.float) |
anntzer
Contributor
|
tacaswell
added this to the
2.1 (next point release)
milestone
Jun 12, 2016
|
Moving to use |
QuLogic
and 2 others
commented on an outdated diff
Jun 12, 2016
| @@ -126,6 +126,7 @@ | ||
| cycler) | ||
| import numpy | ||
| +import numpy.ma |
anntzer
Contributor
|
efiring
and 2 others
commented on an outdated diff
Jun 12, 2016
| @@ -2385,7 +2384,7 @@ def pts_to_midstep(x, *args): | ||
| # do normalization | ||
| vertices = _step_validation(x, *args) | ||
| # create the output array | ||
| - steps = ma.zeros((vertices.shape[0], 2 * len(x)), np.float) | ||
| + steps = np.zeros((vertices.shape[0], 2 * len(x)), np.float) |
efiring
Owner
|
efiring
commented on an outdated diff
Jun 12, 2016
| else: | ||
| result = result.astype(np.float32) | ||
| else: | ||
| is_scalar = True | ||
| - result = ma.array([value]).astype(np.float) | ||
| + result = ma.array([value]).astype(float) |
efiring
Owner
|
efiring
and 1 other
commented on an outdated diff
Jun 12, 2016
| @@ -3824,8 +3817,8 @@ def poly_below(xmin, xs, ys): | ||
| xv, yv = poly_below(0, x, y) | ||
| ax.fill(xv, yv) | ||
| """ | ||
| - if ma.isMaskedArray(xs) or ma.isMaskedArray(ys): | ||
| - numpy = ma | ||
| + if isinstance(xs, np.ma.MaskedArray) or isinstance(ys, np.ma.MaskedArray): | ||
| + numpy = np.ma |
efiring
Owner
|
efiring
and 2 others
commented on an outdated diff
Jun 12, 2016
| @@ -3853,9 +3846,10 @@ def poly_between(x, ylower, yupper): | ||
| Return value is *x*, *y* arrays for use with | ||
| :meth:`matplotlib.axes.Axes.fill`. | ||
| """ | ||
| - if (ma.isMaskedArray(ylower) or ma.isMaskedArray(yupper) or | ||
| - ma.isMaskedArray(x)): | ||
| - numpy = ma | ||
| + if (isinstance(ylower, np.ma.MaskedArray) or | ||
| + isinstance(yupper, np.ma.MaskedArray) or | ||
| + isinstance(x, np.ma.MaskedArray)): |
efiring
Owner
|
|
|
anntzer commentedJun 11, 2016
•
edited
astype(float)instead ofastype(np.float)andastype(np.float_)isinstance(..., MaskedArray)instead ofisMaskedArray/isMA.Some other cleanup ideas:
if debugprints (mostly present in backend implementations just to indicate that a method has been called): I think that a tool such as https://pypi.python.org/pypi/hunter is typically more appropriate anyways.loggingand read off an environment variable such asMPLVERBOSITYinstead of command-line arguments which are likely to be set for other purposes.