Skip to content

Commit e6c4b3e

Browse files
committed
Mark doctests with REMOTE_DATA
1 parent f3b20fa commit e6c4b3e

1 file changed

Lines changed: 29 additions & 33 deletions

File tree

docs/sbpy/dynamics.rst

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ Convert to/from `Ephem` and `SkyCoord`
5656
State objects may be initialized from ephemeris objects (`~sbpy.data.Ephem`), provided they contain time, and 3D position and velocity:
5757

5858
.. doctest-requires:: astroquery
59-
.. doctest-remote-data::
6059

6160
>>> from sbpy.data import Ephem
6261
>>> eph = Ephem.from_horizons("9P",
@@ -68,7 +67,6 @@ State objects may be initialized from ephemeris objects (`~sbpy.data.Ephem`), pr
6867
And `State` may be converted to an `Ephem` object:
6968

7069
.. doctest-requires:: astroquery
71-
.. doctest-remote-data::
7270

7371
>>> eph = tempel1.to_ephem() # doctest: +REMOTE_DATA
7472

@@ -176,17 +174,16 @@ Fetching states from Horizons
176174
`Ephem.from_horizons` returns equatorial coordinates in the ICRF reference frame, which has its origin at the Solar System barycenter. For `State` to correctly convert the ephemeris object to vectors, we need to set the Horizons observer to the Solar System barycenter (``"@ssb"``). However, dynamical integrations are done in a heliocentric reference frame, so we transform the result to ``"heliocentriceclipticiau76"``:
177175

178176
.. doctest-requires:: astroquery
179-
.. doctest-remote-data::
180177

181178
>>> eph = Ephem.from_horizons(
182179
... "48P",
183180
... id_type="designation",
184181
... closest_apparition=True,
185182
... epochs=Time("2004-10-13T21:08:23.894"),
186183
... location="@ssb",
187-
... )
188-
>>> comet = State.from_ephem(eph, frame="icrs")
189-
>>> comet = comet.transform_to("heliocentriceclipticiau76")
184+
... ) # doctest: +REMOTE_DATA
185+
>>> comet = State.from_ephem(eph, frame="icrs") # doctest: +REMOTE_DATA
186+
>>> comet = comet.transform_to("heliocentriceclipticiau76") # doctest: +REMOTE_DATA
190187

191188

192189
Dynamical integrators
@@ -499,13 +496,12 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
499496
The `sbpy` testing suite shows that arcsecond-level accuracy is possible, but this is generally not enough for direct comparison to typical images of comets, which need sub-arcsecond alignment. The accuracy of the coordinates object depends on the the comet and observer states, but also on whether or not light travel time is accounted for, and the accuracy of the orbit integrator.
500497

501498
.. doctest-requires:: scipy,astroquery,matplotlib
502-
.. doctest-remote-data::
503499

