Skip to content

Commit a438f18

Browse files
committed
pep8
1 parent cbddbd0 commit a438f18

File tree

7 files changed

+153
-172
lines changed

7 files changed

+153
-172
lines changed

astroquery/esa/neocc/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ def query_object(name, tab, **kwargs):
505505

506506
if not isinstance(neocc_obj, list):
507507
neocc_obj = [neocc_obj]
508-
508+
509509
return neocc_obj
510510

511511

astroquery/esa/neocc/lists.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def parse_risk(resp_str):
192192

193193
if "Years" in neocc_lst.colnames:
194194
first_year, last_year = np.array([x.split("-") for x in neocc_lst["Years"]]).swapaxes(0, 1).astype(int)
195-
yr_index = neocc_lst.index_column("Years")
195+
yr_index = neocc_lst.index_column("Years")
196196
neocc_lst.remove_column("Years")
197197
neocc_lst.add_column(Column(name="Last Year", data=last_year), index=yr_index)
198198
neocc_lst.add_column(Column(name="First Year", data=first_year), index=yr_index)
@@ -264,9 +264,8 @@ def parse_pri(resp_str):
264264
names=['Priority', 'Object', 'R.A. in arcsec', 'Decl. in deg',
265265
'Elong. in deg', 'V in mag', 'Sky uncert.', 'End of Visibility'])
266266

267-
neocc_lst["Object"] = [x.replace(' ','') for x in neocc_lst["Object"]]
267+
neocc_lst["Object"] = [x.replace(' ', '') for x in neocc_lst["Object"]]
268268
neocc_lst['End of Visibility'] = Time.strptime(neocc_lst['End of Visibility'], '%Y/%m/%d')
269-
270269

271270
neocc_lst.meta = {'Priority': '0=UR: Urgent, 1=NE: Necessary, 2=US: Useful, 3=LP: Low Priority',
272271
'Object': 'designator of the object',

astroquery/esa/neocc/tabs.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -319,12 +319,12 @@ def _parse_opt_obs(optical_str):
319319
"""
320320

321321
obs_table = Table.read(optical_str, format="ascii.fixed_width_no_header",
322-
col_starts=[ 0, 11, 13, 15, 17, 22, 25, 40, 50, 53, 56, 64, 75, 83, 87,
323-
95, 103, 106, 110, 117, 128, 136, 140, 147, 156, 161, 164,
324-
170, 177, 180, 187, 194, 196],
325-
col_ends=[ 10, 12, 14, 16, 21, 24, 39, 49, 52, 55, 63, 74, 82, 86, 94, 102,
326-
105, 109, 116, 127, 135, 139, 146, 155, 160, 163, 169, 176, 179,
327-
186, 193, 195, 197],
322+
col_starts=[0, 11, 13, 15, 17, 22, 25, 40, 50, 53, 56, 64, 75, 83, 87,
323+
95, 103, 106, 110, 117, 128, 136, 140, 147, 156, 161, 164,
324+
170, 177, 180, 187, 194, 196],
325+
col_ends=[10, 12, 14, 16, 21, 24, 39, 49, 52, 55, 63, 74, 82, 86, 94, 102,
326+
105, 109, 116, 127, 135, 139, 146, 155, 160, 163, 169, 176, 179,
327+
186, 193, 195, 197],
328328
names=['Design.', 'K', 'T', 'N', 'Date', 'MM', 'DD.ddd',
329329
'Date Accuracy', 'RA HH', 'RA MM', 'RA SS.sss', 'RA Accuracy',
330330
'RA RMS', 'RA F', 'RA Bias', 'RA Resid', 'DEC sDD', 'DEC MM',
@@ -402,14 +402,14 @@ def _parse_rov_obs(rov_str):
402402
NOTE: THIS IS UNTESTED (can't find an object with these rows)
403403
"""
404404

405-
rov_table = Table.read(rov_str, format="ascii.fixed_width_no_header",
405+
rov_table = Table.read(rov_str, format="ascii.fixed_width_no_header",
406406
col_starts=[0, 11, 13, 15, 17, 22, 25, 34, 45, 56, 65],
407407
col_ends=[10, 12, 14, 16, 21, 24, 33, 44, 55, 64, 68],
408408
names=['Design.', 'K', 'T', 'N', 'Date', 'MM', 'DD.dddddd',
409409
'E longitude', 'Latitude', 'Altitude', 'Obs Code'])
410410

411411
# Combining the date column
412-
date_array = [f"{x}/{y}/{z}" for x,y,z in rov_table["Date", "MM", "DD.dddddd"]]
412+
date_array = [f"{x}/{y}/{z}" for x, y, z in rov_table["Date", "MM", "DD.dddddd"]]
413413
rov_table["Date"] = convert_time(date_array, conversion_string='%Y/%m/%d')
414414
rov_table.remove_columns(["MM", "DD.dddddd"])
415415

@@ -426,15 +426,15 @@ def _parse_radar_obs(radar_str):
426426
radar_str = radar_str[radar_str.find('\n')+1:] # First row is header
427427
radar_table = Table.read(radar_str, format="ascii.fixed_width_no_header",
428428
col_starts=[0, 11, 13, 15, 17, 22, 25, 28, 37, 54, 64,
429-
73, 75, 87, 99, 106, 112, 124],
429+
73, 75, 87, 99, 106, 112, 124],
430430
col_ends=[10, 12, 14, 16, 21, 24, 27, 36, 53, 63, 72,
431431
74, 86, 98, 105, 111, 123, 125],
432-
names=["Design", "K", "T", "N", "Datetime", "MM", "DD",
433-
"hh:mm:ss", "Measure", "Accuracy", "rms", "F",
432+
names=["Design", "K", "T", "N", "Datetime", "MM", "DD",
433+
"hh:mm:ss", "Measure", "Accuracy", "rms", "F",
434434
"Bias", "Resid", "TRX", "RCX", "Chi", "S"])
435435

436436
# Combining the datetime columns
437-
date_array = [f"{x}/{y}/{z} {t}" for x,y,z,t in radar_table["Datetime", "MM", "DD", "hh:mm:ss"]]
437+
date_array = [f"{x}/{y}/{z} {t}" for x, y, z, t in radar_table["Datetime", "MM", "DD", "hh:mm:ss"]]
438438
radar_table["Datetime"] = Time.strptime(date_array, '%Y/%m/%d %H:%M:%S')
439439
radar_table.remove_columns(["MM", "DD", "hh:mm:ss"])
440440

@@ -472,10 +472,10 @@ def parse_observations(resp_str, verbose=False):
472472
Returns
473473
-------
474474
response : list(Table)
475-
List of response tables.
475+
List of response tables.
476476
"""
477477

478-
output_tables = list() # Setting up to collect the output tables
478+
output_tables = list() # Setting up to collect the output tables
479479

480480
# Split the meta data from the data table(s)
481481
header, dat_tabs = resp_str.split("END_OF_HEADER")
@@ -528,7 +528,7 @@ def parse_physical_properties(resp_str):
528528

529529
if resp_str == '':
530530
raise ValueError('Object not found: the name of the object is wrong or misspelt')
531-
531+
532532
# Split apart the table and reference data
533533
tbl, refs = resp_str.split("REFERENCES")
534534

@@ -539,7 +539,7 @@ def parse_physical_properties(resp_str):
539539
for elt in tbl_list:
540540
row = elt.split(",")
541541
if len(row) > 4:
542-
for i in range(1,len(row)-2):
542+
for i in range(1, len(row)-2):
543543
repaired_string += f"{row[0]},{row[i]},{row[-2]},{row[-1]}\n"
544544
else:
545545
repaired_string += elt + "\n"
@@ -611,7 +611,7 @@ def parse_orbital_properties(resp_str):
611611
"""
612612

613613
table_lst = list()
614-
614+
615615
header, body = resp_str.split("END_OF_HEADER")
616616

617617
# Parse Header
@@ -676,14 +676,13 @@ def parse_orbital_properties(resp_str):
676676

677677
ngr_tbl = _make_prop_table(ngr_names, ngr_vals, section)
678678
table_lst.append(ngr_tbl)
679-
679+
680680
for row in ngr_tbl:
681681
if float(row["Value"]):
682682
cols.append(row["Property"])
683683

684684
kep_n = 5
685685

686-
687686
# Equinoctial or Keplarian specific code
688687
if "Equinoctial" in ek_section:
689688

@@ -749,7 +748,7 @@ def parse_ephemerides(resp_str):
749748

750749
if "No ephemerides file" in resp_str:
751750
raise ValueError('No ephemerides file found for this object.')
752-
751+
753752
# Splitting the string into lines up to the nines which is where the table data starts
754753
resp_list = re.split("\n", resp_str, maxsplit=9)
755754

@@ -759,7 +758,7 @@ def parse_ephemerides(resp_str):
759758

760759
# Want to combine the column names and units
761760
colnames = [(' '.join(x)).strip() for x in zip([resp_list[6][x:y].strip() for x, y in col_inds],
762-
[resp_list[7][x:y].strip() for x, y in col_inds])]
761+
[resp_list[7][x:y].strip() for x, y in col_inds])]
763762

764763
ephem_table = Table.read(resp_list[9], format="ascii.fixed_width_no_header",
765764
col_starts=col_inds[:, 0], col_ends=col_inds[:, 1], names=colnames)
@@ -847,12 +846,12 @@ def parse_summary(resp_str):
847846
obs_ind = prop_list.index("Observatory")
848847
except ValueError:
849848
obs_ind = len(prop_list)
850-
849+
851850
obs_props = prop_list[obs_ind:]
852851
prop_list = prop_list[:obs_ind]
853852

854853
# Building the table
855-
summary_tab = Table(names=["Physical Properties", "Value", "Units"],
854+
summary_tab = Table(names=["Physical Properties", "Value", "Units"],
856855
data=np.array(prop_list).reshape((len(prop_list)//3, 3)))
857856

858857
# Dealing with the special cases
@@ -864,7 +863,7 @@ def parse_summary(resp_str):
864863
"(from Earth center)")
865864

866865
# Adding the other properties as metadata
867-
for i in range(0,len(obs_props), 2):
866+
for i in range(0, len(obs_props), 2):
868867
summary_tab.meta[obs_props[i]] = obs_props[i+1]
869868

870869
return summary_tab

0 commit comments

Comments
 (0)