Skip to content

Commit 811bf96

Browse files
Docs: show ‘mean_equator_and_equinox_of_date’ use
Inspired by discussion #1034, which made me realize that the documentation never actually shows how to get right ascension and declination measured against the mean equator and equinox.
1 parent 9e1bf2c commit 811bf96

2 files changed

Lines changed: 70 additions & 36 deletions

File tree

documentation/coordinates.rst

Lines changed: 66 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Through the following sections,
4747
we will see how to ask for both Cartesian and spherical coordinates
4848
in a variety of coordinate systems.
4949

50-
ICRS and equatorial right ascension and declination
51-
===================================================
50+
ICRS right ascension and declination
51+
====================================
5252

5353
*Equatorial* coordinates,
5454
which measure angles from the Earth’s equator and poles,
@@ -84,9 +84,9 @@ astronomers decided it was time to get off of the equatorial treadmill.
8484
They defined a new coordinate system:
8585
the ICRS (International Celestial Reference System).
8686
Its axes point almost exactly along the old J2000 axes,
87-
but are permanent and immobile,
88-
and can achieve unbounded precision
89-
because instead of using the Earth
87+
but are permanent and immobile.
88+
It can achieve unbounded precision because,
89+
instead of using the Earth,
9090
its axes are tied to the locations of very distant quasars.
9191

9292
In the :doc:`positions` chapter
@@ -140,57 +140,86 @@ Note that ``.xyz`` is a :class:`~skyfield.units.Distance` object
140140
and supports not only ``.au``
141141
but also several other units of measure.
142142

143+
Equatorial right ascension and declination
144+
==========================================
145+
143146
If instead of using the permanent ICRS
144-
you want to measure coordinates against the Earth’s axes as they precess,
145-
then retrieving spherical coordinates is easy:
146-
simply provide a date to :meth:`~skyfield.positionlib.ICRF.radec()`
147+
you want right ascension and declination
148+
measured against the Earth’s true equator and axes,
149+
then retrieving spherical coordinates is easy.
150+
Simply provide a date to :meth:`~skyfield.positionlib.ICRF.radec()`
147151
and it will return a right ascension and declination
148152
relative to the Earth’s equator and equinox as of that date.
149-
150-
It’s less usual for someone to want |xyz| coordinates
151-
measured against the real equator and equinox,
152-
so there’s no built-in method to retrieve them.
153-
Instead, you’ll need to import the reference frame itself
154-
and pass it to the position’s
155-
:meth:`~skyfield.positionlib.ICRF.frame_xyz()` method:
153+
Or provide the string ``'date'`` and the date of the position itself is used.
154+
You can find example code in the ‘Positions’ chapter
155+
in the sections :ref:`astrometric_ra_dec` and :ref:`apparent_ra_dec`.
156+
157+
But maybe your situation is more complicated.
158+
You might want |xyz| coordinates instead of right ascension and declination.
159+
Or maybe you want coordinates measured against the mean equator and equinox
160+
instead of the true equator and equinox.
161+
162+
In that case you will want to import one of these two reference frames:
163+
164+
* :class:`~skyfield.framelib.true_equator_and_equinox_of_date` —
165+
a reference frame
166+
that accounts for nearly every wobble of the Earth’s real axis.
167+
The effects of both precession and nutation are included.
168+
(The only effect omitted is the tiny daily offset 𝑥 and 𝑦
169+
that you may have loaded from an IERS data file
170+
as described in the :ref:`polar-motion` section.)
171+
172+
* :class:`~skyfield.framelib.mean_equator_and_equinox_of_date` —
173+
a reference frame
174+
that includes only the smooth long-term motion of precession,
175+
but omits all of the smaller wobbles in the Earth’s axis
176+
that we call nutation.
177+
The mean equator and equinox are sometimes used to tabulate coordinates
178+
in books like the *Astronomical Almanac*.
179+
180+
You can get both spherical and |xyz| coordinates
181+
for either of these reference frames
182+
by importing them and using them like this:
183+
184+
.. TODO add a new method frame_radec and use it below instead of frame_latlon
156185
157186
.. testcode::
158187

159-
from skyfield.framelib import \
160-
true_equator_and_equinox_of_date as of_date
161-
162-
print('Cartesian equinox-of-date coordinates:')
163-
164-
x, y, z = position.frame_xyz(of_date).au
165-
166-
print(' x = {:.3f} au'.format(x))
167-
print(' y = {:.3f} au'.format(y))
168-
print(' z = {:.3f} au'.format(z))
169-
print()
188+
from skyfield.framelib import true_equator_and_equinox_of_date
170189

171190
print('Spherical equinox-of-date coordinates:')
172191

173-
ra, dec, distance = position.radec(position.t)
192+
dec, ra, distance = position.frame_latlon(true_equator_and_equinox_of_date)
193+
194+
ra.preference = 'hours' # print hours instead of degrees
174195

175196
print(' ', ra, 'right ascension')
176197
print(' ', dec, 'declination')
177198
print(' ', distance, 'distance')
178199

179-
.. testoutput::
200+
print()
201+
print('Cartesian equinox-of-date coordinates:')
180202

181-
Cartesian equinox-of-date coordinates:
182-
x = -1.510 au
183-
y = -1.808 au
184-
z = -0.775 au
203+
x, y, z = position.frame_xyz(true_equator_and_equinox_of_date).au
204+
205+
print(' x = {:.6f} au'.format(x))
206+
print(' y = {:.6f} au'.format(y))
207+
print(' z = {:.6f} au'.format(z))
208+
209+
.. testoutput::
185210

186211
Spherical equinox-of-date coordinates:
187212
15h 20m 28.70s right ascension
188213
-18deg 13' 18.5" declination
189214
2.47983 au distance
190215

191-
Note that the distance is exactly the same as before,
192-
because this is exactly the same position —
193-
it’s merely being measured against a slightly different set of axes.
216+
Cartesian equinox-of-date coordinates:
217+
x = -1.510302 au
218+
y = -1.807555 au
219+
z = -0.775435 au
220+
221+
The code will look almost exactly the same for the mean equator and equinox,
222+
except for which frame is imported and used.
194223

195224
.. _horizontal-coordinates:
196225

@@ -276,7 +305,8 @@ Hour Angle and Declination
276305
If you are pointing a telescope or other instrument,
277306
you might be interested in a variation on equatorial coordinates:
278307
replacing right ascension with *hour angle,*
279-
which measures ±180° from your own local meridian.
308+
which measures ±180° from your own local meridian,
309+
whose hour angle is 0°.
280310

281311
.. testcode::
282312

documentation/positions.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ like an Earth satellite or latitude-longitude position,
265265
then the ``.center`` and ``.target``
266266
will be those Skyfield objects themselves.
267267

268+
.. _astrometric_ra_dec:
269+
268270
Astrometric right ascension and declination
269271
===========================================
270272

@@ -380,6 +382,8 @@ you can build a time object and pass it to :meth:`~ICRF.radec()`:
380382
equinox = ts.J(1991.25)
381383
ra, dec, distance = astrometric.radec(equinox)
382384

385+
.. _apparent_ra_dec:
386+
383387
Apparent right ascension and declination
384388
========================================
385389

0 commit comments

Comments
 (0)