504500
>>> from astropy.io import fits
505501
>>> from astropy.wcs import WCS
506502
>>>
507-
>>> image, header = fits.getdata("https://sbpy.org/data/48p-spitzer-reach07.fits", header=True)
508-
>>> obstime = Time(header["DATE_OBS"])
503+
>>> image, header = fits.getdata("https://sbpy.org/data/48p-spitzer-reach07.fits", header=True) # doctest: +REMOTE_DATA
504+
>>> obstime = Time(header["DATE_OBS"]) # doctest: +REMOTE_DATA
509505
>>>
510506
>>> # get the comet state
511507
>>> eph = Ephem.from_horizons(
@@ -514,44 +510,44 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
514510
... closest_apparition=True,
515511
... epochs=obstime,
516512
... location="@ssb",
517-
... )
518-
>>> comet = State.from_ephem(eph, frame="icrs")
519-
>>> comet = comet.transform_to("heliocentriceclipticiau76")
513+
... ) # doctest: +REMOTE_DATA
514+
>>> comet = State.from_ephem(eph, frame="icrs") # doctest: +REMOTE_DATA
515+
>>> comet = comet.transform_to("heliocentriceclipticiau76") # doctest: +REMOTE_DATA
520516
>>>
521517
>>> # get the Spitzer Space Telescope state
522-
>>> eph = Ephem.from_horizons("-79", id_type=None, epochs=obstime, location="@ssb")
523-
>>> observer = State.from_ephem(eph, frame="icrs")
518+
>>> eph = Ephem.from_horizons("-79", id_type=None, epochs=obstime, location="@ssb") # doctest: +REMOTE_DATA
519+
>>> observer = State.from_ephem(eph, frame="icrs") # doctest: +REMOTE_DATA
524520
>>>
525521
>>> # set up the world coordinate system object and update the origin to align with
526522
>>> # the calculated position of the comet
527-
>>> wcs = WCS(header)
528-
>>> coords0 = observer.observe(comet)[0].unmasked
529-
>>> wcs.wcs.crval = coords0.ra.deg, coords0.dec.deg
530-
>>> wcs.wcs.crpix = 209, 99
523+
>>> wcs = WCS(header) # doctest: +REMOTE_DATA
524+
>>> coords0 = observer.observe(comet)[0].unmasked # doctest: +REMOTE_DATA
525+
>>> wcs.wcs.crval = coords0.ra.deg, coords0.dec.deg # doctest: +REMOTE_DATA
526+
>>> wcs.wcs.crpix = 209, 99 # doctest: +REMOTE_DATA
531527
>>>
532528
>>> # generate the syndynes
533-
>>> betas = [1, 0.1, 0.01, 0.001]
534-
>>> ages = np.linspace(0, 365, 51) * u.day
535-
>>> dust = SynGenerator(comet[0], betas, ages, observer=observer[0])
529+
>>> betas = [1, 0.1, 0.01, 0.001] # doctest: +REMOTE_DATA
530+
>>> ages = np.linspace(0, 365, 51) * u.day # doctest: +REMOTE_DATA
531+
>>> dust = SynGenerator(comet[0], betas, ages, observer=observer[0]) # doctest: +REMOTE_DATA
536532
>>>
537533
>>> # plot the image and syndynes
538-
>>> fig, ax = plt.subplots(num=1, clear=True, figsize=(6.5, 3.25))
534+
>>> fig, ax = plt.subplots(num=1, clear=True, figsize=(6.5, 3.25)) # doctest: +REMOTE_DATA
539535
>>>
540-
>>> ax.imshow(image, origin="lower", vmin=49.1, vmax=49.5, cmap="gray_r") # doctest: +SKIP
536+
>>> ax.imshow(image, origin="lower", vmin=49.1, vmax=49.5, cmap="gray_r") # doctest: +SKIP +REMOTE_DATA
541537
>>>
542538
>>> # save xlim and ylim for later
543-
>>> xlim = ax.get_xlim()
544-
>>> ylim = ax.get_ylim()
539+
>>> xlim = ax.get_xlim() # doctest: +REMOTE_DATA
540+
>>> ylim = ax.get_ylim() # doctest: +REMOTE_DATA
545541
>>>
546542
>>> # plot syndynes
547-
>>> dust.syndynes().plot(ax, wcs=wcs)
543+
>>> dust.syndynes().plot(ax, wcs=wcs) # doctest: +REMOTE_DATA
548544
>>>
549545
>>> # plot the orbit
550-
>>> dt = np.linspace(-1, 1) * u.d
551-
>>> dust.source_orbit(dt).plot(ax, wcs=wcs, color="tab:cyan", lw=1, label="Orbit")
546+
>>> dt = np.linspace(-1, 1) * u.d # doctest: +REMOTE_DATA
547+
>>> dust.source_orbit(dt).plot(ax, wcs=wcs, color="tab:cyan", lw=1, label="Orbit") # doctest: +REMOTE_DATA
552548
>>>
553-
>>> plt.setp(ax, xlim=xlim, ylim=ylim) # doctest: +SKIP
554-
>>> plt.legend() # doctest: +SKIP
549+
>>> plt.setp(ax, xlim=xlim, ylim=ylim) # doctest: +SKIP +REMOTE_DATA
550+
>>> plt.legend() # doctest: +SKIP # doctest: +REMOTE_DATA
555551

556552
.. plot::
557553
:show-source-link:
@@ -626,12 +622,12 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
626622

627623
For more complex plot logic, e.g., to use specific line colors and styles, we can use the plot methods of the individual syndynes/synchrones:
628624

629-
.. doctest-requires:: scipy,matplotlib
625+
.. doctest-requires:: scipy,astroquery,matplotlib
630626

631627
>>> ls = ["-", "--", "-."]
632-
>>> syndynes = dust.syndynes()
628+
>>> syndynes = dust.syndynes() # doctest: +REMOTE_DATA
633629
>>> for i in range(3):
634-
... syndynes[i].plot(ax, color="k", ls=ls[i])
630+
... syndynes[i].plot(ax, color="k", ls=ls[i]) # doctest: +REMOTE_DATA
635631

636632
.. plot::
637633
:context:

0 commit comments

Comments
 (0)