astropy / astropy/astroplan

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

Open Beginner friendly
#637 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
225
Forks
121
Avg merge
28m
Merged PRs (30d)
1

Description

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
```python
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:
```python
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:
```python
# 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(...)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Open astroplan/plots/finder.py and inspect the SkyView.get_images call inside plot_finder_image. Run the issue's reproduction with the current astroquery, then verify that the finder image is created without the unexpected-keyword TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.