Changeset 2608 for trunk

Show
Ignore:
Timestamp:
06/23/2008 11:23:05 AM (7 months ago)
Author:
guyer
Message:

More consistent doctests across different viewers (still need to do
vector viewers)

Location:
trunk/fipy/viewers
Files:
11 modified

Legend:

Unmodified
Added
Removed
  • trunk/fipy/viewers/gistViewer/gist1DViewer.py

    r2286 r2608  
    66 #  
    77 #  FILE: "gist1DViewer.py" 
    8  #                                    created: 11/10/03 {2:48:25 PM}  
    9  #                                last update: 7/5/07 {9:30:22 AM}  
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5049 
    5150class Gist1DViewer(GistViewer): 
    52     """ 
    53     Displays a y vs. x plot of one or more 1D `CellVariable` objects. 
    54  
    55         >>> from fipy import * 
    56         >>> mesh = Grid1D(nx=100) 
    57         >>> x = mesh.getCellCenters()[0] 
    58         >>> var1 = CellVariable(mesh=mesh, name=r"$sin(x)$", value=numerix.sin(x)) 
    59         >>> var2 = CellVariable(mesh=mesh, name=r"$cos(x/\pi)$", value=numerix.cos(x / numerix.pi)) 
    60         >>> viewer = Gist1DViewer(vars=(var1, var2),  
    61         ...                       limits={'xmin':10, 'xmax':90, 'datamin':-0.9, 'datamax':2.0}, 
    62         ...                       title="Gist1DViewer test") 
    63         >>> viewer.plot() 
    64         >>> viewer._promptForOpinion() 
    65         >>> del viewer 
    66  
     51    """Displays a y vs. x plot of one or more 1D `CellVariable` objects. 
    6752    """ 
    6853     
     54    __doc__ += GistViewer._test1D(viewer="Gist1DViewer") 
     55 
    6956    def __init__(self, vars, title = None, limits = None, xlog = 0, ylog = 0, style = "work.gs"): 
    7057        """ 
  • trunk/fipy/viewers/gistViewer/gist2DViewer.py

    r2292 r2608  
    66 #  
    77 #  FILE: "gist2DViewer.py" 
    8  #                                    created: 11/10/03 {2:48:25 PM}  
    9  #                                last update: 7/5/07 {9:43:48 AM}  
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    4948 
    5049class Gist2DViewer(GistViewer): 
    51     """ 
    52     Displays a contour plot of a 2D `CellVariable` object. 
    53  
     50    """Displays a contour plot of a 2D `CellVariable` object. 
    5451    """ 
    5552     
     53    __doc__ += GistViewer._test2D(viewer="Gist2DViewer") 
     54    __doc__ += GistViewer._test2Dirregular(viewer="Gist2DViewer") 
     55     
    5656    def __init__(self, vars, limits = None, title = None, palette = 'heat.gp', grid = 1, dpi = 75): 
    57         """ 
    58         Creates a `Gist2DViewer`. 
     57        """Creates a `Gist2DViewer`. 
    5958         
    60         >>> from fipy import * 
    61         >>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    62         >>> x, y = mesh.getCellCenters() 
    63         >>> var = CellVariable(mesh=mesh, name=r"$sin(x y)$", value=numerix.sin(x * y)) 
    64         >>> viewer = Gist2DViewer(vars=var,  
    65         ...                       limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    66         ...                       title="Gist2DViewer test") 
    67         >>> viewer.plot() 
    68         >>> viewer._promptForOpinion() 
    69         >>> del viewer 
    70  
    71         >>> mesh = Tri2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    72         >>> x, y = mesh.getCellCenters() 
    73         >>> var = CellVariable(mesh=mesh, name=r"$sin(x y)$", value=numerix.sin(x * y)) 
    74         >>> viewer = Gist2DViewer(vars=var,  
    75         ...                       limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    76         ...                       title="Gist2DViewer test") 
    77         >>> viewer.plot() 
    78         >>> viewer._promptForOpinion() 
    79         >>> del viewer 
    80  
    8159        :Parameters: 
    8260          - `vars`: A `CellVariable` or tuple of `CellVariable` objects to plot. 
  • trunk/fipy/viewers/gnuplotViewer/gnuplot1DViewer.py

    r2498 r2608  
    66 #  
    77 #  FILE: "gnuplot1DViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 7/5/07 {9:32:26 AM} { 2:45:36 PM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5049 
    5150class Gnuplot1DViewer(GnuplotViewer): 
    52     """ 
    53     Displays a y vs. x plot of one or more 1D `CellVariable` objects. 
     51    """Displays a y vs. x plot of one or more 1D `CellVariable` objects. 
    5452 
    5553    The `Gnuplot1DViewer` plots a 1D `CellVariable` using a front end python 
    5654    wrapper available to download (Gnuplot.py_). 
    5755     
    58         >>> from fipy import * 
    59         >>> mesh = Grid1D(nx=100) 
    60         >>> x = mesh.getCellCenters()[0] 
    61         >>> var1 = CellVariable(mesh=mesh, name=r"$sin(x)$", value=numerix.sin(x)) 
    62         >>> var2 = CellVariable(mesh=mesh, name=r"$cos(x/\pi)$", value=numerix.cos(x / numerix.pi)) 
    63         >>> viewer = Gnuplot1DViewer(vars=(var1, var2),  
    64         ...                          limits={'xmin':10, 'xmax':90, 'datamin':-0.9, 'datamax':2.0}, 
    65         ...                          title="Gnuplot1DViewer test") 
    66         >>> viewer.plot() 
    67         >>> viewer._promptForOpinion() 
    68         >>> del viewer 
     56    .. _Gnuplot.py: http://gnuplot-py.sourceforge.net/ 
     57    """ 
     58     
     59    __doc__ += GnuplotViewer._test1D(viewer="Gnuplot1DViewer") 
    6960 
    70     .. _Gnuplot.py: http://gnuplot-py.sourceforge.net/ 
    71  
     61    __doc__ += """ 
    7262    Different style script demos_ are available at the Gnuplot_ site. 
    7363 
  • trunk/fipy/viewers/gnuplotViewer/gnuplot2DViewer.py

    r2286 r2608  
    66 #  
    77 #  FILE: "gnuplot1DViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 7/5/07 {9:32:17 AM} { 2:45:36 PM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5857 
    5958    .. _Gnuplot.py: http://gnuplot-py.sourceforge.net/ 
    60  
     59    """ 
     60     
     61    __doc__ += GnuplotViewer._test2D(viewer="Gnuplot2DViewer") 
     62    __doc__ += GnuplotViewer._test2Dirregular(viewer="Gnuplot2DViewer") 
     63     
     64    __doc__ += """ 
    6165    Different style script demos_ are available at the Gnuplot_ site. 
    6266 
     
    7074    """ 
    7175    def __init__(self, vars, limits = None, title = None): 
    72         """ 
    73         Creates a `Gnuplot2DViewer`. 
    74          
    75             >>> from fipy import * 
    76             >>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    77             >>> x, y = mesh.getCellCenters() 
    78             >>> var = CellVariable(mesh=mesh, name=r"$sin(x y)$", value=numerix.sin(x * y)) 
    79             >>> viewer = Gnuplot2DViewer(vars=var,  
    80             ...                          limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    81             ...                          title="Gnuplot2DViewer test") 
    82             >>> viewer.plot() 
    83             >>> viewer._promptForOpinion() 
    84             >>> del viewer 
    85  
    86             >>> mesh = Tri2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    87             >>> x, y = mesh.getCellCenters() 
    88             >>> var = CellVariable(mesh=mesh, name=r"$sin(x y)$", value=numerix.sin(x * y)) 
    89             >>> viewer = Gnuplot2DViewer(vars=var,  
    90             ...                          limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    91             ...                          title="Gnuplot2DViewer test") 
    92             >>> viewer.plot() 
    93             >>> viewer._promptForOpinion() 
    94             >>> del viewer 
     76        """Creates a `Gnuplot2DViewer`. 
    9577 
    9678        :Parameters: 
  • trunk/fipy/viewers/matplotlibViewer/matplotlib1DViewer.py

    r2286 r2608  
    66 #  
    77 #  FILE: "matplotlib1DViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 7/4/07 {8:14:53 PM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5251    Matplotlib_. 
    5352     
    54         >>> from fipy import * 
    55         >>> from fipy.tools.numerix import * 
    56         >>> mesh = Grid1D(nx=100) 
    57         >>> x = mesh.getCellCenters()[0] 
    58         >>> xVar = CellVariable(mesh=mesh, name="x", value=x) 
    59         >>> k = Variable(name="k") 
    60         >>> viewer = Matplotlib1DViewer(vars=(sin(k * xVar), cos(k * xVar / pi)),  
    61         ...                             limits={'xmin':10, 'xmax':90, 'datamin':-0.9, 'datamax':2.0}, 
    62         ...                             title="Matplotlib1DViewer test") 
    63         >>> for kval in numerix.arange(0,0.3,0.03): 
    64         ...     k.setValue(kval) 
    65         ...     viewer.plot() 
    66         >>> viewer._promptForOpinion() 
    67  
    6853    .. _Matplotlib: http://matplotlib.sourceforge.net/ 
    69  
    70  
    7154    """ 
     55     
     56    __doc__ += MatplotlibViewer._test1D(viewer="Matplotlib1DViewer") 
     57     
    7258    def __init__(self, vars, limits = None, title = None, xlog=False, ylog=False): 
    7359        MatplotlibViewer.__init__(self, vars=vars, limits=limits, title=title) 
  • trunk/fipy/viewers/matplotlibViewer/matplotlib2DGridContourViewer.py

    r2336 r2608  
    66 #  
    77 #  FILE: "matplotlib2DViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 10/5/07 {10:11:32 AM} { 2:45:36 PM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    4948 
    5049class Matplotlib2DGridContourViewer(MatplotlibViewer): 
    51     """ 
    52     Displays a contour plot of a 2D `CellVariable` object.     
     50    """Displays a contour plot of a 2D `CellVariable` object.     
    5351 
    5452    The `Matplotlib2DGridContourViewer` plots a 2D `CellVariable` using Matplotlib_. 
    5553 
    5654    .. _Matplotlib: http://matplotlib.sourceforge.net/ 
    57  
    58  
    5955    """ 
     56     
     57    __doc__ += MatplotlibViewer._test2D(viewer="Matplotlib2DGridContourViewer") 
    6058 
    6159 
    6260    def __init__(self, vars, limits = None, title = None): 
    63         """ 
    64         Creates a `Matplotlib2DViewer`. 
     61        """Creates a `Matplotlib2DViewer`. 
    6562         
    66         >>> from fipy import * 
    67         >>> from fipy.tools.numerix import * 
    68         >>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    69         >>> x, y = mesh.getCellCenters() 
    70         >>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y) 
    71         >>> k = Variable(name="k") 
    72         >>> viewer = Matplotlib2DGridContourViewer(vars=sin(k * xyVar),  
    73         ...                                        limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    74         ...                                        title="Matplotlib2DGridContourViewer test") 
    75         >>> for kval in range(10): 
    76         ...     k.setValue(kval) 
    77         ...     viewer.plot() 
    78         >>> viewer._promptForOpinion() 
    79         >>> del viewer 
    80  
    8163        :Parameters: 
    8264          - `vars`: A `CellVariable` object. 
     
    148130        pylab.ylim(ymin=self._getLimit('ymin'), 
    149131                   ymax=self._getLimit('ymax')) 
     132                    
     133def _test(): 
     134    from fipy.viewers.viewer import _test2D 
     135    _test2D(Matplotlib2DGridContourViewer) 
    150136 
    151137if __name__ == "__main__":  
  • trunk/fipy/viewers/matplotlibViewer/matplotlib2DGridViewer.py

    r2286 r2608  
    66 #  
    77 #  FILE: "matplotlib2DViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 7/4/07 {8:24:29 PM} { 2:45:36 PM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5352    .. _Matplotlib: http://matplotlib.sourceforge.net/ 
    5453    """ 
    55  
     54     
     55    __doc__ += MatplotlibViewer._test2D(viewer="Matplotlib2DGridViewer") 
    5656 
    5757    def __init__(self, vars, limits = None, title = None): 
     
    5959        Creates a `Matplotlib2DGridViewer`. 
    6060         
    61             >>> from fipy import * 
    62             >>> from fipy.tools.numerix import * 
    63             >>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    64             >>> x, y = mesh.getCellCenters() 
    65             >>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y) 
    66             >>> k = Variable(name="k") 
    67             >>> viewer = Matplotlib2DGridViewer(vars=sin(k * xyVar), 
    68             ...                             limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    69             ...                             title="Matplotlib2DGridViewer test") 
    70             >>> for kval in range(10): 
    71             ...     k.setValue(kval) 
    72             ...     viewer.plot() 
    73             >>> viewer._promptForOpinion() 
    74             >>> del viewer 
    75  
    7661        :Parameters: 
    7762          - `vars`: A `CellVariable` object. 
     
    141126        self.image.set_data(self._getData()) 
    142127 
    143          
     128def _test(): 
     129    from fipy.viewers.viewer import _test2D 
     130    _test2D(Matplotlib2DGridViewer) 
     131 
    144132if __name__ == "__main__":  
    145133    import fipy.tests.doctestPlus 
  • trunk/fipy/viewers/matplotlibViewer/matplotlib2DViewer.py

    r2606 r2608  
    5454 
    5555    .. _Matplotlib: http://matplotlib.sourceforge.net/ 
    56  
    57  
    58     """ 
    59  
     56    """  
     57     
     58    __doc__ += MatplotlibViewer._test2Dirregular(viewer="Matplotlib2DViewer") 
    6059 
    6160    def __init__(self, vars, limits = None, title = None): 
    62         """ 
    63         Creates a `Matplotlib2DViewer`. 
    64          
    65         >>> from fipy import * 
    66         >>> from fipy.tools.numerix import * 
    67         >>> ## mesh = Grid2D(nx=25, ny=10, dx=0.1, dy=0.1) + (Tri2D(nx=25, ny=5, dx=0.1, dy=0.1) + ((25*0.1,), (2*0.1,))) 
    68         >>> mesh = Grid2D(nx=5, ny=10, dx=0.1, dy=0.1) + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1) + ((5*0.1,), (2*0.1,))) 
    69         >>> x, y = mesh.getCellCenters() 
    70         >>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y) 
    71         >>> k = Variable(name="k") 
    72         >>> viewer = Matplotlib2DViewer(vars=sin(k * xyVar),  
    73         ...                             limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    74         ...                             title="Matplotlib2DViewer test") 
    75         >>> for kval in range(10): 
    76         ...     k.setValue(kval) 
    77         ...     viewer.plot() 
    78         >>> viewer._promptForOpinion() 
    79         >>> del viewer 
     61        """Creates a `Matplotlib2DViewer`. 
     62         
    8063 
    8164        :Parameters: 
  • trunk/fipy/viewers/matplotlibViewer/test.py

    r2219 r2608  
    77 #  FILE: "test.py" 
    88 #                                    created: 11/10/03 {3:23:47 PM} 
    9  #                                last update: 4/1/05 {2:47:09 PM}  
     9 #                                last update: 6/23/08 {11:46:40 AM}  
    1010 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1111 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    5151        'matplotlib2DViewer', 
    5252        'matplotlib2DGridViewer', 
     53        'matplotlib2DGridContourViewer', 
    5354        'matplotlibVectorViewer', 
    5455        ), base = __name__) 
  • trunk/fipy/viewers/mayaviViewer/mayaviViewer.py

    r2498 r2608  
    66 #  
    77 #  FILE: "mayaviViewer.py" 
    8  #                                    created: 9/14/04 {2:48:25 PM}  
    9  #                                last update: 7/5/07 {9:33:50 AM} 
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    4948 
    5049class MayaviViewer(Viewer): 
     50    """The `MayaviViewer` creates viewers with the Mayavi_ python plotting package. 
     51 
     52    .. _Mayavi: http://mayavi.sourceforge.net/ 
    5153    """ 
    52     The `MayaviViewer` creates viewers with the Mayavi_ python 
    53     plotting package. 
    54  
    55         >>> from fipy import * 
    56         >>> mesh = Grid1D(nx=100) 
    57         >>> x = mesh.getCellCenters()[0] 
    58         >>> var1 = CellVariable(mesh=mesh, name=r"$sin(x)$", value=numerix.sin(x)) 
    59         >>> var2 = CellVariable(mesh=mesh, name=r"$cos(x/\pi)$", value=numerix.cos(x / numerix.pi)) 
    60         >>> viewer = MayaviViewer(vars=(var1, var2),  
    61         ...                       limits={'xmin':10, 'xmax':90, 'datamin':-0.9, 'datamax':2.0}, 
    62         ...                       title="MayaviViewer test") 
    63         >>> viewer.plot() 
    64         >>> viewer._promptForOpinion() 
    65         >>> del viewer 
    66          
    67         >>> mesh = Grid2D(nx=50, ny=100, dx=0.1, dy=0.01) 
    68         >>> x, y = mesh.getCellCenters() 
    69         >>> var = CellVariable(mesh=mesh, name=r"$sin(x y)$", value=numerix.sin(x * y)) 
    70         >>> viewer = MayaviViewer(vars=var,  
    71         ...                       limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    72         ...                       title="MayaviViewer test") 
    73         >>> viewer.plot() 
    74         >>> viewer._promptForOpinion() 
    75         >>> del viewer 
    76  
    77         >>> mesh = Grid3D(nx=50, ny=100, nz=10, dx=0.1, dy=0.01, dz=0.1) 
    78         >>> x, y, z = mesh.getCellCenters() 
    79         >>> var = CellVariable(mesh=mesh, name=r"$sin(x y z)$", value=numerix.sin(x * y * z)) 
    80         >>> viewer = MayaviViewer(vars=var,  
    81         ...                       limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
    82         ...                       title="MayaviViewer test") 
    83         >>> viewer.plot() 
    84         >>> viewer._promptForOpinion() 
    85         >>> del viewer 
    86  
    87     .. _Mayavi: http://mayavi.sourceforge.net/ 
    88  
     54     
     55    __doc__ += Viewer._test1D(viewer="MayaviViewer") 
     56    __doc__ += Viewer._test2D(viewer="MayaviViewer") 
     57    __doc__ += Viewer._test2Dirregular(viewer="MayaviViewer") 
     58    __doc__ += Viewer._test3D(viewer="MayaviViewer") 
     59     
     60    __doc__ += """ 
    8961    Issues with the `MayaviViewer` are 
    9062 
     
    10678         
    10779    def __init__(self, vars, limits = None, title = None): 
    108         """ 
    109         Create a `MayaviViewer`. 
     80        """Create a `MayaviViewer`. 
    11081         
    11182        :Parameters: 
  • trunk/fipy/viewers/viewer.py

    r2314 r2608  
    66 #  
    77 #  FILE: "viewer.py" 
    8  #                                    created: 11/10/03 {2:48:25 PM}  
    9  #                                last update: 7/17/07 {8:26:13 AM}  
     8 # 
    109 #  Author: Jonathan Guyer <guyer@nist.gov> 
    1110 #  Author: Daniel Wheeler <daniel.wheeler@nist.gov> 
     
    146145    def _validFileExtensions(self): 
    147146        return [] 
    148          
     147     
    149148    def _promptForOpinion(self, prompt="Describe any problems with this figure or hit Return: "): 
    150149        # This method is usually invoked from a test, which can have a weird 
     
    154153        raw_input = inspect.currentframe().f_back.f_globals.get('raw_input', __builtins__['raw_input']) 
    155154         
    156         opinion = raw_input(prompt) 
     155        opinion = raw_input(self.__class__.__name__ + ": " + prompt) 
    157156        if len(opinion.strip()) > 0: 
    158157            extensions = ", ".join(self._validFileExtensions()) 
     
    162161            self.plot(snapshot) 
    163162            print opinion 
    164  
     163               
     164         
     165    def _test1D(**kwargs): 
     166        return """ 
     167            >>> from fipy import * 
     168            >>> mesh = Grid1D(nx=100) 
     169            >>> x, = mesh.getCellCenters() 
     170            >>> xVar = CellVariable(mesh=mesh, name="x", value=x) 
     171            >>> k = Variable(name="k") 
     172            >>> viewer = %(viewer)s(vars=(sin(k * xVar), cos(k * xVar / pi)),  
     173            ...                 limits={'xmin':10, 'xmax':90, 'datamin':-0.9, 'datamax':2.0}, 
     174            ...                 title="%(viewer)s test") 
     175            >>> for kval in numerix.arange(0,0.3,0.03): 
     176            ...     k.setValue(kval) 
     177            ...     viewer.plot() 
     178            >>> viewer._promptForOpinion() 
     179            >>> del viewer 
     180        """ % kwargs 
     181    _test1D = staticmethod(_test1D) 
     182 
     183    def _test2Dbase(**kwargs): 
     184        return """ 
     185            >>> from fipy import * 
     186            >>> mesh = %(mesh)s 
     187            >>> x, y = mesh.getCellCenters() 
     188            >>> xyVar = CellVariable(mesh=mesh, name="x y", value=x * y) 
     189            >>> k = Variable(name="k") 
     190            >>> viewer = %(viewer)s(vars=sin(k * xyVar),  
     191            ...                 limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
     192            ...                 title="%(viewer)s test") 
     193            >>> for kval in range(10): 
     194            ...     k.setValue(kval) 
     195            ...     viewer.plot() 
     196            >>> viewer._promptForOpinion() 
     197            >>> del viewer 
     198        """ % kwargs 
     199    _test2Dbase = staticmethod(_test2Dbase) 
     200 
     201    def _test2D(**kwargs): 
     202        return Viewer._test2Dbase(mesh="Grid2D(nx=50, ny=100, dx=0.1, dy=0.01)", 
     203                                  **kwargs) 
     204    _test2D = staticmethod(_test2D) 
     205 
     206    def _test2Dirregular(**kwargs): 
     207        """""" 
     208        return Viewer._test2Dbase(mesh="""(Grid2D(nx=5, ny=10, dx=0.1, dy=0.1) 
     209            ...         + (Tri2D(nx=5, ny=5, dx=0.1, dy=0.1)  
     210            ...          + ((0.5,), (0.2,))))""", **kwargs) 
     211    _test2Dirregular = staticmethod(_test2Dirregular) 
     212 
     213     
     214    def _test3D(**kwargs): 
     215        return """ 
     216            >>> from fipy import * 
     217            >>> mesh = Grid3D(nx=50, ny=100, nz=10, dx=0.1, dy=0.01, dz=0.1) 
     218            >>> x, y, z = mesh.getCellCenters() 
     219            >>> xyzVar = CellVariable(mesh=mesh, name=r"x y z", value=x * y * z) 
     220            >>> k = Variable(name="k") 
     221            >>> viewer = %(viewer)s(vars=sin(k * xyzVar,  
     222            ...                     limits={'ymin':0.1, 'ymax':0.9, 'datamin':-0.9, 'datamax':2.0}, 
     223            ...                     title="%(viewer)s test") 
     224            >>> for kval in range(10): 
     225            ...     k.setValue(kval) 
     226            ...     viewer.plot() 
     227            >>> viewer._promptForOpinion() 
     228            >>> del viewer 
     229        """ % kwargs 
     230    _test3D = staticmethod(_test3D) 
     231 
     232def make(vars, title=None, limits=None): 
     233    return Viewer(vars=vars, title=title, limits=limits) 
     234