Repository navigation
Issue 144 - #152
Closed
petercorke wants to merge 4 commits into
Closed
Issue 144#152petercorke wants to merge 4 commits into
petercorke wants to merge 4 commits into
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ofgetunit(x, dim=0)which seems to inconsistently mean either check for a scalar or return a scalar not anndarray. Have added a new optiongetunit(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 .