Skip to content

Bug: plot_finder_image passes unsupported grid argument to SkyView.get_images() #637

Description

@spider65

Description
When calling plot_finder_image(), astroplan internally passes a grid keyword argument to astroquery.skyview.SkyView.get_images(). This argument is no longer accepted by the current version of astroquery, causing a TypeError.
Environment
astroplan version: 0.10.1
astroquery version: 0.4.11
astropy version: 6.x
Python version: 3.12
OS: Linux (Raspberry Pi OS / Ubuntu)
Steps to reproduce

from astroplan import FixedTarget
from astroplan.plots import plot_finder_image
from astropy.coordinates import SkyCoord
import astropy.units as u

coord = SkyCoord(ra=16.52 * u.deg, dec=47.78 * u.deg, frame='icrs')
target = FixedTarget(name='Test', coord=coord)
ax, hdu = plot_finder_image(target, fov_radius=30 * u.arcmin, survey="DSS")

Error

TypeError: SkyViewClass.get_images() got an unexpected keyword argument 'grid'

Root cause
In astroplan/plots/finder.py, the function plot_finder_image calls SkyView.get_images() with a grid=grid keyword argument:

images = SkyView.get_images(..., grid=grid, ...)

The grid parameter has been removed from SkyView.get_images() in recent versions of astroquery and is no longer a valid argument.
Workaround
Removing grid=grid from the SkyView.get_images() call in astroplan/plots/finder.py resolves the issue.
Alternatively, pinning astroquery to a version that still accepts the grid parameter works around the problem, but is not a sustainable solution.
Suggested fix
Remove the grid parameter from the SkyView.get_images() call in astroplan/plots/finder.py, or check for its availability before passing it:

# Option 1 — simply remove it
images = SkyView.get_images(...)

# Option 2 — check availability
import inspect
skyview_params = inspect.signature(SkyView.get_images).parameters
if 'grid' in skyview_params:
    images = SkyView.get_images(..., grid=grid, ...)
else:
    images = SkyView.get_images(...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions