Don't preserve equinox when transforming with SkyCoord#3106
Don't preserve equinox when transforming with SkyCoord#3106taldcroft merged 4 commits intoastropy:masterfrom
Conversation
|
I think this seems sensible. If I am understanding then the machinery to make this happen is all there because we keep track of whether an attribute was explicitly set or is just coming from the defaults. The relevant code is here: I haven't tested, but maybe in the final BTW the check |
|
I'm luck ... so far I've never had to write science code that uses Might be worth asking on the mailing list which equinox people expect (without showing what the current behaviour is). |
|
I do think if you just make an EDIT: in the case where no equinox is ever explicitly specified. |
|
I agree with @taldcroft and this is the behavior in e.g. kapteyn. The equinox for FK4 is always B1950 unless specified otherwise, and for FK5 it is always J2000 unless specified otherwise. |
|
👍 , then. |
|
I don't think this is supposed to be happening at all, so I think this is actually a bug rather than a "proposed change". What's supposed to happen is that The default FK4 equinox is B1950, so it shouldn't be different to specify it given that the So if @taldcroft's suggestion resolves this, I'm 👍 for it. |
|
Ok - it would be great if someone could implement a fix for this since I'm short on time in the next few days (but otherwise I'll get to it before 1.0) |
|
Code attached. Based on @eteq's statement that this is a bug (I agree), I've put this for 0.4.3. |
|
👍 |
|
This is passing tests now. Do you want to look at this @eteq ? |
There was a problem hiding this comment.
I like this numbered list format of the precedence. This should probably go somewhere fairly prominent in the docs. Maybe either in the "using" section on SkyCoord, or the SkyCoord docstring itself?
There was a problem hiding this comment.
(With one clarification in the docs: "self instance" should be replaced with "SkyCoord instance" or something like that.)
There was a problem hiding this comment.
Maybe add one final test where you do
c2 = c.transform_to(FK5(equinox='J1990'))
assert c2.equinox.value == 'J1990.000'
assert c2.obstime.value == 'J1980.000'
that is, make sure to catch the case of explicitly overwriting with the transform_to frame. I checked and it looks like it works, but it would make sense to add to the tests.
|
@taldcroft - looks good! You might want to put backticks around "SkyCoord", but it's a bit ambiguous given it's referring to that thing itself, so whatever's you think is fine. Other than that and my additional test suggestion above, I'm 👍 on merging. Thanks! |
Fix frame attribute inheritance in SkyCoord.transform_to
Fix frame attribute inheritance in SkyCoord.transform_to Conflicts: astropy/coordinates/tests/test_sky_coord.py
Fix for bug in astropy#5702. Also affects astropy#5722, astropy#3106.
Remove deprecated sigma_clip keywords SkyCoord.position_angle bug fix Fix for bug in astropy#5702. Also affects astropy#5722, astropy#3106. Attempting to commit changes for coord_offset before trying to merge changes from posang_fix position_offset before merging in cache_frame_attrs Revert "position_offset before merging in cache_frame_attrs" This reverts commit 9ef159218b746720a3d2134b5449bfb2f1a68f4f. `SkyCoord.offset_by()` and `.directional_offset_to()` functions. Simplistic treatment of coordinate offsets. Definition of position_angle at poles must be refined. Change in FIXME comment.
Fix for bug in astropy#5702. Also affects astropy#5722, astropy#3106.
Fix for bug in astropy#5702. Also affects astropy#5722, astropy#3106.
I find the following example confused me and it cost me a fair amount of time to debug vs kapteyn:
The issue is that while there is no sensible default for
obstime, and it makes sense to keep the one defined before, the default equinox for FK4 should beB1950and it should really only be changed explicitly, so I would expect the finalSkyCoordabove to be in B1950.Basically I'm advocating for two different kinds of attributes in frames - attributes that default to
None, and attributes that default to a valueB1950. In the above case, theFK4frame would assume the default equinox ofB1950while forobstimeit would be default toNoneso thenSkyCoordwould just use the value specified before.@eteq @taldcroft @cdeil - what do you think?