我在6个月前编写了以下代码,它似乎工作正常。但是,现在,我得到以下内容::
〜/ astroconda / lib / python3.5 / site-packages / astroquery / sdss / init .py:28:UserWarning:Experimental:SDSS尚未重构,以使其API与之匹配其余的astroquery(但几乎就在那里)。 warnings.warn(“实验:SDSS尚未重构以获得其API”
〜/ astroconda / lib / python3.5 / site-packages / astroquery / sdss / core.py:857:VisibleDeprecationWarning:不建议在不指定编码参数的情况下读取unicode字符串。设置编码,使用None作为系统默认值。
AttributeError Traceback (most recent call last)
~/spectra/plot_spectra.py in <module>()
34 xid = SDSS.query_region(pos, spectro=True,radius=2*u.arcsec)
35 print(xid)
---> 36 j_eleven = SDSS.get_spectra(matches=xid)
37
38
~/astroconda/lib/python3.5/site-packages/astroquery/sdss/core.py in get_spectra(self, coordinates, radius, matches, plate, fiberID, mjd, timeout, cache, data_release, show_progress)
613 mjd=mjd, timeout=timeout,
614 data_release=data_release,
--> 615 show_progress=show_progress)
616
617 if readable_objs is not None:
~/astroconda/lib/python3.5/site-packages/astroquery/sdss/core.py in get_spectra_async(self, coordinates, radius, matches, plate, fiberID, mjd, timeout, get_query_payload, data_release, cache, show_progress)
585 link = linkstr.format(
586 base=conf.sas_baseurl, dr=data_release,
--> 587 instrument=row['instrument'].decode().lower(),
588 run2d=run2d, plate=row['plate'],
589 fiber=row['fiberID'], mjd=row['mjd'])
AttributeError: 'str' object has no attribute 'decode'
错误。不确定我做错了什么/不同......
import numpy as np
import scipy.interpolate as interp
import matplotlib
import matplotlib.pyplot as plt
from astroML.plotting import setup_text_plots
from astroquery.sdss import SDSS
from astropy import coordinates as coords
import astropy.units as u
## Find a spectrum using astroquery
pos = coords.SkyCoord('165.24045d -0.88458d', frame='icrs')
xid = SDSS.query_region(pos, spectro=True,radius=2*u.arcsec)
print(xid)
j_eleven = SDSS.get_spectra(matches=xid)