Skip to content

Commit e9b2cca

Browse files
committed
Merge pull request #4255 from eteq/change-gcrs-itrs-cirs
Change ordering of GCRS/ITRS transforms to make more sense
1 parent 70c82d9 commit e9b2cca

File tree

2 files changed

+174
-27
lines changed

2 files changed

+174
-27
lines changed

CHANGES.rst

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,163 @@
1+
1.2 (unreleased)
2+
----------------
3+
4+
New Features
5+
^^^^^^^^^^^^
6+
7+
- ``astropy.analytic_functions``
8+
9+
- ``astropy.config``
10+
11+
- ``astropy.conftest.py``
12+
13+
- ``astropy.constants``
14+
15+
- ``astropy.convolution``
16+
17+
- ``astropy.coordinates``
18+
19+
- ``astropy.cosmology``
20+
21+
- ``astropy.io.ascii``
22+
23+
- ``astropy.io.fits``
24+
25+
- ``astropy.io.misc``
26+
27+
- ``astropy.io.votable``
28+
29+
- ``astropy.logger.py``
30+
31+
- ``astropy.modeling``
32+
33+
- ``astropy.nddata``
34+
35+
- ``astropy.stats``
36+
37+
- ``astropy.table``
38+
39+
- ``astropy.tests``
40+
41+
- ``astropy.time``
42+
43+
- ``astropy.units``
44+
45+
- ``astropy.utils``
46+
47+
- ``astropy.visualization``
48+
49+
- ``astropy.vo``
50+
51+
- ``astropy.wcs``
52+
53+
API changes
54+
^^^^^^^^^^^
55+
56+
- ``astropy.analytic_functions``
57+
58+
- ``astropy.config``
59+
60+
- ``astropy.conftest.py``
61+
62+
- ``astropy.constants``
63+
64+
- ``astropy.convolution``
65+
66+
- ``astropy.coordinates``
67+
68+
- ``astropy.cosmology``
69+
70+
- ``astropy.io.ascii``
71+
72+
- ``astropy.io.fits``
73+
74+
- ``astropy.io.misc``
75+
76+
- ``astropy.io.votable``
77+
78+
- ``astropy.logger.py``
79+
80+
- ``astropy.modeling``
81+
82+
- ``astropy.nddata``
83+
84+
- ``astropy.stats``
85+
86+
- ``astropy.table``
87+
88+
- ``astropy.tests``
89+
90+
- ``astropy.time``
91+
92+
- ``astropy.units``
93+
94+
- ``astropy.utils``
95+
96+
- ``astropy.visualization``
97+
98+
- ``astropy.vo``
99+
100+
- ``astropy.wcs``
101+
102+
Bug fixes
103+
^^^^^^^^^
104+
105+
- ``astropy.analytic_functions``
106+
107+
- ``astropy.config``
108+
109+
- ``astropy.conftest.py``
110+
111+
- ``astropy.constants``
112+
113+
- ``astropy.convolution``
114+
115+
- ``astropy.coordinates``
116+
117+
- ``astropy.cosmology``
118+
119+
- ``astropy.io.ascii``
120+
121+
- ``astropy.io.fits``
122+
123+
- ``astropy.io.misc``
124+
125+
- ``astropy.io.votable``
126+
127+
- ``astropy.logger.py``
128+
129+
- ``astropy.modeling``
130+
131+
- ``astropy.nddata``
132+
133+
- ``astropy.stats``
134+
135+
- ``astropy.table``
136+
137+
- ``astropy.tests``
138+
139+
- ``astropy.time``
140+
141+
- ``astropy.units``
142+
143+
- ``astropy.utils``
144+
145+
- ``astropy.visualization``
146+
147+
- ``astropy.vo``
148+
149+
- ``astropy.wcs``
150+
151+
Other Changes and Additions
152+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
153+
154+
- In ``astropy.coordinates``, the transformations between GCRS, CIRS,
155+
and ITRS have been adjusted to more logically reflect the order in
156+
which they actually apply. This should not affect most coordinate
157+
transformations, but may affect code that is especially sensitive to
158+
machine precision effects that change when the order in which
159+
transformations occur is changed. [#4255]
160+
1161
1.1 (unreleased)
2162
----------------
3163

astropy/coordinates/builtin_frames/intermediate_rotation_transforms.py

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,10 @@
2020
from .itrs import ITRS
2121
from .utils import get_polar_motion
2222

23-
# first define helper functions
24-
def gcrs_to_itrs_mat(time):
25-
#first compute the celestial-to-intermediate matrix
26-
c2imat = erfa.c2i06a(time.jd1, time.jd2)
27-
28-
#now compute the polar motion p-matrix
29-
xp, yp = get_polar_motion(time)
30-
sp = erfa.sp00(time.jd1, time.jd2)
31-
pmmat = erfa.pom00(xp, yp, sp)
32-
33-
#now determine the Earth Rotation Angle for the input obstime
34-
era = erfa.era00(time.jd1, time.jd2)
35-
36-
return erfa.c2tcio(c2imat, era, pmmat)
37-
23+
# # first define helper functions
24+
def gcrs_to_cirs_mat(time):
25+
#felestial-to-intermediate matrix
26+
return erfa.c2i06a(time.jd1, time.jd2)
3827

3928
def cirs_to_itrs_mat(time):
4029
#compute the polar motion p-matrix
@@ -56,25 +45,23 @@ def gcrs_precession_mat(equinox):
5645

5746
# now the actual transforms
5847

59-
# the priority for the GCRS<->ITRS transforms are higher (=less traveled) to
60-
#make GCRS<->ICRS<->CIRS the preferred route over GCRS<->ITRS<->CIRS
61-
@frame_transform_graph.transform(FunctionTransform, GCRS, ITRS, priority=1.01)
62-
def gcrs_to_itrs(gcrs_coo, itrs_frame):
48+
@frame_transform_graph.transform(FunctionTransform, GCRS, CIRS)
49+
def gcrs_to_cirs(gcrs_coo, cirs_frame):
6350
# first get us to a 0 pos/vel GCRS at the target obstime
64-
gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=itrs_frame.obstime))
51+
gcrs_coo2 = gcrs_coo.transform_to(GCRS(obstime=cirs_frame.obstime))
6552

