fipy.viewers.tsvViewer

Classes

TSVViewer(vars[, title, limits])

"Views" one or more variables in tab-separated-value format.

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.

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 of the only Variable, otherwise "".)

property vars

The Variable or list of Variable objects to display.

Last updated on Jun 26, 2024. Created using Sphinx 7.1.2.