Unexpected behavior when passing `obj_names` to `SDSS.query_region()`
- Dominant language
- Python
- Stars
- 791
- Forks
- 451
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 4
Description
When using `SDSS.query_region()`, passing a list of names with the `obj_names` parameter does not perform as described in the [documentation](https://astroquery.readthedocs.io/en/latest/api/astroquery.sdss.SDSSClass.html#astroquery.sdss.SDSSClass.query_region). The documentation says the names passed in will be repeated in the query result, but the names are not included in the resulting tables. A minimum working example is shown below:
```python
from astroquery.sdss import SDSS
from astropy.coordinates import SkyCoord
# Define Source names and coordinates
names = ['Source1','Source2','Source3']
ra = [154.051772, 154.129982, 154.001069]
dec = [1.939617, 1.974458, 2.194234]
coord = SkyCoord(
ra=ra, dec=dec, unit=['deg','deg']
)
# Perform Cross match
xids = SDSS.query_region(
coord,
obj_names = names,
radius = '2.0 arcsec',
spectro = True
)
```
This query results in the following table, which does not contain a column that indicates the matching input source name:
| | ra | dec | objid | run | rerun | camcol | field | z | plate | mjd | fiberID | specobjid | run2d |
|---:|--------:|--------:|------------:|------:|--------:|---------:|--------:|----------:|--------:|------:|----------:|------------:|--------:|
| 0 | 154.052 | 1.93962 | 1.23765e+18 | 1907 | 301 | 3 | 210 | 0.0706007 | 502 | 51957 | 636 | 5.65377e+17 | 26 |
| 1 | 154.13 | 1.97446 | 1.23765e+18 | 1907 | 301 | 3 | 210 | 1.62504 | 502 | 51957 | 635 | 5.65376e+17 | 26 |
| 2 | 154.001 | 2.19423 | 1.23765e+18 | 1462 | 301 | 4 | 191 | 0.101115 | 502 | 51957 | 632 | 5.65376e+17 | 26 |
Having the capability to return the object names associated with each query is a very useful feature as it helps cut down on additional cross-matching that would be needed to associate each returned object with objects in the input coordinate list. I tried digging into the source code to identify a fix, but it was unclear to me how the `obj_names` parameter is being passed to the ```requests.request()``` function.
I am using python 3.11.9, astroquery v0.4.7 , astropy v6.1.0, and requests v2.32.2
Contributor guide
Research direction
Start at SDSS.query_region() and compare its obj_names handling with the linked API documentation, using the provided minimum working example to reproduce the missing source-name column. Trace how obj_names reaches the request and verify that the returned table includes the corresponding names for each input coordinate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100