Skip to content

Commit 8327d22

Browse files
committed
Back to using doctest-remote-data
1 parent a79cc71 commit 8327d22

1 file changed

Lines changed: 34 additions & 29 deletions

File tree

docs/sbpy/dynamics.rst

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,21 @@ 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::
5960

6061
>>> from sbpy.data import Ephem
6162
>>> eph = Ephem.from_horizons("9P",
6263
... epochs=Time("2005-07-04"),
6364
... id_type="designation",
64-
... closest_apparition=True) # doctest: +REMOTE_DATA
65-
>>> tempel1 = State.from_ephem(eph) # doctest: +REMOTE_DATA
65+
... closest_apparition=True)
66+
>>> tempel1 = State.from_ephem(eph)
6667

6768
And `State` may be converted to an `Ephem` object:
6869

6970
.. doctest-requires:: astroquery
71+
.. doctest-remote-data::
7072

71-
>>> eph = tempel1.to_ephem() # doctest: +REMOTE_DATA
73+
>>> eph = tempel1.to_ephem()
7274

7375
`astropy`'s `~astropy.coordinates.SkyCoord` objects may also be used, assuming the time and 3D vectors are fully defined:
7476

@@ -174,16 +176,17 @@ Fetching states from Horizons
174176
`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"``:
175177

176178
.. doctest-requires:: astroquery
179+
.. doctest-remote-data::
177180

178181
>>> eph = Ephem.from_horizons(
179182
... "48P",
180183
... id_type="designation",
181184
... closest_apparition=True,
182185
... epochs=Time("2004-10-13T21:08:23.894"),
183186
... location="@ssb",
184-
... ) # doctest: +REMOTE_DATA
185-
>>> comet = State.from_ephem(eph, frame="icrs") # doctest: +REMOTE_DATA
186-
>>> comet = comet.transform_to("heliocentriceclipticiau76") # doctest: +REMOTE_DATA
187+
... )
188+
>>> comet = State.from_ephem(eph, frame="icrs")
189+
>>> comet = comet.transform_to("heliocentriceclipticiau76")
187190

188191

189192
Dynamical integrators
@@ -496,12 +499,13 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
496499
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.
497500

498501
.. doctest-requires:: scipy,astroquery,matplotlib
502+
.. doctest-remote-data::
499503

500504
>>> from astropy.io import fits
501505
>>> from astropy.wcs import WCS
502506
>>>
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
507+
>>> image, header = fits.getdata("https://sbpy.org/data/48p-spitzer-reach07.fits", header=True)
508+
>>> obstime = Time(header["DATE_OBS"])
505509
>>>
506510
>>> # get the comet state
507511
>>> eph = Ephem.from_horizons(
@@ -510,41 +514,41 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
510514
... closest_apparition=True,
511515
... epochs=obstime,
512516
... location="@ssb",
513-
... ) # doctest: +REMOTE_DATA
514-
>>> comet = State.from_ephem(eph, frame="icrs") # doctest: +REMOTE_DATA
515-
>>> comet = comet.transform_to("heliocentriceclipticiau76") # doctest: +REMOTE_DATA
517+
... )
518+
>>> comet = State.from_ephem(eph, frame="icrs")
519+
>>> comet = comet.transform_to("heliocentriceclipticiau76")
516520
>>>
517521
>>> # get the Spitzer Space Telescope state
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
522+
>>> eph = Ephem.from_horizons("-79", id_type=None, epochs=obstime, location="@ssb")
523+
>>> observer = State.from_ephem(eph, frame="icrs")
520524
>>>
521525
>>> # set up the world coordinate system object and update the origin to align with
522526
>>> # the calculated position of the comet
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
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
527531
>>>
528532
>>> # generate the syndynes
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
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])
532536
>>>
533537
>>> # plot the image and syndynes
534-
>>> fig, ax = plt.subplots(num=1, clear=True, figsize=(6.5, 3.25)) # doctest: +REMOTE_DATA
538+
>>> fig, ax = plt.subplots(num=1, clear=True, figsize=(6.5, 3.25))
535539
>>>
536-
>>> ax.imshow(image, origin="lower", vmin=49.1, vmax=49.5, cmap="gray_r") # doctest: +SKIP +REMOTE_DATA
540+
>>> ax.imshow(image, origin="lower", vmin=49.1, vmax=49.5, cmap="gray_r") # docte
537541
>>>
538542
>>> # save xlim and ylim for later
539-
>>> xlim = ax.get_xlim() # doctest: +REMOTE_DATA
540-
>>> ylim = ax.get_ylim() # doctest: +REMOTE_DATA
543+
>>> xlim = ax.get_xlim()
544+
>>> ylim = ax.get_ylim()
541545
>>>
542546
>>> # plot syndynes
543-
>>> dust.syndynes().plot(ax, wcs=wcs) # doctest: +REMOTE_DATA
547+
>>> dust.syndynes().plot(ax, wcs=wcs)
544548
>>>
545549
>>> # plot the 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
550+
>>> dt = np.linspace(-1, 1) * u.d
551+
>>> dust.source_orbit(dt).plot(ax, wcs=wcs, color="tab:cyan", lw=1, label="Orbit")
548552
>>>
549553
>>> plt.setp(ax, xlim=xlim, ylim=ylim) # doctest: +SKIP
550554
>>> plt.legend() # doctest: +SKIP
@@ -623,11 +627,12 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
623627
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:
624628

625629
.. doctest-requires:: scipy,astroquery,matplotlib
630+
.. doctest-remote-data::
626631

627632
>>> ls = ["-", "--", "-."]
628-
>>> syndynes = dust.syndynes() # doctest: +REMOTE_DATA
633+
>>> syndynes = dust.syndynes()
629634
>>> for i in range(3):
630-
... syndynes[i].plot(ax, color="k", ls=ls[i]) # doctest: +REMOTE_DATA
635+
... syndynes[i].plot(ax, color="k", ls=ls[i])
631636

632637
.. plot::
633638
:context:

0 commit comments

Comments
 (0)