Conversation
- Remove some very old compatibility layers (sets module, md5 module, etc.) - Use `astype(float)` instead of `astype(np.float)` and `astype(np.float_)` - Use `isinstance(..., MaskedArray)` instead of `isMaskedArray` / `isMA`.
|
On 2016/06/10 8:56 PM, Antony Lee wrote:
What is the advantage of this change? |
|
|
||
| DEBUG = False | ||
| # we need this later, but this is very expensive to set up | ||
| MINFLOAT = np.MachAr(float).xmin |
There was a problem hiding this comment.
Have you benchmarked this change. It was done like this for performance reasons. See
2d0cc7d
There was a problem hiding this comment.
Ok read the docs it seems like finfo is a cached version of MachAr so it is probably fine
There was a problem hiding this comment.
It is a slower than just reading off a global but still much faster than MachAr and even than allocating a new array of size 1.
There was a problem hiding this comment.
I am also mildly concerned about this, but this is almost certainly not the bottle neck any more.
|
re: |
|
On 2016/06/11 5:48 AM, Antony Lee wrote:
I have no objection to making the change; your rationale is fine. |
lib/matplotlib/cbook.py
Outdated
| 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) |
There was a problem hiding this comment.
These got missed in the np.float -> float conversion.
There was a problem hiding this comment.
It's also not the masked array zeros, if that makes a difference.
There was a problem hiding this comment.
There's quite a few np.float left; this one is safe to replace but I'd need to do some more research to figure out how this changes calls to np.issubdtype and others.
WRT to np.zeros vs ma.zeros, see below.
|
Moving to use |
lib/matplotlib/__init__.py
Outdated
| cycler) | ||
|
|
||
| import numpy | ||
| import numpy.ma |
There was a problem hiding this comment.
Ensure that everyone can directly use np.ma.<xyz> without importing numpy.ma.
There was a problem hiding this comment.
Actually, it doesn't do anything at all. It's superfluous.
plus other comments on the PR.
|
👍 if @efiring is happy with the way the MA stuff ended up. |
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.