astropy / astropy/astroquery

astroquery.heasarch should parse units and preferably return a QTable

Open
#2,333 2 comments 0 reactions 0 assignees View on GitHub
bug heasarc
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

The following code snippet gives the below warning about capitalized units:

```
from astropy.coordinates import SkyCoord
import astropy.units as u
from astroquery.heasarc import Heasarc

coords = SkyCoord('150.01d 2.2d', frame='icrs') #COSMOS center acording to Simbad
#first get an X-ray catalog from Heasarc
heasarc = Heasarc()
table = heasarc.query_mission_list()
mask = (table['Mission'] =="CHANDRA")
chandratable = table[mask]

#want ccosmoscat
mission = 'ccosmoscat'
ccosmoscat_rad = 1 #radius of chandra cosmos catalog
ccosmoscat = heasarc.query_region(coords, mission=mission, radius='1 degree', resultmax = 5000, fields = "ALL")

#need to make the chandra catalog into a fits table
ccosmoscat.write('/tmp/COSMOS_chandra.fits', overwrite = "True")
```

```
WARNING: UnitsWarning: 'DEGREE' did not parse as fits unit: At col 0, Unit 'DEGREE' not supported by the FITS standard. If this is meant to be a custom unit, define it with 'u.def_unit'. To have it recognized inside a file reader or other code, enable it with 'u.add_enabled_units'. For details, see https://docs.astropy.org/en/latest/units/combining_and_defining.html [astropy.units.core]
```

Contributor guide

Open the contributing guide

Research direction

The payload names no source file or test. Start by reproducing the example through Heasarc.query_region, then trace how its radius and returned table are handled. Done means the requested unit parses without the capitalized-unit warning and the result meets the requested QTable behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.