Skip to content

Error with sympy 1.0 #395

Closed
Closed
@matthew-brett

Description

@matthew-brett

We're not yet testing with sympy 1.0, but on my local machine, with sympy 1.0 and not sympy 0.7.6, I get the following:

In [1]: from nipy.modalities.fmri.fmristat.hrf import spectral
nipy/__init__.py:25: UserWarning: Running the tests from the install directory may trigger some failures
  warnings.warn('Running the tests from the install directory may '
/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/scipy/linalg/basic.py:884: RuntimeWarning: internal gelsd driver lwork query error, required iwork dimension not returned. This is likely the result of LAPACK bug 0038, fixed in LAPACK 3.2.2 (released July 21, 2010). Falling back to 'gelss' driver.
  warnings.warn(mesg, RuntimeWarning)

In [2]: glover0, glover1 = spectral

In [3]: res1 = glover0(0.)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-12e6f192d44d> in <module>()
----> 1 res1 = glover0(0.)

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/function.pyc in __new__(cls, *args, **options)
    718     def __new__(cls, *args, **options):
    719         args = list(map(sympify, args))
--> 720         obj = super(AppliedUndef, cls).__new__(cls, *args, **options)
    721         return obj
    722 

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/cache.pyc in wrapper(*args, **kwargs)
     91             def wrapper(*args, **kwargs):
     92                 try:
---> 93                     retval = cfunc(*args, **kwargs)
     94                 except TypeError:
     95                     retval = func(*args, **kwargs)

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/compatibility.pyc in wrapper(*args, **kwds)
    897                         stats[HITS] += 1
    898                         return result
--> 899                 result = user_function(*args, **kwds)
    900                 with lock:
    901                     root, = nonlocal_root

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/function.pyc in __new__(cls, *args, **options)
    390         pr2 = min(cls._should_evalf(a) for a in result.args)
    391         if pr2 > 0:
--> 392             return result.evalf(mlib.libmpf.prec_to_dps(pr))
    393         return result
    394 

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/evalf.pyc in evalf(self, n, subs, maxn, chop, strict, quad, verbose)
   1383             options['quad'] = quad
   1384         try:
-> 1385             result = evalf(self, prec + 4, options)
   1386         except NotImplementedError:
   1387             # Fall back to the ordinary evalf

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/evalf.pyc in evalf(x, prec, options)
   1282             if 'subs' in options:
   1283                 x = x.subs(evalf_subs(prec, options['subs']))
-> 1284             re, im = x._eval_evalf(prec).as_real_imag()
   1285             if re.has(re_) or im.has(im_):
   1286                 raise NotImplementedError

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/sympy/core/function.pyc in _eval_evalf(self, prec)
    466         except (AttributeError, KeyError):
    467             try:
--> 468                 return Float(self._imp_(*self.args), prec)
    469             except (AttributeError, TypeError):
    470                 return

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/scipy/interpolate/polyint.pyc in __call__(self, x)
     77 
     78         """
---> 79         x, x_shape = self._prepare_x(x)
     80         y = self._evaluate(x)
     81         return self._finish_y(y, x_shape)

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/scipy/interpolate/polyint.pyc in _prepare_x(self, x)
     89     def _prepare_x(self, x):
     90         """Reshape input x array to 1-D"""
---> 91         x = _asarray_validated(x, check_finite=False, as_inexact=True)
     92         x_shape = x.shape
     93         return x.ravel(), x_shape

/Users/mb312/.virtualenvs/nibabel/lib/python2.7/site-packages/scipy/_lib/_util.pyc in _asarray_validated(a, check_finite, sparse_ok, objects_ok, mask_ok, as_inexact)
    188     if not objects_ok:
    189         if a.dtype is np.dtype('O'):
--> 190             raise ValueError('object arrays are not supported')
    191     if as_inexact:
    192         if not np.issubdtype(a.dtype, np.inexact):

ValueError: object arrays are not supported

This is something to do with floating point values because these work fine:

In [4]: res1 = glover0(0)

In [5]: res1 = glover0(1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions