enthought / enthought/mayavi

FiPy: 'AssignAttribute' object has no attribute 'cell_data'

Open
#802 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
316
Avg merge
7h 44m
Merged PRs (30d)
5

Description

I'm trying to run the following example, taken from: https://www.ctcms.nist.gov/fipy/fipy/generated/fipy.viewers.mayaviViewer.html
``` python
import os
os.environ["QT_API"] = "pyqt"

from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'

from fipy import *
mesh = Grid3D(nx=50, ny=100, nz=10, dx=0.1, dy=0.01, dz=0.1)
x, y, z = mesh.cellCenters
xyzVar = CellVariable(mesh=mesh, name=r"x y z", value=x * y * z)
k = Variable(name="k", value=0.)
viewer = MayaviClient(vars=numerix.sin(k * xyzVar),
limits={'ymin': 0.1, 'ymax': 0.9},
datamin=-0.9, datamax=2.0,
title="MayaviClient test")
from builtins import range
for kval in range(10):
k.setValue(kval)
viewer.plot()
viewer._promptForOpinion()
```
However, I'm getting the following traceback:
```
Jul 08 13:54:38 linux compiz[2909]: Traceback (most recent call last):
Jul 08 13:54:38 linux compiz[2909]: File "/usr/lib/python2.7/dist-packages/pyface/ui/qt4/gui.py", line 183, in event
Jul 08 13:54:38 linux compiz[2909]: self._callable(*self._args, **self._kw)
Jul 08 13:54:38 linux compiz[2909]: File "~/.local/lib/python2.7/site-packages/fipy/viewers/mayaviViewer/mayaviDaemon.py", line 130, in run
Jul 08 13:54:38 linux compiz[2909]: if out.cell_data.scalars is not None]
Jul 08 13:54:38 linux compiz[2909]: AttributeError: 'AssignAttribute' object has no attribute 'cell_data'
```
How shall I construct the code to be Mayavi properly called?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the MayaviClient example in the issue and inspect mayaviDaemon.py around line 130, where the traceback accesses out.cell_data.scalars. Reproduce the example with the reported Python 2.7 and Qt setup, then verify that the viewer can plot the FiPy data without the AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.