Skip to content

Commit aba77e3

Browse files
authored
Merge pull request #2218 from bsipocz/nasa_exoplanet_archive_fix_units
Add more units to nasa_exoplanet_archive unit mapper
2 parents 4c7b652 + 0bc3021 commit aba77e3

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

astroquery/ipac/nexsci/nasa_exoplanet_archive/core.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,31 @@
4444
"Fearth": u.L_sun / (4 * np.pi * u.au**2),
4545
"M_E": u.M_earth,
4646
"Earth Mass": u.M_earth,
47+
"Mearth": u.M_earth,
4748
"M_J": u.M_jupiter,
49+
"Mjupiter": u.M_jupiter,
4850
"Jupiter Mass": u.M_jupiter,
4951
"R_Earth": u.R_earth, # Add u.R_jupiter
52+
"Rearth": u.R_earth,
5053
"Earth Radius": u.R_earth,
5154
"Jupiter Radius": u.R_jupiter,
55+
"Rjupiter": u.R_jupiter,
56+
"Searth": u.L_sun / (4 * np.pi * u.au**2),
5257
"R_Sun": u.R_sun,
5358
"Rstar": u.R_sun,
5459
"a_perp": u.au,
5560
"arc-sec/year": u.arcsec / u.yr,
5661
"cm/s**2": u.cm / u.s ** 2,
5762
"g/cm**3": u.g / u.cm ** 3,
63+
"day": u.day,
5864
"days": u.day,
5965
"degrees": u.deg,
6066
"dexincgs": u.dex(u.cm / u.s ** 2),
6167
"hours": u.hr,
6268
"hrs": u.hr,
6369
"kelvin": u.K,
6470
"logLsun": u.dex(u.L_sun),
71+
"log(Lsun)": u.dex(u.L_sun),
6572
"log(Solar)": u.dex(u.L_sun),
6673
"mags": u.mag,
6774
"microas": u.uas,
@@ -76,6 +83,7 @@
7683
"solarradius": u.R_sun,
7784
"Solar Radius": u.R_sun,
7885
"log10(cm/s**2)": u.dex(u.cm / u.s ** 2),
86+
"log(cm/s**2)": u.dex(u.cm / u.s ** 2),
7987
"dex": u.dex(None),
8088
"sexagesimal": None
8189
}
@@ -521,7 +529,7 @@ def _fix_units(self, data):
521529
unit = u.mag
522530

523531
else: # pragma: nocover
524-
warnings.warn("Unrecognized unit: '{0}'".format(unit), AstropyWarning)
532+
warnings.warn(f"Unrecognized unit: '{unit}' for column {col}.", AstropyWarning)
525533

526534
# Unmask since astropy doesn't like masked values in columns with units
527535
try:

docs/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ These others are functional, but do not follow a common & consistent API:
228228
jplhorizons/jplhorizons.rst
229229
jplsbdb/jplsbdb.rst
230230
lamda/lamda.rst
231-
ipac/nasa_exoplanet_archive/nasa_exoplanet_archive.rst
231+
ipac/nexsci/nasa_exoplanet_archive.rst
232232
oac/oac.rst
233233
ogle/ogle.rst
234234
open_exoplanet_catalogue/open_exoplanet_catalogue.rst
@@ -265,7 +265,7 @@ for each source)
265265
ipac/irsa/irsa.rst
266266
ipac/irsa/irsa_dust/irsa_dust.rst
267267
mast/mast.rst
268-
ipac/nasa_exoplanet_archive/nasa_exoplanet_archive.rst
268+
ipac/nexsci/nasa_exoplanet_archive.rst
269269
ipac/ned/ned.rst
270270
ogle/ogle.rst
271271
open_exoplanet_catalogue/open_exoplanet_catalogue.rst

docs/ipac/nasa_exoplanet_archive/nasa_exoplanet_archive.rst renamed to docs/ipac/nexsci/nasa_exoplanet_archive.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ For example, a full table can be queried as follows:
7575
<QTable masked=True length=9564>
7676
kepid kepoi_name kepler_name ... koi_fittype koi_score sky_coord
7777
... deg,deg
78-
int64 str9 str15 ... str7 float64 object
78+
int64 str9 str14 ... str7 float64 object
7979
-------- ---------- ------------ ... ----------- --------- -------------------
8080
10797460 K00752.01 Kepler-227 b ... LS+MCMC 1.0 291.93423,48.141651
8181
10797460 K00752.02 Kepler-227 c ... LS+MCMC 0.969 291.93423,48.141651
@@ -99,33 +99,31 @@ In this section, we demonstrate
9999

100100
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
101101
>>> NasaExoplanetArchive.query_criteria(table="pscomppars", select="count(*)",
102-
... where="disc_facility like '%TESS%'")
102+
... where="disc_facility like '%TESS%'") # doctest: +IGNORE_OUTPUT
103103
<QTable masked=True length=1>
104104
count(*)
105105
int32
106106
--------
107107
131
108108

109109

110-
2. The list of confirmed planets discovered by TESS and their host star coordinates:
110+
2. The list of 10 confirmed planets discovered by TESS and their host star coordinates:
111111

112112
.. doctest-remote-data::
113113

114114
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
115-
>>> NasaExoplanetArchive.query_criteria(table="pscomppars", select="pl_name,ra,dec",
115+
>>> NasaExoplanetArchive.query_criteria(table="pscomppars", select="top 10 pl_name,ra,dec",
116116
... where="disc_facility like '%TESS%'")
117-
<QTable masked=True length=131>
117+
<QTable masked=True length=10>
118118
pl_name ra dec sky_coord
119119
deg deg deg,deg
120-
str15 float64 float64 object
120+
str13 float64 float64 object
121121
------------- ----------- ----------- -----------------------
122122
WD 1856+534 b 284.415675 53.5090244 284.415675,53.5090244
123+
TOI-1201 b 42.2476999 -14.5372835 42.2476999,-14.5372835
123124
HD 213885 b 338.9837166 -59.864829 338.9837166,-59.864829
124125
HD 219666 b 349.5592665 -56.9039857 349.5592665,-56.9039857
125126
... ... ... ...
126-
TOI-257 b 47.5172608 -50.8322632 47.5172608,-50.8322632
127-
HD 5278 b 12.5467785 -83.7437671 12.5467785,-83.7437671
128-
LHS 1478 b 44.3388743 76.5514045 44.3388743,76.5514045
129127

130128

131129
3. The list of confirmed planets discovered using microlensing that have data available in the archive:
@@ -134,7 +132,7 @@ In this section, we demonstrate
134132

135133
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
136134
>>> NasaExoplanetArchive.query_criteria(
137-
... table="pscomppars", where="discoverymethod like 'Microlensing'")
135+
... table="pscomppars", where="discoverymethod like 'Microlensing'") # doctest: +IGNORE_OUTPUT
138136
<QTable masked=True length=108>
139137
pl_name pl_letter ... htm20 sky_coord
140138
... deg,deg
@@ -158,7 +156,7 @@ In this section, we demonstrate
158156
>>> from astroquery.ipac.nexsci.nasa_exoplanet_archive import NasaExoplanetArchive
159157
>>> NasaExoplanetArchive.query_criteria(
160158
... table="pscomppars", where="hostname like 'Kepler%'", order="hostname")
161-
<QTable masked=True length=2369>
159+
<QTable masked=True length=2370>
162160
pl_name pl_letter hostname ... htm20 sky_coord
163161
... deg,deg
164162
str14 str1 str12 ... int32 object

0 commit comments

Comments
 (0)