Repository navigation
Representation arithmetic #5301
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a53ee20
Add arithmetic operations to representations.
mhvk 77d0bdf
Clarification/simplificication following comments from Michael Seifert.
mhvk 3976553
Add __neg__ and __pos__ methods.
mhvk 3b516a9
Remove __eq__ as it is too liable to give false negatives.
mhvk ce292f7
Simplifications and clarifications following Tom Aldcroft's comments.
mhvk ba5c155
Add comment about choice of values for tests. [skip ci]
mhvk 9dd4707
Add tests for __pos__ and __neg__.
mhvk bcd0a6b
Ensure tests also cover exceptions.
mhvk 3261f90
Change __abs__ to norm, and clarify docstrings, following Erik Toller…
mhvk 5935a8d
Add documentation about vector arithmetic.
mhvk 2ee96e2
Changelog entry.
mhvk 4df4d7e
Post-rebase fixups.
mhvk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,19 @@ New Features | |
| - Transformations between coordinate systems can use the more accurate JPL | ||
| ephemerides. [#5273, #5436] | ||
|
|
||
| - Arithmetic on representations, such as addition of two representations, | ||
| multiplication with a ``Quantity``, or calculating the norm via ``abs``, | ||
| has now become possible. Furthermore, there are new methods ``mean``, | ||
| ``sum``, ``dot``, and ``cross``. For all these, the representations are | ||
| treated as vectors in cartesian space (temporarily converting to | ||
| ``CartesianRepresentation`` if necessary). [#5301] | ||
| has now become possible. Furthermore, there are news methods ``mean``, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, done |
||
| ``sum``, ``dot``, and ``cross`` with obvious meaning. [#5301] | ||
| multiplication with a ``Quantity`` has now become possible. Furthermore, | ||
| there are new methods ``norm``, ``mean``, ``sum``, ``dot``, and ``cross``. | ||
| In all operations, the representations are treated as vectors. They are | ||
| temporarily converted to ``CartesianRepresentation`` if necessary. [#5301] | ||
|
|
||
| - ``astropy.cosmology`` | ||
|
|
||
| - ``astropy.io.ascii`` | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding wording that this treats representation points as vectors in cartesian space. Then everything that follows is indeed "obvious".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Done.