Skip to content

Commit 3e147f6

Browse files
m-stclaireerovaher
andauthored
apply @eerovaher 's suggestions
Co-authored-by: Eero Vaher <[email protected]>
1 parent 671f8a3 commit 3e147f6

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

astroquery/jplhorizons/core.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,7 +1045,7 @@ def vectors_async(self, *, get_query_payload=False,
10451045
if self.id is None:
10461046
raise ValueError("'id' parameter not set. Query aborted.")
10471047
elif isinstance(self.id, dict):
1048-
commandline = f"g:{self.id['lon']},{self.id['lat']},{self.id['elevation']}@{self.id['body']}"
1048+
commandline = "g:{lon},{lat},{elevation}@{body}".format(**self.id)
10491049
else:
10501050
commandline = str(self.id)
10511051
if self.location is None:
@@ -1144,7 +1144,7 @@ def vectors_async(self, *, get_query_payload=False,
11441144
@staticmethod
11451145
def _prep_loc_dict(loc_dict, attr_name):
11461146
"""prepare coord specification dict for 'location' or 'id'"""
1147-
if {'lat', 'lon', 'elevation'} - set(loc_dict.keys()) != set():
1147+
if {'lat', 'lon', 'elevation'} - loc_dict.keys():
11481148
raise ValueError(
11491149
f"dict values for '{attr_name}' must contain 'lat', 'lon', "
11501150
"'elevation' (and optionally 'body')"
@@ -1221,10 +1221,7 @@ def _parse_result(self, response, verbose=None):
12211221
"Date__(UT)__HR:MN" in line):
12221222
headerline = str(line).split(',')
12231223
headerline[2] = 'solar_presence'
1224-
if 'Earth' in centername:
1225-
headerline[3] = 'lunar_presence'
1226-
else:
1227-
headerline[3] = 'interfering_body'
1224+
headerline[3] = "lunar_presence" if "Earth" in centername else "interfering_body"
12281225
headerline[-1] = '_dump'
12291226
if isinstance(self.id, dict) or str(self.id).startswith('g:'):
12301227
headerline[4] = 'nearside_flag'

docs/jplhorizons/jplhorizons.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ at a particular point in time to the center of the crater Double:
121121
>>> obj = Horizons(id=double, location=ce_2, epochs=2454483.84247)
122122
>>> vecs = obj.vectors()
123123
>>> distance_km = (vecs['x'] ** 2 + vecs['y'] ** 2 + vecs['z'] ** 2) ** 0.5 * 1.496e8
124-
>>> print(round(distance_km.value.data[0], 3))
124+
>>> print(f"{distance_km.value.data[0]:.3f}")
125125
181.213
126126

127127
``epochs`` is either a scalar or list of Julian dates (floats or strings) in the

0 commit comments

Comments
 (0)