Skip to content
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

Issue 144 #152

Closed
wants to merge 4 commits into from
Closed

Issue 144 #152

wants to merge 4 commits into from

Conversation

petercorke
Copy link
Collaborator

Issue #144 pointed out a Numpy deprecation warning. This issue is actually quite prevalent, so it's worth fixing. The main culprit is getunit() which has the ability to check the dimensionality of its argument, eg. getunit(x, dim=3) raises an exception if the argument is not a 3-vector. The toolbox had lots of instances of getunit(x, dim=0) which seems to inconsistently mean either check for a scalar or return a scalar not an ndarray. Have added a new option getunit(x, vector=False) to return a scalar if possible. The functionality for dimension checking and output datatype are now quite separate and this makes the intent a lot clearer when reading code.

There are quite a few knockon consequences of this across other modules and tests.

Unfortunately this commit is quite big, but that's because of some changes between my blacked code and the blacked code in the repo. See issue #149 .

…nsionality of the argument, and also `dim=0` enforced a scalar rather than ndarray return value. Have now added a `vector=True` parameter which can be set to false to force a scalar return. All instances of passing `dim=0` have been found, documentation and tests updated.

Some black formatting changes are also included in here which is annoying.
@petercorke petercorke closed this by deleting the head repository Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant