Skip to content

OpticPlot with Camera failing for wide angle focal lengths #195

@pbljung

Description

@pbljung

Beautiful tutorial plots!

Describe the bug
I modified tutorial_05 to use
Camera(lens_focal_length=50, sensor_width=36, sensor_height=24)
instead of Binoculars().

However this fails complaining
ValueError: Field of View too big: 39.597752709049864 (max = 9.0)

However it does work if I use lens_focal_length > 300 but I want to use a wide angle lens.

To Reproduce
`from datetime import datetime
from zoneinfo import ZoneInfo

from starplot import OpticPlot, Observer, DSO, _
from starplot.models import Binoculars, Camera
from starplot.styles import PlotStyle, extensions

tz = ZoneInfo("US/Pacific")
dt = datetime(2024, 4, 8, 21, 0, 0, tzinfo=tz)

observer = Observer(
dt=dt,
lat=33.363484, # Palomar Mountain
lon=-116.836394,
)

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

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

binoculars = Binoculars( magnification=15, fov=65,)

camera = Camera(
#lens_focal_length=300, # OK
lens_focal_length=50, # FAILS
sensor_width=36, # in mm
sensor_height=24, # in mm
)

p = OpticPlot(
observer=observer,
# target location via the DSO model instance
ra=m45.ra,
dec=m45.dec,
#optic=binoculars, # OK
optic=camera, # FAILS
style=style,
resolution=2048,
#autoscale=True,
)
p.stars(where=[_.magnitude < 12])

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

Expected behavior
A plot should be generated similar to the tutorial_05.png

Screenshots
NA

Environment Details (please complete the following information):

  • Starplot version 0.17.1
  • Python version Python 3.10.11
  • Matplotlib version 3.10.7
  • OS: [e.g. macOS, Ubuntu, Windows, etc] macOS 15.7.2

Additional context
NA

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions