Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Replace mlab functions #9177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

dstansby
Copy link
Member

Allows a few functions in mlab.py to be deprecated.

@dstansby dstansby added this to the 2.2 (next next feature release) milestone Sep 10, 2017
# Alternative to np.linalg.norm()
# as numpy 1.7 doesn't have 'axis' kwarg
dX = np.sum(dX**2, axis=1)**(1 / 2)
return np.concatenate((np.zeros(1), np.cumsum(dX)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this can be done more efficiently with 3 lines in place of the function:

pl = np.zeros(slc.shape[0], dtype=float)
dx = np.diff(slc, axis=0)
pl[1:] = np.cumsum(np.hypot(dx[:, 0], dx[:, 1]))

@anntzer
Copy link
Contributor

anntzer commented Sep 12, 2017

Would it be simpler to bump the numpy version to 1.8.0? Relevant ubuntu versions right now are at https://www.ubuntu.com/info/release-end-of-life:
12.04 LTS "ubuntu advantage customers" has numpy 1.6.1 so they're already out anyways.
14.04 LTS has numpy 1.8.1.
https://pkgs.org/download/python3-numpy

Plus this way we get np.full :-)

@dstansby dstansby mentioned this pull request Sep 21, 2017
28 tasks
@dstansby dstansby changed the title Replace mlab functions in contour labelling Replace mlab functions Sep 21, 2017
@dstansby
Copy link
Member Author

I'm going to move everything over to #9151 for simplicity (sorry if people are getting lots of notifications...)

@dstansby dstansby closed this Sep 21, 2017
@dstansby dstansby deleted the replace-path-length branch September 24, 2017 19:06
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants