Python-3.6:Scipy-0.19:AttributeError:' Delaunay'对象没有属性' _points'

时间:2017-05-30 20:05:06

标签: macos python-3.x scipy delaunay

尝试调用interpnd()时,一旦更新为scipy 0.19,就会出现此错误:

def __init__(self,m_ini,age,feh,m_act,logL,Teff,logg,mags,tri=None,
             minage=None, maxage=None, ext_table=False):

    self.minage = age.min()
    self.maxage = age.max()
    self.minmass = m_act.min()
    self.maxmass = m_act.max()
    self.minfeh = feh.min()
    self.maxfeh = feh.max()

    self.ext_table = ext_table

    if minage is not None:
        self.minage = minage
    if maxage is not None:
        self.maxage = maxage

    L = 10**logL

    if tri is None:
        points = np.zeros((len(m_ini),3))
        points[:,0] = m_ini
        points[:,1] = age
        points[:,2] = feh
        fn = interpnd(points,m_act)
        self.tri = fn.tri
    else:
        self.tri = tri
        self.mass = interpnd(self.tri,m_act)

    self._data = {'mass':m_act,
                'logL':logL,
                'logg':logg,
                'logTeff':np.log10(Teff),
                'mags':mags}
    self._props = ['mass', 'logL', 'logg', 'logTeff']

    self.bands = mags.keys()

    self._mag = {band:interpnd(self.tri,mags[band]) for band in self.bands}

    d = {}
    for b in self._mag.keys():
        d[b] = self._mag_fn(b)

    self.mag = d

错误讯息:

Traceback (most recent call last):
  File "/Users//anaconda/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users//anaconda/lib/python3.6/site-packages/nose/loader.py", line 417, in loadTestsFromName
addr.filename, addr.module)
  File "/Users//anaconda/lib/python3.6/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users//anaconda/lib/python3.6/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users//anaconda/lib/python3.6/imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "/Users//anaconda/lib/python3.6/imp.py", line 172, in load_source
    module = _load(spec)
  File "<frozen importlib._bootstrap>", line 675, in _load
  File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "/Users//isochrones/isochrones/tests/tests.py", line 11, in <module>
    DAR = Dartmouth_Isochrone()
  File "/Users//isochrones/isochrones/dartmouth/isochrone.py", line 89, in __init__
**kwargs)
  File "/Users//isochrones/isochrones/isochrone.py", line 145, in __init__
    self.mass = interpnd(self.tri,m_act)
  File "scipy/interpolate/interpnd.pyx", line 243, in scipy.interpolate.interpnd.LinearNDInterpolator.__init__ (scipy/interpolate/interpnd.c:5484)
  File "scipy/interpolate/interpnd.pyx", line 71, in scipy.interpolate.interpnd.NDInterpolatorBase.__init__ (scipy/interpolate/interpnd.c:2621)
  File "scipy/spatial/qhull.pyx", line 1910, in scipy.spatial.qhull.Delaunay.points (scipy/spatial/qhull.c:18892)
AttributeError: 'Delaunay' object has no attribute '_points'`

在Github上提出了一个问题,但没有回应。这个问题在我更新之前没有发生,但现在即使我降级到scipy 18.1,问题仍然存在。我也尝试卸载scipy并重新安装它,但这也不起作用。

1 个答案:

答案 0 :(得分:0)

我发现isochrones软件包和新的scipy软件包之间存在兼容性问题。该问题由包创建者解决。