5 - Creating a Basic Optic Plot


Tutorial - Map Plot

Starplot also has optic plots, which simulate what you'll see through an optic (e.g. binoculars, telescope, camera) at a specific time and location. The simulated view will show you the true field of view for the optic, and it will even orient the stars based on the location you specify and the most logical position of your optic.

Optic plots work very similar to map plots, with a few key differences: they always require a date/time and location, and they also require an optic.

For example, here's how you'd create an optic plot of the The Pleiades (M45), viewed through 10x binoculars at 9pm PT on April 8, 2024 from Palomar Mountain:

from datetime import datetime
from pytz import timezone
from starplot import OpticPlot, DSO, _
from starplot.optics import Binoculars
from starplot.styles import PlotStyle, extensions

dt = datetime.now(timezone("US/Pacific")).replace(2024, 4, 8, 21, 0, 0)

style = PlotStyle().extend(
    extensions.GRAYSCALE_DARK,
    extensions.OPTIC,
)

m45 = DSO.get(m="45")  # lookup The Pleiades (M45)

p = OpticPlot(
    # target location via the DSO model instance
    ra=m45.ra,
    dec=m45.dec,
    # observer location - Palomar Mountain
    lat=33.363484,
    lon=-116.836394,
    # define the optic - 15x binoculars with a 65 degree field of view
    optic=Binoculars(
        magnification=15,
        fov=65,
    ),
    dt=dt,
    style=style,
    resolution=2048,
    autoscale=True,
)
p.stars(where=[_.magnitude < 12])

p.export("tutorial_05.png", padding=0.1, transparent=True)

The first 12 lines should look familiar from the other plots we've created in this tutorial.

On line 14, we use a powerful feature of Starplot: looking up an object and then using that object's properties to help us create the plot. In this example, we look up The Pleiades open cluster by calling the get function on the DSO model. This function returns an instance of the DSO model, which has various properties of the object, including it's position (RA/Dec).

On line 16, we create the OpticPlot, using properties from the m45 model we just retrieved. Most of the kwargs are the same as the map plot's kwargs, except for the following:

  • ra: Right ascension of the target
  • dec: Declination of the target
  • optic: An instance of an optic. This example uses binoculars, but Starplot also supports refractor/reflector telescopes, generic scopes, and cameras.

The ra/dec you specify for the target will be the center of the plot.

In the next section, we'll learn how to be more selective of objects to plot...