On Sun, Feb 26, 2012 at 8:34 PM, Yun Tao <[email protected]> wrote:

> This may be a trivial question but I have a hard time finding an
> explanation:
>
> I wrote a series of elementary FiPy script (variants on the basic
> diffusion examples). For a long time, they run smoothly. However, after
> working with the latest unofficial FiPy release (operated under a different
> directory) for a while, all the old scripts no longer recognize functions
> like "exp" and "pi" unless I explicitly append "from numpy import *" at the
> beginning.


You're right. You need to use numerix now.

In [1]: import fipy

In [2]: fipy.__version__
Out[2]: '3.0-dev5145'

In [3]: from fipy import sin
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/users/wd15/<ipython-input-3-df5df19bd8a5> in <module>()
----> 1 from fipy import sin

ImportError: cannot import name sin

In [4]: from fipy import numerix

In [5]: numerix.sin
Out[5]: <ufunc 'sin'>

Older versions of fipy imported numerix functions directly.

n [1]: from fipy import sin

In [2]: sin
Out[2]: <function sin at 0x1e5cde8>

In [3]: import fipy

In [4]: fipy.__version__
Out[4]: '2.1.3'

I understand you're pain on this. We felt the need to remove the heavy
namespace pollution that occurs when using "from fipy import *". It imports
the whole of numpy! We were doing a major version change so we thought that
this was the best time to do it. Try puting "from fipy.tools.numerix import
*" at the top of your scripts and they should work.

Cheers

-- 
Daniel Wheeler
_______________________________________________
fipy mailing list
[email protected]
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to