Skip to content

Commit 44c2780

Browse files
committed
fix dr8, dr9 peculiarities
1 parent 0068d25 commit 44c2780

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

astroquery/sdss/core.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,16 @@ def get_spectra_async(self, coordinates=None, radius=2. * u.arcsec,
583583
# - run2d sometimes (#739)
584584
if isinstance(row['run2d'], bytes):
585585
run2d = row['run2d'].decode()
586+
elif isinstance(row['run2d'], (np.integer, int)):
587+
run2d = str(run2d)
586588
else:
587589
run2d = row['run2d']
588590
if data_release > 15 and run2d not in ('26', '103', '104'):
589-
linkstr.replace('/spectra/', '/spectra/full/')
591+
linkstr = linkstr.replace('/spectra/', '/spectra/full/')
590592
link = linkstr.format(
591593
base=conf.sas_baseurl, dr=data_release,
592594
run2d=run2d, plate=row['plate'],
593595
fiber=row['fiberID'], mjd=row['mjd'])
594-
595596
results.append(commons.FileContainer(link,
596597
encoding='binary',
597598
remote_timeout=timeout,
@@ -860,9 +861,12 @@ def _parse_result(self, response, verbose=False):
860861

861862
if 'error_message' in io.BytesIO(response.content):
862863
raise RemoteServiceError(response.content)
864+
skip_header = 0
865+
if response.content.startswith('#Table'):
866+
skip_header = 1
863867
arr = np.atleast_1d(np.genfromtxt(io.BytesIO(response.content),
864868
names=True, dtype=None,
865-
delimiter=',', skip_header=1,
869+
delimiter=',', skip_header=skip_header,
866870
comments='#'))
867871

868872
if len(arr) == 0:

astroquery/sdss/field_names.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
# Default photometric and spectroscopic quantities to retrieve.
1818
photoobj_defs = ['ra', 'dec', 'objid', 'run', 'rerun', 'camcol', 'field']
19-
specobj_defs = ['z', 'plate', 'mjd', 'fiberID', 'specobjid', 'run2d',
20-
'instrument']
19+
specobj_defs = ['z', 'plate', 'mjd', 'fiberID', 'specobjid', 'run2d']
2120
crossid_defs = ['ra', 'dec', 'psfMag_u', 'psfMagerr_u', 'psfMag_g',
2221
'psfMagerr_g', 'psfMag_r', 'psfMagerr_r', 'psfMag_i',
2322
'psfMagerr_i', 'psfMag_z', 'psfMagerr_z']

0 commit comments

Comments
 (0)