From 9239820a50b140130f89841ebabf02325f156aa1 Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Wed, 10 Jan 2024 12:46:10 -0500 Subject: [PATCH] Tweak documentation (#991) * Update index syntax * Account for missing FIPY_DISPLAY_MATRIX environment variable * Fix parameter syntax * Don't ignore things that no longer exist --- .gitignore | 1 - examples/cahnHilliard/tanh1D.py | 2 +- examples/convection/exponential1D/cylindricalMesh1D.py | 2 +- .../exponential1D/cylindricalMesh1DNonUniform.py | 2 +- examples/convection/exponential1D/mesh1D.py | 2 +- examples/convection/exponential1DSource/mesh1D.py | 2 +- examples/convection/exponential2D/cylindricalMesh2D.py | 2 +- .../exponential2D/cylindricalMesh2DNonUniform.py | 2 +- examples/diffusion/circle.py | 10 +++++----- examples/diffusion/circleQuad.py | 10 +++++----- examples/diffusion/mesh1D.py | 2 +- examples/diffusion/mesh20x20.py | 2 +- examples/diffusion/mesh20x20Coupled.py | 2 +- examples/diffusion/nthOrder/input4thOrder1D.py | 2 +- examples/flow/stokesCavity.py | 2 +- examples/levelSet/electroChem/gold.py | 2 +- examples/levelSet/electroChem/howToWriteAScript.py | 2 +- examples/levelSet/electroChem/leveler.py | 2 +- examples/levelSet/electroChem/simpleTrenchSystem.py | 2 +- examples/phase/anisotropyOLD.py | 2 +- examples/phase/binary.py | 2 +- examples/phase/binaryCoupled.py | 4 ++-- examples/phase/impingement/mesh20x20.py | 6 +++--- examples/phase/impingement/mesh40x1.py | 2 +- examples/phase/quaternary.py | 2 +- examples/phase/simple.py | 4 ++-- examples/updating/update0_1to1_0.py | 2 +- fipy/terms/abstractConvectionTerm.py | 3 ++- .../matplotlibViewer/matplotlibSparseMatrixViewer.py | 2 +- .../viewers/matplotlibViewer/matplotlibStreamViewer.py | 2 +- 30 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.gitignore b/.gitignore index d4f6ef241d..9595c3533d 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,6 @@ FiPy.egg-info MANIFEST.in dist/ -documentation/_build/ generated/ *.logamgx *.dump.gz diff --git a/examples/cahnHilliard/tanh1D.py b/examples/cahnHilliard/tanh1D.py index 15afd02f8a..f772b3d6e5 100755 --- a/examples/cahnHilliard/tanh1D.py +++ b/examples/cahnHilliard/tanh1D.py @@ -127,7 +127,7 @@ If we are running interactively, we create a viewer to see the results .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var, datamin=0., datamax=1.0) diff --git a/examples/convection/exponential1D/cylindricalMesh1D.py b/examples/convection/exponential1D/cylindricalMesh1D.py index 66e4cfd879..b4e083d37a 100644 --- a/examples/convection/exponential1D/cylindricalMesh1D.py +++ b/examples/convection/exponential1D/cylindricalMesh1D.py @@ -90,7 +90,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/convection/exponential1D/cylindricalMesh1DNonUniform.py b/examples/convection/exponential1D/cylindricalMesh1DNonUniform.py index c42694571e..233c65dc2c 100644 --- a/examples/convection/exponential1D/cylindricalMesh1DNonUniform.py +++ b/examples/convection/exponential1D/cylindricalMesh1DNonUniform.py @@ -92,7 +92,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/convection/exponential1D/mesh1D.py b/examples/convection/exponential1D/mesh1D.py index 172a52491a..f5a74765c8 100755 --- a/examples/convection/exponential1D/mesh1D.py +++ b/examples/convection/exponential1D/mesh1D.py @@ -88,7 +88,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/convection/exponential1DSource/mesh1D.py b/examples/convection/exponential1DSource/mesh1D.py index 84d2e04959..78e2b7c7e0 100755 --- a/examples/convection/exponential1DSource/mesh1D.py +++ b/examples/convection/exponential1DSource/mesh1D.py @@ -85,7 +85,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/convection/exponential2D/cylindricalMesh2D.py b/examples/convection/exponential2D/cylindricalMesh2D.py index d7d6e8b23b..6c3de2510f 100644 --- a/examples/convection/exponential2D/cylindricalMesh2D.py +++ b/examples/convection/exponential2D/cylindricalMesh2D.py @@ -92,7 +92,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/convection/exponential2D/cylindricalMesh2DNonUniform.py b/examples/convection/exponential2D/cylindricalMesh2DNonUniform.py index 81254af283..1d09efbec4 100644 --- a/examples/convection/exponential2D/cylindricalMesh2DNonUniform.py +++ b/examples/convection/exponential2D/cylindricalMesh2DNonUniform.py @@ -90,7 +90,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=var) diff --git a/examples/diffusion/circle.py b/examples/diffusion/circle.py index 91431736b3..516066ac7b 100755 --- a/examples/diffusion/circle.py +++ b/examples/diffusion/circle.py @@ -41,7 +41,7 @@ Using this mesh, we can construct a solution variable .. index:: - object: fipy.variables.cellVariable.CellVariable + pair: object; fipy.variables.cellVariable.CellVariable >>> phi = CellVariable(name = "solution variable", ... mesh = mesh, @@ -63,8 +63,8 @@ We set up a transient diffusion equation .. index:: - object: fipy.terms.transientTerm.TransientTerm - object: fipy.terms.implicitDiffusionTerm.DiffusionTerm + pair: object; fipy.terms.transientTerm.TransientTerm + pair: object; fipy.terms.implicitDiffusionTerm.DiffusionTerm >>> D = 1. >>> eq = TransientTerm() == DiffusionTerm(coeff=D) @@ -98,7 +98,7 @@ another application, we could export tab-separated-values with .. index:: - object: fipy.viewers.tsvViewer.TSVViewer + pair: object; fipy.viewers.tsvViewer.TSVViewer :: @@ -124,7 +124,7 @@ ... mesh=mesh) # doctest: +GMSH .. index:: - module: scipy + pair: module; scipy single: sqrt; arcsin; cos >>> x0 = radius * numerix.cos(numerix.arcsin(y)) # doctest: +GMSH diff --git a/examples/diffusion/circleQuad.py b/examples/diffusion/circleQuad.py index 82143ad60e..841ee919b7 100755 --- a/examples/diffusion/circleQuad.py +++ b/examples/diffusion/circleQuad.py @@ -42,7 +42,7 @@ Using this mesh, we can construct a solution variable .. index:: - object: fipy.variables.cellVariable.CellVariable + pair: object; fipy.variables.cellVariable.CellVariable >>> phi = CellVariable(name = "solution variable", ... mesh = mesh, @@ -64,8 +64,8 @@ We set up a transient diffusion equation .. index:: - object: fipy.terms.transientTerm.TransientTerm - object: fipy.terms.implicitDiffusionTerm.DiffusionTerm + pair: object; fipy.terms.transientTerm.TransientTerm + pair: object; fipy.terms.implicitDiffusionTerm.DiffusionTerm >>> D = 1. >>> eq = TransientTerm() == DiffusionTerm(coeff=D) @@ -97,7 +97,7 @@ another application, we could export tab-separated-values with .. index:: - object: fipy.viewers.tsvViewer.TSVViewer + pair: object; fipy.viewers.tsvViewer.TSVViewer :: @@ -123,7 +123,7 @@ ... mesh=mesh) # doctest: +GMSH .. index:: - module: scipy + pair: module; scipy single: sqrt; arcsin; cos >>> x0 = radius * numerix.cos(numerix.arcsin(y)) # doctest: +GMSH diff --git a/examples/diffusion/mesh1D.py b/examples/diffusion/mesh1D.py index 912fad22d2..f00da784c5 100755 --- a/examples/diffusion/mesh1D.py +++ b/examples/diffusion/mesh1D.py @@ -114,7 +114,7 @@ viewers and the dimension of the mesh. .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> phiAnalytical = CellVariable(name="analytical value", ... mesh=mesh) diff --git a/examples/diffusion/mesh20x20.py b/examples/diffusion/mesh20x20.py index c9ba1029b4..ba0ff21d98 100755 --- a/examples/diffusion/mesh20x20.py +++ b/examples/diffusion/mesh20x20.py @@ -48,7 +48,7 @@ We create a viewer to see the results .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=phi, datamin=0., datamax=1.) diff --git a/examples/diffusion/mesh20x20Coupled.py b/examples/diffusion/mesh20x20Coupled.py index f973ca23c9..e8c087a833 100755 --- a/examples/diffusion/mesh20x20Coupled.py +++ b/examples/diffusion/mesh20x20Coupled.py @@ -48,7 +48,7 @@ We create a viewer to see the results .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=phi, datamin=0., datamax=1.) diff --git a/examples/diffusion/nthOrder/input4thOrder1D.py b/examples/diffusion/nthOrder/input4thOrder1D.py index 57262d383d..ce88461f5f 100755 --- a/examples/diffusion/nthOrder/input4thOrder1D.py +++ b/examples/diffusion/nthOrder/input4thOrder1D.py @@ -88,7 +88,7 @@ If the problem is run interactively, we can view the result: .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=(var, analytical)) diff --git a/examples/flow/stokesCavity.py b/examples/flow/stokesCavity.py index 1e52b5f7ed..457bddfeec 100755 --- a/examples/flow/stokesCavity.py +++ b/examples/flow/stokesCavity.py @@ -214,7 +214,7 @@ Set up the viewers, .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=(pressure, xVelocity, yVelocity, velocity), diff --git a/examples/levelSet/electroChem/gold.py b/examples/levelSet/electroChem/gold.py index f53f63e4b2..8965708315 100644 --- a/examples/levelSet/electroChem/gold.py +++ b/examples/levelSet/electroChem/gold.py @@ -27,7 +27,7 @@ more complex mesh. .. index:: - module: gmsh + pair: module; gmsh There are a few differences between the gold superfill model presented in this example and in :mod:`examples.levelSet.electroChem.simpleTrenchSystem`. diff --git a/examples/levelSet/electroChem/howToWriteAScript.py b/examples/levelSet/electroChem/howToWriteAScript.py index 8b86212970..a66938d621 100644 --- a/examples/levelSet/electroChem/howToWriteAScript.py +++ b/examples/levelSet/electroChem/howToWriteAScript.py @@ -80,7 +80,7 @@ Build the mesh: .. index:: - module: fipy.tools.parser + pair: module; fipy.tools.parser >>> from fipy.tools.parser import parse >>> numberOfElements = parse('--numberOfElements', action='store', diff --git a/examples/levelSet/electroChem/leveler.py b/examples/levelSet/electroChem/leveler.py index 6916ad0241..96e1549ea6 100755 --- a/examples/levelSet/electroChem/leveler.py +++ b/examples/levelSet/electroChem/leveler.py @@ -26,7 +26,7 @@ construct the mesh. .. index:: - module: gmsh + pair: module; gmsh This example models the case when suppressor, accelerator and leveler additives are present in the electrolyte. The suppressor is diff --git a/examples/levelSet/electroChem/simpleTrenchSystem.py b/examples/levelSet/electroChem/simpleTrenchSystem.py index 03abe48feb..c2bd4084f8 100644 --- a/examples/levelSet/electroChem/simpleTrenchSystem.py +++ b/examples/levelSet/electroChem/simpleTrenchSystem.py @@ -54,7 +54,7 @@ complex meshes requiring the :command:`gmsh` software. .. index:: - module: gmsh + pair: module; gmsh .. this is kind of nasty, but reST tables can't handle what we need, particularly decimal alignment diff --git a/examples/phase/anisotropyOLD.py b/examples/phase/anisotropyOLD.py index 673a60e03b..377ca04da0 100755 --- a/examples/phase/anisotropyOLD.py +++ b/examples/phase/anisotropyOLD.py @@ -172,7 +172,7 @@ the phase and temperature fields .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... phaseViewer = Viewer(vars=phase) diff --git a/examples/phase/binary.py b/examples/phase/binary.py index 38efc4a25d..3a3471437e 100755 --- a/examples/phase/binary.py +++ b/examples/phase/binary.py @@ -470,7 +470,7 @@ def deltaChemPot(phase, C, T): >>> sharp.setValue(Cl, where=x >= L * fraction) .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=(phase, C, sharp), diff --git a/examples/phase/binaryCoupled.py b/examples/phase/binaryCoupled.py index 9a64f678fa..138af43e7b 100755 --- a/examples/phase/binaryCoupled.py +++ b/examples/phase/binaryCoupled.py @@ -457,7 +457,7 @@ def deltaChemPot(phase, C, T): ... [ 1. / C[0], -1. / C[1]]]) .. index:: - module: scipy + pair: module; scipy >>> try: ... from scipy.optimize import fsolve # doctest: +SCIPY @@ -481,7 +481,7 @@ def deltaChemPot(phase, C, T): >>> sharp.setValue(Cl, where=x >= L * fraction) .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=(phase, C, sharp), diff --git a/examples/phase/impingement/mesh20x20.py b/examples/phase/impingement/mesh20x20.py index d04c9fd9a5..d6c49ada6c 100755 --- a/examples/phase/impingement/mesh20x20.py +++ b/examples/phase/impingement/mesh20x20.py @@ -5,7 +5,7 @@ with different initial conditions and a 2D mesh: .. index:: - module: fipy.tools.parser + pair: module; fipy.tools.parser >>> from fipy.tools.parser import parse @@ -158,7 +158,7 @@ by the phase .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> if __name__ == '__main__': ... phaseViewer = Viewer(vars=phase, datamin=0., datamax=1.) @@ -227,7 +227,7 @@ We save the variables to disk. .. index:: - module: fipy.tools.dump + pair: module; fipy.tools.dump >>> (f, filename) = dump.write({'phase' : phase, 'theta' : theta}, extension = '.gz') diff --git a/examples/phase/impingement/mesh40x1.py b/examples/phase/impingement/mesh40x1.py index 58820c4e38..f21f68637e 100755 --- a/examples/phase/impingement/mesh40x1.py +++ b/examples/phase/impingement/mesh40x1.py @@ -173,7 +173,7 @@ and orientation variables. .. index:: - module: fipy.viewers + pair: module; fipy.viewers .. index:: single: :math:`\pi` diff --git a/examples/phase/quaternary.py b/examples/phase/quaternary.py index b5b578dd09..dd9b98fbf9 100755 --- a/examples/phase/quaternary.py +++ b/examples/phase/quaternary.py @@ -345,7 +345,7 @@ If we're running interactively, we create a viewer .. index:: - module: viewers + pair: module; viewers >>> if __name__ == '__main__': ... viewer = Viewer(vars=([phase] diff --git a/examples/phase/simple.py b/examples/phase/simple.py index a4dfd99747..378e6153bb 100755 --- a/examples/phase/simple.py +++ b/examples/phase/simple.py @@ -78,7 +78,7 @@ If we are running interactively, we'll want a viewer to see the results .. index:: - module: fipy.viewers + pair: module; fipy.viewers >>> from fipy import input >>> if __name__ == '__main__': @@ -465,7 +465,7 @@ thickness .. index:: - module: scipy + pair: module; scipy >>> try: ... def tanhResiduals(p, y, x, t): diff --git a/examples/updating/update0_1to1_0.py b/examples/updating/update0_1to1_0.py index fbe1c56037..6c13e600a7 100755 --- a/examples/updating/update0_1to1_0.py +++ b/examples/updating/update0_1to1_0.py @@ -138,7 +138,7 @@ or .. index:: - module: fipy.numerix + pair: module; fipy.numerix >>> axis = 0 >>> x = mesh.getCellCenters()[:, axis] diff --git a/fipy/terms/abstractConvectionTerm.py b/fipy/terms/abstractConvectionTerm.py index e04012bb11..52c933f265 100644 --- a/fipy/terms/abstractConvectionTerm.py +++ b/fipy/terms/abstractConvectionTerm.py @@ -66,7 +66,8 @@ def __init__(self, coeff=1.0, var=None): Parameters ---------- - coeff : The `Term`'s coefficient value. + coeff : :class:`~fipy.variables.meshVariable.MeshVariable` + The :class:`~fipy.terms.term.Term`'s coefficient value. """ if self.__class__ is _AbstractConvectionTerm: raise AbstractBaseClassError diff --git a/fipy/viewers/matplotlibViewer/matplotlibSparseMatrixViewer.py b/fipy/viewers/matplotlibViewer/matplotlibSparseMatrixViewer.py index 19607b0f37..145c99ecb1 100644 --- a/fipy/viewers/matplotlibViewer/matplotlibSparseMatrixViewer.py +++ b/fipy/viewers/matplotlibViewer/matplotlibSparseMatrixViewer.py @@ -46,7 +46,7 @@ def plot(self, matrix, RHSvector, log='auto'): import tempfile import os - if "print" in os.environ['FIPY_DISPLAY_MATRIX'].lower().split(): + if "print" in os.environ.get('FIPY_DISPLAY_MATRIX', '').lower().split(): print("-"*75) print(self.title) print("-"*75) diff --git a/fipy/viewers/matplotlibViewer/matplotlibStreamViewer.py b/fipy/viewers/matplotlibViewer/matplotlibStreamViewer.py index 62a0e02c7b..7c86ef3ed8 100644 --- a/fipy/viewers/matplotlibViewer/matplotlibStreamViewer.py +++ b/fipy/viewers/matplotlibViewer/matplotlibStreamViewer.py @@ -52,7 +52,7 @@ def __init__(self, vars, title=None, log=False, limits={}, axes=None, figaspect= 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 + density : float or tuple of 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