fipy.viewers package¶
Subpackages¶
- fipy.viewers.matplotlibViewer package
- Submodules
- fipy.viewers.matplotlibViewer.matplotlib1DViewer module
Matplotlib1DViewer
Matplotlib1DViewer.axes
Matplotlib1DViewer.cmap
Matplotlib1DViewer.colorbar
Matplotlib1DViewer.fig
Matplotlib1DViewer.figaspect()
Matplotlib1DViewer.id
Matplotlib1DViewer.limits
Matplotlib1DViewer.lines
Matplotlib1DViewer.log
Matplotlib1DViewer.plot()
Matplotlib1DViewer.plotMesh()
Matplotlib1DViewer.setLimits()
Matplotlib1DViewer.title
Matplotlib1DViewer.vars
- fipy.viewers.matplotlibViewer.matplotlib2DContourViewer module
Matplotlib2DContourViewer
Matplotlib2DContourViewer.axes
Matplotlib2DContourViewer.cmap
Matplotlib2DContourViewer.colorbar
Matplotlib2DContourViewer.fig
Matplotlib2DContourViewer.figaspect()
Matplotlib2DContourViewer.id
Matplotlib2DContourViewer.levels
Matplotlib2DContourViewer.limits
Matplotlib2DContourViewer.log
Matplotlib2DContourViewer.plot()
Matplotlib2DContourViewer.plotMesh()
Matplotlib2DContourViewer.setLimits()
Matplotlib2DContourViewer.title
Matplotlib2DContourViewer.vars
- fipy.viewers.matplotlibViewer.matplotlib2DGridContourViewer module
Matplotlib2DGridContourViewer
Matplotlib2DGridContourViewer.axes
Matplotlib2DGridContourViewer.cmap
Matplotlib2DGridContourViewer.colorbar
Matplotlib2DGridContourViewer.fig
Matplotlib2DGridContourViewer.figaspect()
Matplotlib2DGridContourViewer.id
Matplotlib2DGridContourViewer.levels
Matplotlib2DGridContourViewer.limits
Matplotlib2DGridContourViewer.log
Matplotlib2DGridContourViewer.plot()
Matplotlib2DGridContourViewer.plotMesh()
Matplotlib2DGridContourViewer.setLimits()
Matplotlib2DGridContourViewer.title
Matplotlib2DGridContourViewer.vars
- fipy.viewers.matplotlibViewer.matplotlib2DGridViewer module
Matplotlib2DGridViewer
Matplotlib2DGridViewer.axes
Matplotlib2DGridViewer.cmap
Matplotlib2DGridViewer.colorbar
Matplotlib2DGridViewer.fig
Matplotlib2DGridViewer.figaspect()
Matplotlib2DGridViewer.id
Matplotlib2DGridViewer.limits
Matplotlib2DGridViewer.log
Matplotlib2DGridViewer.plot()
Matplotlib2DGridViewer.plotMesh()
Matplotlib2DGridViewer.setLimits()
Matplotlib2DGridViewer.title
Matplotlib2DGridViewer.vars
- fipy.viewers.matplotlibViewer.matplotlib2DViewer module
Matplotlib2DViewer
Matplotlib2DViewer.axes
Matplotlib2DViewer.cmap
Matplotlib2DViewer.collection
Matplotlib2DViewer.colorbar
Matplotlib2DViewer.fig
Matplotlib2DViewer.figaspect()
Matplotlib2DViewer.id
Matplotlib2DViewer.limits
Matplotlib2DViewer.log
Matplotlib2DViewer.plot()
Matplotlib2DViewer.plotMesh()
Matplotlib2DViewer.setLimits()
Matplotlib2DViewer.title
Matplotlib2DViewer.vars
- fipy.viewers.matplotlibViewer.matplotlibSparseMatrixViewer module
- fipy.viewers.matplotlibViewer.matplotlibStreamViewer module
MatplotlibStreamViewer
MatplotlibStreamViewer.axes
MatplotlibStreamViewer.cmap
MatplotlibStreamViewer.colorbar
MatplotlibStreamViewer.fig
MatplotlibStreamViewer.figaspect()
MatplotlibStreamViewer.id
MatplotlibStreamViewer.kwargs
MatplotlibStreamViewer.limits
MatplotlibStreamViewer.log
MatplotlibStreamViewer.plot()
MatplotlibStreamViewer.plotMesh()
MatplotlibStreamViewer.setLimits()
MatplotlibStreamViewer.title
MatplotlibStreamViewer.vars
- fipy.viewers.matplotlibViewer.matplotlibVectorViewer module
MatplotlibVectorViewer
MatplotlibVectorViewer.axes
MatplotlibVectorViewer.cmap
MatplotlibVectorViewer.colorbar
MatplotlibVectorViewer.fig
MatplotlibVectorViewer.figaspect()
MatplotlibVectorViewer.id
MatplotlibVectorViewer.limits
MatplotlibVectorViewer.log
MatplotlibVectorViewer.plot()
MatplotlibVectorViewer.plotMesh()
MatplotlibVectorViewer.quiver()
MatplotlibVectorViewer.setLimits()
MatplotlibVectorViewer.title
MatplotlibVectorViewer.vars
- fipy.viewers.matplotlibViewer.matplotlibViewer module
AbstractMatplotlibViewer
AbstractMatplotlibViewer.axes
AbstractMatplotlibViewer.cmap
AbstractMatplotlibViewer.colorbar
AbstractMatplotlibViewer.fig
AbstractMatplotlibViewer.figaspect()
AbstractMatplotlibViewer.id
AbstractMatplotlibViewer.limits
AbstractMatplotlibViewer.log
AbstractMatplotlibViewer.plot()
AbstractMatplotlibViewer.plotMesh()
AbstractMatplotlibViewer.setLimits()
AbstractMatplotlibViewer.title
AbstractMatplotlibViewer.vars
- fipy.viewers.matplotlibViewer.test module
- Module contents
Matplotlib1DViewer
Matplotlib1DViewer.axes
Matplotlib1DViewer.cmap
Matplotlib1DViewer.colorbar
Matplotlib1DViewer.fig
Matplotlib1DViewer.figaspect()
Matplotlib1DViewer.id
Matplotlib1DViewer.limits
Matplotlib1DViewer.lines
Matplotlib1DViewer.log
Matplotlib1DViewer.plot()
Matplotlib1DViewer.plotMesh()
Matplotlib1DViewer.setLimits()
Matplotlib1DViewer.title
Matplotlib1DViewer.vars
Matplotlib2DContourViewer
Matplotlib2DContourViewer.axes
Matplotlib2DContourViewer.cmap
Matplotlib2DContourViewer.colorbar
Matplotlib2DContourViewer.fig
Matplotlib2DContourViewer.figaspect()
Matplotlib2DContourViewer.id
Matplotlib2DContourViewer.levels
Matplotlib2DContourViewer.limits
Matplotlib2DContourViewer.log
Matplotlib2DContourViewer.plot()
Matplotlib2DContourViewer.plotMesh()
Matplotlib2DContourViewer.setLimits()
Matplotlib2DContourViewer.title
Matplotlib2DContourViewer.vars
Matplotlib2DGridContourViewer
Matplotlib2DGridContourViewer.axes
Matplotlib2DGridContourViewer.cmap
Matplotlib2DGridContourViewer.colorbar
Matplotlib2DGridContourViewer.fig
Matplotlib2DGridContourViewer.figaspect()
Matplotlib2DGridContourViewer.id
Matplotlib2DGridContourViewer.levels
Matplotlib2DGridContourViewer.limits
Matplotlib2DGridContourViewer.log
Matplotlib2DGridContourViewer.plot()
Matplotlib2DGridContourViewer.plotMesh()
Matplotlib2DGridContourViewer.setLimits()
Matplotlib2DGridContourViewer.title
Matplotlib2DGridContourViewer.vars
Matplotlib2DGridViewer
Matplotlib2DGridViewer.axes
Matplotlib2DGridViewer.cmap
Matplotlib2DGridViewer.colorbar
Matplotlib2DGridViewer.fig
Matplotlib2DGridViewer.figaspect()
Matplotlib2DGridViewer.id
Matplotlib2DGridViewer.limits
Matplotlib2DGridViewer.log
Matplotlib2DGridViewer.plot()
Matplotlib2DGridViewer.plotMesh()
Matplotlib2DGridViewer.setLimits()
Matplotlib2DGridViewer.title
Matplotlib2DGridViewer.vars
Matplotlib2DViewer
Matplotlib2DViewer.axes
Matplotlib2DViewer.cmap
Matplotlib2DViewer.collection
Matplotlib2DViewer.colorbar
Matplotlib2DViewer.fig
Matplotlib2DViewer.figaspect()
Matplotlib2DViewer.id
Matplotlib2DViewer.limits
Matplotlib2DViewer.log
Matplotlib2DViewer.plot()
Matplotlib2DViewer.plotMesh()
Matplotlib2DViewer.setLimits()
Matplotlib2DViewer.title
Matplotlib2DViewer.vars
MatplotlibStreamViewer
MatplotlibStreamViewer.axes
MatplotlibStreamViewer.cmap
MatplotlibStreamViewer.colorbar
MatplotlibStreamViewer.fig
MatplotlibStreamViewer.figaspect()
MatplotlibStreamViewer.id
MatplotlibStreamViewer.kwargs
MatplotlibStreamViewer.limits
MatplotlibStreamViewer.log
MatplotlibStreamViewer.plot()
MatplotlibStreamViewer.plotMesh()
MatplotlibStreamViewer.setLimits()
MatplotlibStreamViewer.title
MatplotlibStreamViewer.vars
MatplotlibVectorViewer
MatplotlibVectorViewer.axes
MatplotlibVectorViewer.cmap
MatplotlibVectorViewer.colorbar
MatplotlibVectorViewer.fig
MatplotlibVectorViewer.figaspect()
MatplotlibVectorViewer.id
MatplotlibVectorViewer.limits
MatplotlibVectorViewer.log
MatplotlibVectorViewer.plot()
MatplotlibVectorViewer.plotMesh()
MatplotlibVectorViewer.quiver()
MatplotlibVectorViewer.setLimits()
MatplotlibVectorViewer.title
MatplotlibVectorViewer.vars
MatplotlibViewer()
- fipy.viewers.mayaviViewer package
- Submodules
- fipy.viewers.mayaviViewer.mayaviClient module
- fipy.viewers.mayaviViewer.mayaviDaemon module
MayaviDaemon
MayaviDaemon.__base_traits__
MayaviDaemon.__class_traits__
MayaviDaemon.__del__()
MayaviDaemon.__delattr__()
MayaviDaemon.__getattribute__()
MayaviDaemon.__instance_traits__
MayaviDaemon.__listener_traits__
MayaviDaemon.__observer_traits__
MayaviDaemon.__prefix_traits__
MayaviDaemon.__setattr__()
MayaviDaemon.__view_traits__
MayaviDaemon.add_class_trait()
MayaviDaemon.class_default_traits_view()
MayaviDaemon.class_editable_traits()
MayaviDaemon.class_trait_names()
MayaviDaemon.class_trait_view()
MayaviDaemon.class_trait_view_elements()
MayaviDaemon.class_traits()
MayaviDaemon.class_visible_traits()
MayaviDaemon.clip_data()
MayaviDaemon.parse_command_line()
MayaviDaemon.poll_file()
MayaviDaemon.run()
MayaviDaemon.set_trait_dispatch_handler()
MayaviDaemon.setup_source()
MayaviDaemon.trait_added
MayaviDaemon.trait_items_event()
MayaviDaemon.trait_modified
MayaviDaemon.trait_property_changed()
MayaviDaemon.trait_subclasses()
MayaviDaemon.traits_init()
MayaviDaemon.traits_inited()
MayaviDaemon.update_pipeline()
MayaviDaemon.view_data()
MayaviDaemon.wrappers
- fipy.viewers.mayaviViewer.test module
- Module contents
- fipy.viewers.vtkViewer package
Submodules¶
fipy.viewers.multiViewer module¶
- class fipy.viewers.multiViewer.MultiViewer(viewers)¶
Bases:
AbstractViewer
Treat a collection of different viewers (such for different 2D plots or 1D plots with different axes) as a single viewer that will plot() all subviewers simultaneously.
- Parameters:
viewers (
list
of ~fipy.viewers.viewer.Viewer) – the viewers to bind together
- property limits¶
- plot()¶
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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
fipy.viewers.test module¶
Test implementation of the viewers
fipy.viewers.testinteractive module¶
Interactively test the viewers
fipy.viewers.tsvViewer module¶
- class fipy.viewers.tsvViewer.TSVViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
AbstractViewer
“Views” one or more variables in tab-separated-value format.
Output is a list of coordinates and variable values at each cell center.
File contents will be, e.g.:
title x y ... var0 var2 ... 0.0 0.0 ... 3.14 1.41 ... 1.0 0.0 ... 2.72 0.866 ... : :
Creates a TSVViewer.
Any cell centers that lie outside the limits provided will not be included. Any values that lie outside the datamin or datamax will be replaced with nan.
All variables must have the same mesh.
It tries to do something reasonable with rank-1 CellVariable and FaceVariable objects.
- Parameters:
vars (CellVariable or FaceVariable or list) – the MeshVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- plot(filename=None)¶
“plot” the coordinates and values of the variables to filename. If filename is not provided, “plots” to stdout.
>>> from fipy.meshes import Grid1D >>> m = Grid1D(nx = 3, dx = 0.4) >>> from fipy.variables.cellVariable import CellVariable >>> v = CellVariable(mesh = m, name = "var", value = (0, 2, 5)) >>> TSVViewer(vars = (v, v.grad)).plot() x var var_gauss_grad_x 0.2 0 2.5 0.6 2 6.25 1 5 3.75
>>> from fipy.meshes import Grid2D >>> m = Grid2D(nx = 2, dx = .1, ny = 2, dy = 0.3) >>> v = CellVariable(mesh = m, name = "var", value = (0, 2, -2, 5)) >>> TSVViewer(vars = (v, v.grad)).plot() x y var var_gauss_grad_x var_gauss_grad_y 0.05 0.15 0 10 -3.33333333333333 0.15 0.15 2 10 5 0.05 0.45 -2 35 -3.33333333333333 0.15 0.45 5 35 5
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
fipy.viewers.viewer module¶
- class fipy.viewers.viewer.AbstractViewer(vars, title=None, **kwlimits)¶
Bases:
object
Attention
This class is abstract. Always create one of its subclasses.
Create a AbstractViewer object.
- Parameters:
vars (CellVariable or list) – the CellVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
Module contents¶
- class fipy.viewers.DummyViewer(vars, title=None, **kwlimits)¶
Bases:
AbstractViewer
Substitute viewer that doesn’t do anything
Create a AbstractViewer object.
- Parameters:
vars (CellVariable or list) – the CellVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.Matplotlib1DViewer(vars, title=None, xlog=False, ylog=False, limits={}, legend='upper left', axes=None, **kwlimits)¶
Bases:
AbstractMatplotlibViewer
Displays a y vs. x plot of one or more 1D CellVariable objects using Matplotlib.
>>> 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 = Matplotlib1DViewer(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="Matplotlib1DViewer test") >>> for kval in fp.numerix.arange(0, 0.3, 0.03): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "Matplotlib1DViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
- Parameters:
vars (CellVariable or list) – CellVariable objects to plot
title (str, optional) – displayed at the top of the Viewer window
xlog (bool) – log scaling of x axis if True
ylog (bool) – log scaling of y axis if True
limits (dict) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale. (ymin and ymax are synonyms for datamin and datamax).
legend (str) – place a legend at the specified position, if not None
axes (Axes) – if not None, vars will be plotted into this Matplotlib
Axes
object
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property limits¶
- property lines¶
The collection of Matplotlib
Line2D
objects representing the plotted data.
- property log¶
Whether data has logarithmic scaling
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.Matplotlib2DContourViewer(vars, title=None, limits={}, cmap=None, colorbar='vertical', axes=None, number=None, levels=None, figaspect='auto', **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays a contour plot of a 2D CellVariable object.
The Matplotlib2DContourViewer plots a 2D CellVariable using Matplotlib.
Creates a Matplotlib2DContourViewer.
- Parameters:
vars (CellVariable) – Variable to display
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
cmap (Colormap, optional) – the Colormap. Defaults to matplotlib.cm.jet
colorbar (bool, optional) – plot a color bar in specified orientation if not None
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
number (int, optional) – Determines the number and positions of the contour lines / regions. (deprecated, use levels=).
levels (int or array-like, optional) – Determines the number and positions of the contour lines / regions. If an int n, tries to automatically choose no more than n+1 “nice” contour levels over the range of vars. If array-like, draw contour lines at the specified levels. The values must be in increasing order. E.g. to draw just the zero contour pass
levels=[0]
.figaspect (float) – desired aspect ratio of figure. If arg is a number, use that aspect ratio. If arg is auto, the aspect ratio will be determined from the Variable’s mesh.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property levels¶
The number of automatically-chosen contours or their values.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.Matplotlib2DGridContourViewer(vars, title=None, limits={}, cmap=None, colorbar='vertical', axes=None, levels=None, figaspect='auto', **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays a contour plot of a 2D CellVariable object.
The Matplotlib2DGridContourViewer plots a 2D CellVariable using Matplotlib.
>>> 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 = Matplotlib2DGridContourViewer(vars=fp.numerix.sin(k * xyVar) * 1000 + 1002, ... ymin=0.1, ymax=0.9, ... # datamin=1.1, datamax=4.0, ... title="Matplotlib2DGridContourViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.levels = 2
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "Matplotlib2DGridContourViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
Creates a Matplotlib2DViewer.
- Parameters:
vars (CellVariable) – the Variable to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
cmap (Colormap, optional) – the
Colormap
. Defaults to matplotlib.cm.jetcolorbar (bool, optional) – plot a color bar if not None
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
levels (int or array-like, optional) – Determines the number and positions of the contour lines / regions. If an int n, tries to automatically choose no more than n+1 “nice” contour levels over the range of vars. If array-like, draw contour lines at the specified levels. The values must be in increasing order. E.g. to draw just the zero contour pass
levels=[0]
.figaspect (float, optional) – desired aspect ratio of figure. If a number, use that aspect ratio. If auto, the aspect ratio will be determined from the vars’s mesh.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property levels¶
The number of automatically-chosen contours or their values.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.Matplotlib2DGridViewer(vars, title=None, limits={}, cmap=None, colorbar='vertical', axes=None, figaspect='auto', **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays an image plot of a 2D CellVariable object using Matplotlib.
>>> 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 = Matplotlib2DGridViewer(vars=fp.numerix.sin(k * xyVar) * 1000 + 1002, ... ymin=0.1, ymax=0.9, ... # datamin=1.1, datamax=4.0, ... title="Matplotlib2DGridViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "Matplotlib2DGridViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
Creates a Matplotlib2DGridViewer.
- Parameters:
vars (CellVariable) – the Variable to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
cmap (Colormap, optional) – the
Colormap
. Defaults to matplotlib.cm.jetxmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
colorbar (bool, optional) – plot a color bar in specified orientation if not None
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
figaspect (float, optional) – desired aspect ratio of figure. If arg is a number, use that aspect ratio. If arg is auto, the aspect ratio will be determined from the Variable’s mesh.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.Matplotlib2DViewer(vars, title=None, limits={}, cmap=None, colorbar='vertical', axes=None, figaspect='auto', **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays a contour plot of a 2D CellVariable object.
The Matplotlib2DViewer plots a 2D CellVariable using Matplotlib.
>>> 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 = Matplotlib2DViewer(vars=fp.numerix.sin(k * xyVar) * 1000 + 1002, ... ymin=0.1, ymax=0.9, ... # datamin=1.1, datamax=4.0, ... title="Matplotlib2DViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "Matplotlib2DViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
Creates a Matplotlib2DViewer.
- Parameters:
vars (CellVariable) – the Variable to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
cmap (Colormap, optional) – the
Colormap
. Defaults to matplotlib.cm.jetxmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
colorbar (bool, optional) – plot a color bar in specified orientation if not None
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib
Axes
objectfigaspect (float, optional) – desired aspect ratio of figure. If arg is a number, use that aspect ratio. If arg is auto, the aspect ratio will be determined from the Variable’s mesh.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property collection¶
The Matplotlib
PolyCollection
representing the cells.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.MatplotlibStreamViewer(vars, title=None, log=False, limits={}, axes=None, figaspect='auto', density=1, linewidth=None, color=None, cmap=None, norm=None, arrowsize=1, arrowstyle='-|>', minlength=0.1, **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays a stream plot of a 2D rank-1 CellVariable or FaceVariable object using Matplotlib
One issue is that this Viewer relies on scipy.interpolate.griddata, which interpolates on the convex hull of the data. The results is that streams are plotted across any concavities in the mesh.
Another issue is that it does not seem possible to remove the streams without calling cla(), which means that different set of streams cannot be overlaid.
>>> 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=1.) >>> viewer = MatplotlibStreamViewer(vars=fp.numerix.sin(k * xyVar).grad, ... title="MatplotlibStreamViewer test") >>> for kval in fp.numerix.arange(1, 10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer = MatplotlibStreamViewer(vars=fp.numerix.sin(k * xyVar).faceGrad, ... title="MatplotlibStreamViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "MatplotlibStreamViewer changed" >>> 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=1.) >>> viewer = MatplotlibStreamViewer(vars=fp.numerix.sin(k * xyVar).grad, ... title="MatplotlibStreamViewer test") >>> for kval in fp.numerix.arange(1, 10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer = MatplotlibStreamViewer(vars=fp.numerix.sin(k * xyVar).faceGrad, ... title="MatplotlibStreamViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "MatplotlibStreamViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
Creates a MatplotlibStreamViewer.
- Parameters:
vars (CellVariable or FaceVariable) – rank-1 Variable to display
title (str, optional) – displayed at the top of the Viewer window
log (bool, optional) – if True, arrow length goes at the base-10 logarithm of the magnitude
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float) – displayed range of data. Any limit set to a (default) value of None will autoscale.
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
figaspect (float, optional) – desired aspect ratio of figure. If arg is a number, use that aspect ratio. If arg is auto, the aspect ratio will be determined from the Variable’s mesh.
density (float or (float, float), optional) – Controls the closeness of streamlines. When
density = 1
, the domain is divided into a 30x30 grid. density linearly scales this grid. Each cell in the grid can have, at most, one traversing streamline. For different densities in each direction, use a tuple (density_x, density_y).linewidth (array_like or CellVariable or FaceVariable, optional) – The width of the stream lines. With a rank-0 CellVariable or FaceVariable the line width can be varied across the grid. The MeshVariable must have the same type and be defined on the same Mesh as vars.
color (str or CellVariable or FaceVariable, optional) – The streamline color as a matplotlib color code or a field of numbers. If given a rank-0 CellVariable or FaceVariable, its values are converted to colors using cmap and norm. The MeshVariable must have the same type and be defined on the same Mesh as vars.
cmap (Colormap, optional) – Colormap used to plot streamlines and arrows. This is only used if color is a MeshVariable.
norm (Normalize, optional) – Normalize object used to scale luminance data to 0, 1. If
None
, stretch (min, max) to (0, 1). Only necessary when color is a MeshVariable.arrowsize (float, optional) – Scaling factor for the arrow size.
arrowstyle (str, optional) – Arrow style specification. See ~matplotlib.patches.FancyArrowPatch.
minlength (float, optional) – Minimum length of streamline in axes coordinates.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property kwargs¶
keyword arguments to pass to
streamplot()
.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.MatplotlibVectorViewer(vars, title=None, scale=None, sparsity=None, log=False, limits={}, axes=None, figaspect='auto', **kwlimits)¶
Bases:
AbstractMatplotlib2DViewer
Displays a vector plot of a 2D rank-1 CellVariable or FaceVariable object using Matplotlib
>>> 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=1.) >>> viewer = MatplotlibVectorViewer(vars=fp.numerix.sin(k * xyVar).grad, ... title="MatplotlibVectorViewer test") >>> for kval in fp.numerix.arange(1, 10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer = MatplotlibVectorViewer(vars=fp.numerix.sin(k * xyVar).faceGrad, ... title="MatplotlibVectorViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> for sparsity in numerix.arange(5000, 0, -500): ... viewer.quiver(sparsity=sparsity) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "MatplotlibVectorViewer changed" >>> 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=1.) >>> viewer = MatplotlibVectorViewer(vars=fp.numerix.sin(k * xyVar).grad, ... title="MatplotlibVectorViewer test") >>> for kval in fp.numerix.arange(1, 10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer = MatplotlibVectorViewer(vars=fp.numerix.sin(k * xyVar).faceGrad, ... title="MatplotlibVectorViewer test") >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot() >>> viewer._promptForOpinion()
>>> for sparsity in numerix.arange(5000, 0, -500): ... viewer.quiver(sparsity=sparsity) ... viewer.plot() >>> viewer._promptForOpinion()
>>> viewer.cmap = "ocean" >>> viewer.log = True
>>> viewer.title = "MatplotlibVectorViewer changed" >>> viewer.plot() >>> viewer._promptForOpinion()
Creates a Matplotlib2DViewer.
- Parameters:
vars (CellVariable or FaceVariable) – rank-1 Variable to display
title (str, optional) – displayed at the top of the Viewer window
scale (float, optional) – if not None, scale all arrow lengths by this value
sparsity (int, optional) – if not None, then this number of arrows will be randomly chosen (weighted by the cell volume or face area)
log (bool, optional) – if True, arrow length goes at the base-10 logarithm of the magnitude
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
figaspect (float, optional) – desired aspect ratio of figure. If arg is a number, use that aspect ratio. If arg is auto, the aspect ratio will be determined from the Variable’s mesh.
- property axes¶
The Matplotlib
Axes
.
- property cmap¶
The Matplotlib
Colormap
.
- property colorbar¶
The Matplotlib
Colorbar
.
- property fig¶
The Matplotlib
Figure
.
- figaspect(figaspect, colorbar)¶
- property id¶
The Matplotlib
Figure
number.
- property limits¶
- 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.
- quiver(sparsity=None, scale=None)¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- fipy.viewers.MatplotlibViewer(vars, title=None, limits={}, cmap=None, colorbar='vertical', axes=None, **kwlimits)¶
Generic function for creating a MatplotlibViewer.
The MatplotlibViewer factory will search the module tree and return an instance of the first MatplotlibViewer it finds of the correct dimension and rank.
It is possible to view different
Variable
s against different Matplotlib Axes>>> from matplotlib import pyplot as plt >>> from fipy import *
>>> plt.ion() >>> fig = plt.figure()
>>> ax1 = plt.subplot((221)) >>> ax2 = plt.subplot((223)) >>> ax3 = plt.subplot((224))
>>> k = Variable(name="k", value=0.)
>>> mesh1 = Grid1D(nx=100) >>> x, = mesh1.cellCenters >>> xVar = CellVariable(mesh=mesh1, name="x", value=x) >>> viewer1 = MatplotlibViewer(vars=(numerix.sin(0.1 * k * xVar), numerix.cos(0.1 * k * xVar / numerix.pi)), ... limits={'xmin': 10, 'xmax': 90}, ... datamin=-0.9, datamax=2.0, ... title="Grid1D test", ... axes=ax1, ... legend=None)
>>> mesh2 = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) >>> x, y = mesh2.cellCenters >>> xyVar = CellVariable(mesh=mesh2, name="x y", value=x * y) >>> viewer2 = MatplotlibViewer(vars=numerix.sin(k * xyVar), ... limits={'ymin': 0.1, 'ymax': 0.9}, ... datamin=-0.9, datamax=2.0, ... title="Grid2D test", ... axes=ax2, ... colorbar=None)
>>> mesh3 = (Grid2D(nx=5, ny=10, dx=0.1, dy=0.1) ... + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) ... + ((0.5,), (0.2,)))) >>> x, y = mesh3.cellCenters >>> xyVar = CellVariable(mesh=mesh3, name="x y", value=x * y) >>> viewer3 = MatplotlibViewer(vars=numerix.sin(k * xyVar), ... limits={'ymin': 0.1, 'ymax': 0.9}, ... datamin=-0.9, datamax=2.0, ... title="Irregular 2D test", ... axes=ax3, ... cmap = plt.cm.OrRd)
>>> viewer = MultiViewer(viewers=(viewer1, viewer2, viewer3)) >>> from builtins import range >>> for kval in range(10): ... k.setValue(kval) ... viewer.plot()
>>> viewer._promptForOpinion()
- Parameters:
vars (CellVariable or list) – the Variable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict) – 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. 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. 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. 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. 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. 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. All viewers will use datamin and datamax. Any limit set to a (default) value of None will autoscale.
cmap (Colormap, optional) – the
Colormap
. Defaults to matplotlib.cm.jetcolorbar (bool, optional) – plot a color bar in specified orientation if not None
axes (Axes, optional) – if not None, vars will be plotted into this Matplotlib Axes object
- class fipy.viewers.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
- __del__()¶
- property fps¶
The frames per second to attempt to display.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- exception fipy.viewers.MeshDimensionError¶
Bases:
IndexError
- __cause__¶
exception cause
- __context__¶
exception context
- __delattr__(name, /)¶
Implement delattr(self, name).
- __getattribute__(name, /)¶
Return getattr(self, name).
- __reduce__()¶
Helper for pickle.
- __repr__()¶
Return repr(self).
- __setattr__(name, value, /)¶
Implement setattr(self, name, value).
- __setstate__()¶
- __str__()¶
Return str(self).
- __suppress_context__¶
- __traceback__¶
- add_note()¶
Exception.add_note(note) – add a note to the exception
- args¶
- with_traceback()¶
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class fipy.viewers.MultiViewer(viewers)¶
Bases:
AbstractViewer
Treat a collection of different viewers (such for different 2D plots or 1D plots with different axes) as a single viewer that will plot() all subviewers simultaneously.
- Parameters:
viewers (
list
of ~fipy.viewers.viewer.Viewer) – the viewers to bind together
- property limits¶
- plot()¶
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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.TSVViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
AbstractViewer
“Views” one or more variables in tab-separated-value format.
Output is a list of coordinates and variable values at each cell center.
File contents will be, e.g.:
title x y ... var0 var2 ... 0.0 0.0 ... 3.14 1.41 ... 1.0 0.0 ... 2.72 0.866 ... : :
Creates a TSVViewer.
Any cell centers that lie outside the limits provided will not be included. Any values that lie outside the datamin or datamax will be replaced with nan.
All variables must have the same mesh.
It tries to do something reasonable with rank-1 CellVariable and FaceVariable objects.
- Parameters:
vars (CellVariable or FaceVariable or list) – the MeshVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- plot(filename=None)¶
“plot” the coordinates and values of the variables to filename. If filename is not provided, “plots” to stdout.
>>> from fipy.meshes import Grid1D >>> m = Grid1D(nx = 3, dx = 0.4) >>> from fipy.variables.cellVariable import CellVariable >>> v = CellVariable(mesh = m, name = "var", value = (0, 2, 5)) >>> TSVViewer(vars = (v, v.grad)).plot() x var var_gauss_grad_x 0.2 0 2.5 0.6 2 6.25 1 5 3.75
>>> from fipy.meshes import Grid2D >>> m = Grid2D(nx = 2, dx = .1, ny = 2, dy = 0.3) >>> v = CellVariable(mesh = m, name = "var", value = (0, 2, -2, 5)) >>> TSVViewer(vars = (v, v.grad)).plot() x y var var_gauss_grad_x var_gauss_grad_y 0.05 0.15 0 10 -3.33333333333333 0.15 0.15 2 10 5 0.05 0.45 -2 35 -3.33333333333333 0.15 0.45 5 35 5
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.VTKCellViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
VTKViewer
Renders CellVariable data in VTK format
Creates a VTKViewer
- Parameters:
vars (CellVariable or FaceVariable or list) – the MeshVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- class fipy.viewers.VTKFaceViewer(vars, title=None, limits={}, **kwlimits)¶
Bases:
VTKViewer
Renders _MeshVariable data in VTK format
Creates a VTKViewer
- Parameters:
vars (CellVariable or FaceVariable or list) – the MeshVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- property limits¶
- 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.
- property title¶
The text appearing at the top center.
(default: if
len(self.vars) == 1
, the name ofself.vars[0]
, otherwise""
.)
- fipy.viewers.VTKViewer(vars, title=None, limits={}, **kwlimits)¶
Generic function for creating a VTKViewer.
The VTKViewer factory will search the module tree and return an instance of the first VTKViewer it finds of the correct dimension and rank.
- Parameters:
vars (CellVariable or FaceVariable or list) – the MeshVariable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict, optional) – a (deprecated) alternative to limit keyword arguments
xmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
xmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
ymax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
zmax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamin (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
datamax (float, optional) – displayed range of data. Any limit set to a (default) value of None will autoscale.
- fipy.viewers.Viewer(vars, title=None, limits={}, FIPY_VIEWER=None, **kwlimits)¶
Generic function for creating a Viewer.
The Viewer factory will search the module tree and return an instance of the first Viewer it finds that supports the dimensions of vars. Setting the FIPY_VIEWER environment variable to either matplotlib, mayavi, tsv, or vtk will specify the viewer.
The kwlimits or limits parameters can be used to constrain the view. For example:
Viewer(vars=some1Dvar, xmin=0.5, xmax=None, datamax=3)
or:
Viewer(vars=some1Dvar, limits={'xmin': 0.5, 'xmax': None, 'datamax': 3})
will return a viewer that displays a line plot from an x value of 0.5 up to the largest x value in the dataset. The data values will be truncated at an upper value of 3, but will have no lower limit.
- Parameters:
vars (CellVariable or list) – the Variable objects to display.
title (str, optional) – displayed at the top of the Viewer window
limits (dict) – a (deprecated) alternative to limit keyword arguments
FIPY_VIEWER – a specific viewer to attempt (possibly multiple times for multiple variables)
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.