我大约 6 个月前编写了以下代码,它似乎工作正常。但是,现在我得到以下信息:
~/astroconda/lib/python3.5/site-packages/astroquery/sdss/ init .py:28:UserWarning:实验性:SDSS 尚未重构以使其 API 与 astroquery 的其余部分匹配(但它几乎就在那里)。warnings.warn("实验性:SDSS 尚未被重构为其 API"
~/astroconda/lib/python3.5/site-packages/astroquery/sdss/core.py:857:VisibleDeprecationWarning:不推荐在不指定编码参数的情况下读取 unicode 字符串。设置编码,系统默认使用无。
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)