6653
#now get the pmatrix
67-
pmat = gcrs_to_itrs_mat(itrs_frame.obstime)
54+
pmat = gcrs_to_cirs_mat(cirs_frame.obstime)
6855
crepr = cartrepr_from_matmul(pmat, gcrs_coo2)
69-
return itrs_frame.realize_frame(crepr)
56+
return cirs_frame.realize_frame(crepr)
7057

7158

72-
@frame_transform_graph.transform(FunctionTransform, ITRS, GCRS, priority=1.01)
73-
def itrs_to_gcrs(itrs_coo, gcrs_frame):
59+
@frame_transform_graph.transform(FunctionTransform, CIRS, GCRS)
60+
def cirs_to_gcrs(cirs_coo, gcrs_frame):
7461
#compute the pmatrix, and then multiply by its transpose
75-
pmat = gcrs_to_itrs_mat(itrs_coo.obstime)
76-
newrepr = cartrepr_from_matmul(pmat, itrs_coo, transpose=True)
77-
gcrs = GCRS(newrepr, obstime=itrs_coo.obstime)
62+
pmat = gcrs_to_cirs_mat(cirs_coo.obstime)
63+
newrepr = cartrepr_from_matmul(pmat, cirs_coo, transpose=True)
64+
gcrs = GCRS(newrepr, obstime=cirs_coo.obstime)
7865

7966
#now do any needed offsets (no-op if same obstime and 0 pos/vel)
8067
return gcrs.transform_to(gcrs_frame)

0 commit comments

Comments
 (0)