Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

astroquery.heasarch should parse units and preferably return a QTable #2333

Open
jkrick opened this issue Mar 23, 2022 · 2 comments
Open

astroquery.heasarch should parse units and preferably return a QTable #2333

jkrick opened this issue Mar 23, 2022 · 2 comments

Comments

@jkrick
Copy link

jkrick commented Mar 23, 2022

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]
@bsipocz
Copy link
Member

bsipocz commented Mar 29, 2022

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
Copy link
Member

bsipocz commented Oct 23, 2024

The capitalization issue is gone now, but we still have the warning about erg/s/cm^2 with the message UnitsWarning: 'erg/s/cm^2' contains multiple slashes, which is discouraged by the FITS standard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants