Skip to content

Commit ccc5ebd

Browse files
committed
Move Syndyne.plot example up
1 parent 756a62c commit ccc5ebd

1 file changed

Lines changed: 59 additions & 30 deletions

File tree

docs/sbpy/dynamics.rst

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,66 @@ Here is an example that plots the syndynes and synchrones from above as offsets
524524
plt.legend()
525525
plt.tight_layout()
526526

527+
For more complex plot logic, e.g., specific line colors and styles, use the plot methods of the individual syndynes/synchrones:
527528

528-
The following example compares syndynes to a Spitzer Space Telesocpe image of comet 48P/Johnson (`Reach et al. 2007 <https://scixplorer.org/abs/2007Icar..191..298R/abstract>`_). The FITS world coordinate system is used to account for the image orientation and scale. To precisely align the syndynes with the comet nucleus, we update the world coordinate system to use our calculated comet coordinates.
529+
.. doctest-requires:: scipy,astroquery,matplotlib
530+
.. doctest-remote-data::
531+
532+
>>> ls = ["-", "--", "-."]
533+
>>> syndynes = dust.syndynes()
534+
>>> for i in range(3):
535+
... syndynes[i].plot(ax, color="k", ls=ls[i])
536+
537+
.. plot::
538+
:show-source-link:
539+
540+
import numpy as np
541+
import matplotlib.pyplot as plt
542+
543+
import astropy.units as u
544+
from astropy.time import Time
545+
from sbpy.dynamics import State, SynGenerator
546+
547+
# define the dust source
548+
r = [2, 0, 0] * u.au
549+
v = [0, 30, 0] * u.km / u.s
550+
t = Time("2023-12-08")
551+
frame = "heliocentriceclipticiau76"
552+
comet = State(r, v, t, frame=frame)
553+
554+
# define particle parameters
555+
betas = [1, 0.1, 0.01, 0]
556+
ages = np.linspace(0, 100, 25) * u.day
557+
558+
# observe it from a fixed location in the Solar System
559+
observer = State(
560+
r=[0, 2, 2] * u.au,
561+
v=[0, 0, 0] * u.km / u.s,
562+
t=comet.t,
563+
frame="icrs",
564+
)
565+
566+
# define the dust generator
567+
dust = SynGenerator(comet, betas, ages, observer=observer)
568+
569+
# plot syndynes
570+
fig, ax = plt.subplots()
571+
572+
ls = ["-", "--", "-."]
573+
syndynes = dust.syndynes()
574+
for i in range(3):
575+
syndynes[i].plot(ax, color="k", ls=ls[i])
576+
ax.invert_xaxis()
577+
578+
ax.set(ax,
579+
xlim=[100, -10],
580+
ylim=[-10, 100],
581+
xlabel="$\\Delta$RA (arcsec)",
582+
ylabel="$\\Delta$Dec (arcsec)",
583+
)
584+
fig.tight_layout()
585+
586+
The following complete example compares syndynes to a Spitzer Space Telesocpe image of comet 48P/Johnson (`Reach et al. 2007 <https://scixplorer.org/abs/2007Icar..191..298R/abstract>`_). The FITS world coordinate system is used to account for the image orientation and scale. To precisely align the syndynes with the comet nucleus, we update the world coordinate system to use our calculated comet coordinates.
529587

530588
.. note::
531589
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.
@@ -660,35 +718,6 @@ The following example compares syndynes to a Spitzer Space Telesocpe image of co
660718
plt.legend()
661719
plt.tight_layout()
662720

663-
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:
664-
665-
.. doctest-requires:: scipy,astroquery,matplotlib
666-
.. doctest-remote-data::
667-
668-
>>> ls = ["-", "--", "-."]
669-
>>> syndynes = dust.syndynes()
670-
>>> for i in range(3):
671-
... syndynes[i].plot(ax, color="k", ls=ls[i])
672-
673-
.. plot::
674-
:context:
675-
676-
fig, ax = plt.subplots()
677-
678-
ls = ["-", "--", "-."]
679-
syndynes = dust.syndynes()
680-
for i in range(3):
681-
syndynes[i].plot(ax, color="k", ls=ls[i])
682-
ax.invert_xaxis()
683-
684-
plt.setp(ax,
685-
xlim=[100, -10],
686-
ylim=[-10, 100],
687-
xlabel="$\\Delta$RA (arcsec)",
688-
ylabel="$\\Delta$Dec (arcsec)",
689-
)
690-
plt.tight_layout()
691-
692721

693722
Reference/API
694723
=============

0 commit comments

Comments
 (0)