astroquery icon indicating copy to clipboard operation
astroquery copied to clipboard

astroquery.heasarch should parse units and preferably return a QTable

Open jkrick opened this issue 3 years ago • 2 comments

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]

jkrick avatar Mar 23 '22 23:03 jkrick

Unfortunately, it seems that the input fits file doesn't follow the fits standard for multiple units. I think we should add the an alternate dictionary in our parsing method, but I'll follow-up first with

Adding all the UnitWarnings here:

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]
WARNING: UnitsWarning: 'CT/S' did not parse as fits unit: At col 0, Unit 'CT' not supported by the FITS standard. Did you mean cT or ct? 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]
WARNING: UnitsWarning: 'ERG/S/CM^2' did not parse as fits unit: At col 0, Unit 'ERG' not supported by the FITS standard. Did you mean EG, ER, Eg or erg? 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]
WARNING: UnitsWarning: 'CT' did not parse as fits unit: At col 0, Unit 'CT' not supported by the FITS standard. Did you mean cT or ct? 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]
WARNING: UnitsWarning: 'ARCSEC' did not parse as fits unit: At col 0, Unit 'ARCSEC' not supported by the FITS standard. Did you mean arcsec? 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]

bsipocz avatar Mar 29 '22 10:03 bsipocz