Hi Jonathan,

So when I first ran the script, this is what I get:

In [18]: run mesh2D-coupled.py
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
> /Users/yuntao/FiPy/trunk/examples/cahnHilliard/mesh2D-coupled.py in
> <module>()
>     197 if __name__ == '__main__':
>     198     import fipy.tests.doctestPlus
> --> 199     exec(fipy.tests.doctestPlus._getScript())
>     200
>     201     raw_input('finished')
> /Users/yuntao/FiPy/trunk/examples/cahnHilliard/mesh2D-coupled.py in
> <module>()
>      37
>      38
> ---> 39
>      40
>      41
> /Users/yuntao/FiPy/trunk/examples/cahnHilliard/fipy/meshes/factoryMeshes.pyc
> in Grid2D(dx, dy, nx, ny, Lx, Ly, overlap, communicator)
>     152     """
>     153
> --> 154     from fipy.meshes import uniformGrid2D
>     155     from fipy.meshes import grid2D
>     156
> ImportError: cannot import name uniformGrid2D
> WARNING: Failure executing file: <mesh2D-coupled.py>


However, a check shows that uniformGrid2D does exist:

In [28]: ls ../../fipy/meshes/
> ../../fipy/meshes/__init__.py                  ../../fipy/meshes/mesh.py
> ../../fipy/meshes/__init__.pyc                 ../../fipy/meshes/mesh.pyc
> ../../fipy/meshes/abstractMesh.py              ../../fipy/meshes/mesh1D.py
> ../../fipy/meshes/abstractMesh.pyc             ../../fipy/meshes/mesh1D.pyc
> ../../fipy/meshes/builders                     ../../fipy/meshes/mesh2D.py
> ../../fipy/meshes/cylindricalGrid1D.py         ../../fipy/meshes/mesh2D.pyc
> ../../fipy/meshes/cylindricalGrid2D.py         ../../fipy/meshes/numMesh
> ../../fipy/meshes/cylindricalUniformGrid1D.py
>  ../../fipy/meshes/periodicGrid1D.py
> ../../fipy/meshes/cylindricalUniformGrid2D.py
>  ../../fipy/meshes/periodicGrid1D.pyc
> ../../fipy/meshes/factoryMeshes.py
> ../../fipy/meshes/periodicGrid2D.py
> ../../fipy/meshes/factoryMeshes.pyc
>  ../../fipy/meshes/periodicGrid2D.pyc
> ../../fipy/meshes/gmshImport.py
>  ../../fipy/meshes/skewedGrid2D.py
> ../../fipy/meshes/gmshImport.pyc
> ../../fipy/meshes/skewedGrid2D.pyc
> ../../fipy/meshes/grid1D.py                    ../../fipy/meshes/test.py
> ../../fipy/meshes/grid1D.pyc                   ../../fipy/meshes/tri2D.py
> ../../fipy/meshes/grid2D.py                    ../../fipy/meshes/tri2D.pyc
> ../../fipy/meshes/grid2D.pyc
> ../../fipy/meshes/uniformGrid.py
> ../../fipy/meshes/grid3D.py
>  ../../fipy/meshes/uniformGrid1D.py
> ../../fipy/meshes/gridlike.py                 
> ../../fipy/meshes/uniformGrid2D.py
> ../../fipy/meshes/gridlike.pyc
> ../../fipy/meshes/uniformGrid3D.py


So then I went into fipy/meshes/__init__.py and added

> from fipy.meshes.uniformGrid2D import *

to the first block and

> __all__.extend(uniformGrid2D.__all__)

to the second.

After this, I rebuilt the trunk:

> Yun-Taos-MacBook-Pro:trunk yuntao$ python setup.py build
> running build
> running build_py
> copying fipy/meshes/__init__.py -> build/lib/fipy/meshes
> Yun-Taos-MacBook-Pro:trunk yuntao$ sudo python setup.py install


So I'm not sure why the script worked for you so readily... for me, I still
couldn't get the basic example circle.py to work due to Gmsh import
trouble, so the problem most likely exists on my end... However, thanks for
the .matplotlibrc link! I'll definitely look into that.

Cheers, Yun







On Wed, Feb 22, 2012 at 10:32 AM, Jonathan Guyer <[email protected]> wrote:

> I don't understand. What changes did you have to make to UniformGrid2D?
> That script is automatically (and successfully) tested every time trunk/ is
> updated, so there should be no changes necessary. As for setting TKAgg, you
> are better doing that in your .matplotlibrc <
> http://matplotlib.sourceforge.net/users/customizing.html> than by hacking
> the examples.
>
>
> On Feb 7, 2012, at 8:01 PM, Yun Tao wrote:
>
> > It works! The only fix I have to make is to manually import and extend
> uniformGrid2D in meshes/__init__.py. Furthermore, in the script itself I
> imported matplotlib and used 'TKAgg' as the backend.
> >
> > Thanks for the help!
> >
> > - Yun
> >
> >
> > On Mon, Jan 30, 2012 at 5:44 AM, Jonathan Guyer <[email protected]> wrote:
> >
> > On Jan 29, 2012, at 8:08 PM, Yun Tao wrote:
> >
> > > I've been leaning FiPy in hope to solve a coupled system of stochastic
> pde's that are representations of animal migration mechanisms. So far I've
> found just one recent thread related to the topic:
> > > http://comments.gmane.org/gmane.comp.python.fipy/2329
> > > Regarding the response by Jonathan Guyer, I'm hoping to know whether
> the major release mentioned therein, or at least its simultaneous solutions
> solver, is currently available.
> >
> > FiPy with coupled solutions has not been released yet, as we have been
> trying to resolve a few edge cases that cause test failures in certain
> configurations.
> >
> > FiPy's development code, as you found, is always available *without
> support* via svn and can be viewed at http://matforge.org/fipy/browser.
> The code in trunk/ is always what we intend to eventually release.
> >
> >
> > > On a similar note, I found a wonderful script for coupled system
> written by Jonathan:
> http://matforge.org/fipy/browser/trunk/examples/cahnHilliard/mesh2D-coupled.py
> >
> > Actually, I think Daniel wrote that, despite my name appearing first.
> >
> > > Since it is the only example I can find of this class of problems,
> I've been trying to understand it to the fullest extent. However, I've been
> having trouble running through the program myself and wonder whether the
> link above refers to the finalized, working version.
> > >
> > > Minor hiccup wise, on ln 81, the ".value" after the
> GaussianNoiseVariable seems to unnecessarily reduce the variable "noise" to
> an array of zeros.
> > >
> > > A more serious complication is when executing the program through ln
> 145 repeatedly yields the following error message:
> > > TypeError: __init__() got an unexpected keyword argument 'var'
> >
> > Both issues would appear to be due to your running an example from
> FiPy's trunk/ with an older FiPy installation (presumably 2.1.x). You would
> need to install all of FiPy's code from SVN trunk/ in order to run this
> example.
> >
> >
> > > Thank you all for having been so incredibly helpful. Long live FiPy!
> >
> > We're happy to help.
> >
> >
> > _______________________________________________
> > fipy mailing list
> > [email protected]
> > http://www.ctcms.nist.gov/fipy
> >  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
> >
> >
> >
> > --
> > Yun Tao
> >
> > Graduate Group of Ecology Doctoral Candidate
> > Department of Environmental Science and Policy
> > Center for Population Biology
> > University of California, Davis
> >
> >
> > <ATT00001..c>
>
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Yun Tao

Graduate Group of Ecology Doctoral Candidate
Department of Environmental Science and Policy
Center for Population Biology
University of California, Davis
_______________________________________________
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