Repository navigation
Add _unitrep attr of SphericalRepresentation - #3757
Conversation
|
This may require some discussion because it includes a subtle but significant change: adding the The The background for this is that @Cadair was working with @ejeschke to try to speed up Ginga, and there's a need to quickly (in a GUI context) "re-populate" coordinate objects with new data, avoiding the object creation overhead. Also, btw, @Cadair, this needs a changelog entry. |
|
Yea, the |
|
Was there a specific need to swap the order of UnitSphericalRepresentatation and SphericalRepresentatation? This just makes some irrelevant diffs, or else obscures real diffs. |
|
If I moved the _unitrep stuff out of this, would people be willing to put it into a bug fix release seeing how it's not API breaking? (Just asking because it really breaks solar coords in Ginga). On the topic of copy kwarg. It is by far the easiest way to speed up the realize frame call (which really needs to happen for Ginga) the other option is going mad on the I personally think that it should be ok, people (like me) will hack around it anyway. |
|
@taldcroft I swapped them because otherwise the unitrep was not defined when creating the class attr. |
There was a problem hiding this comment.
Do you need self._rep_cache = dict() first to clear the cache from any other reprs that might be there?
|
I think it would be better to leave In general I think we need to open this box to support use cases like this where the current performance is not acceptable. |
|
👍 to @taldcroft's suggestion here of a different name with a prominent @Cadair - I also like your suggestion of splitting out the |
143d3af to
a64d8f3
Compare
|
This is now just the |
3402691 to
13eb563
Compare
There was a problem hiding this comment.
This line is the only actual change in here.
There was a problem hiding this comment.
Should this really go here if it's describing an attribute for internal-only use, or is this something authors of SphericalRepresentation subclasses need to be aware of?
There was a problem hiding this comment.
I did not know where best to put it in the change log, the way I have written this PR does assume that all SphericalRepresentation classes will have a _unitrep attribute now, so any authors will need to update.
Should I add a catch in the BaseCoordinateFrame.__init__ for non-updated subclasses, or are the SunPy ones the only subclasses in existence?!
There was a problem hiding this comment.
I would move this to the "API changes" section then, if nothing else, since it's more of an internal API feature.
Also some nitpicks--use double-backticks insgead of singe-backticks, and add a reference to the PR # :)
|
@Cadair - are there any diffs in Also kindof a nit, but the coordinates package tends to use more verbose names, so |
|
@taldcroft I have changed The only change in @embray I have moved the changelog entry, I think it is ok now. |
|
👍 |
|
Any more comments on this? |
|
@Cadair - if I do the following there are a lot of matches in the coordinates code: So my question is whether some of these need to be generalized to use the new class attribute so that subclasses actually behave as expected. One obvious case is in the If it is the intent (or requirement) that custom This is leading into adding some tests of having a custom |
|
@taldcroft I was working on the assumption that a class in the I will try and find some time to work more on this, but I am rather busy. |
|
OK, if the And in No worries on time. This is your feature request after all! |
|
Is this ready to merge, then? |
There was a problem hiding this comment.
represent_as is in fact defined a bit further down, so remove this comment? (Or clarify it and move it further down).
|
See minor cleanup comments; they can be a |
|
Two minor comments above, and one other thing best described via comment: Can you add just a bit in the Thanks @Cadair ! |
|
I will get to this asap. |
_unitrep allows subclasses of SphericalRepresntation to define their UnitSphericalRepresentation equivalent.
This mainly makes code check for subclasses as well as the base class.
[ci skip]
They now respect subclasses of the three SphericalRepresentation classes.
[ci skip]
…sentation classes, and that custom transform is removed from transform graph after tests
|
@mhvk @astrofrog @eteq I think this is ready! |
|
Alright, I think we can merge this once/if the tests pass! |
|
👍 |
Add _unitrep attr of SphericalRepresentation
|
Thanks everyone. |
_unitrep allows subclasses of SphericalRepresntation to define their
UnitSphericalRepresentation equivalent.
The copy argument to relalize_frame allows in place changes to the data
attached to the frame. This provides a way to create a frame and change
the data at high speed.