fipy.viewers.mayaviViewer¶
- class fipy.viewers.mayaviViewer.MayaviClient(vars, title=None, daemon_file=None, fps=1.0, **kwlimits)¶
Bases:
AbstractViewer
The MayaviClient uses the Mayavi python plotting package.
>>> import fipy as fp >>> mesh = fp.Grid1D(nx=100) >>> x, = mesh.cellCenters >>> xVar = fp.CellVariable(mesh=mesh, name="x", value=x) >>> k = fp.Variable(name="k", value=0.) >>> viewer = MayaviClient(vars=(fp.numerix.sin(k * xVar) + 2, ... fp.numerix.cos(k * xVar / fp.numerix.pi) + 2), ... xmin=10, xmax=90, ... datamin=1.1, datamax=4.0, ... title="MayaviClient test") >>> for kval in fp.numerix.arange(0, 0.3, 0.03): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> import fipy as fp >>> mesh = fp.Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) >>> x, y = mesh.cellCenters >>> xyVar = fp.CellVariable(mesh=mesh, name="x y", value=x * y) >>> k = fp.Variable(name="k", value=0.) >>> viewer = MayaviClient(vars=fp.numerix.sin(k * xyVar) * 1000 + 1002, ... ymin=0.1, ymax=0.9, ... # datamin=1.1, datamax=4.0, ... title="MayaviClient test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> import fipy as fp >>> mesh = (fp.Grid2D(nx=5, ny=10, dx=0.1, dy=0.1) ... + (fp.Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) ... + ((0.5,), (0.2,)))) >>> x, y = mesh.cellCenters >>> xyVar = fp.CellVariable(mesh=mesh, name="x y", value=x * y) >>> k = fp.Variable(name="k", value=0.) >>> viewer = MayaviClient(vars=fp.numerix.sin(k * xyVar) * 1000 + 1002, ... ymin=0.1, ymax=0.9, ... # datamin=1.1, datamax=4.0, ... title="MayaviClient test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> import fipy as fp >>> mesh = fp.Grid3D(nx=50, ny=100, nz=10, dx=0.1, dy=0.01, dz=0.1) >>> x, y, z = mesh.cellCenters >>> xyzVar = fp.CellVariable(mesh=mesh, name=r"x y z", value=x * y * z) >>> k = fp.Variable(name="k", value=0.) >>> viewer = MayaviClient(vars=fp.numerix.sin(k * xyzVar) + 2, ... ymin=0.1, ymax=0.9, ... datamin=1.1, datamax=4.0, ... title="MayaviClient test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
Create a MayaviClient.
- Parameters:
vars (CellVariable or list) – CellVariable objects to plot
title (str, optional) – displayed at the top of the Viewer window
xmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
daemon_file (str, optional) – the path to the script to run the separate Mayavi viewer process. Defaults to fipy/viewers/mayaviViewer/mayaviDaemon.py
fps (float, optional) – frames per second to attempt to display
- property fps¶
The frames per second to attempt to display.
- plot(filename=None)¶
Update the display of the viewed variables.
- Parameters:
filename (str) – If not None, the name of a file to save the image into.
- plotMesh(filename=None)¶
Display a representation of the mesh
- Parameters:
filename (str) – If not None, the name of a file to save the image into.
- setLimits(limits={}, **kwlimits)¶
Update the limits.
- Parameters:
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. A 1D Viewer will only use xmin and xmax, a 2D viewer will also use ymin and ymax, and so on. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
Modules
A simple script that polls a data file for changes and then updates the Mayavi pipeline automatically. |
|
Test numeric implementation of the mesh |