Skip to content

Commit 56a74b5

Browse files
committed
TL: polished documentation
1 parent f0136e6 commit 56a74b5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

pySDC/helpers/fieldsIO.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,23 @@
1414
Example
1515
-------
1616
>>> import numpy as np
17-
>>> from pySDC.helpers.fieldsIO import Rectilinear, FieldsIO
17+
>>> from pySDC.helpers.fieldsIO import Rectilinear
1818
>>>
1919
>>> # Write some fields in files
20-
>>> x = np.linspace(0, 1, 101)
20+
>>> x = np.linspace(0, 1, 128)
21+
>>> y = np.linspace(0, 1, 64)
2122
>>> fOut = Rectilinear(np.float64, "file.pysdc")
22-
>>> fOut.setHeader(nVar=2, coords=x)
23+
>>> fOut.setHeader(nVar=2, coords=[x, y])
2324
>>> fOut.initialize()
2425
>>> times = [0, 1, 2]
25-
>>> u0 = np.array([-1, 1])[:, None]*x[None, :]
26+
>>> xGrid, yGrid = np.meshgrid(x, y, indexing="ij")
27+
>>> u0 = np.array([-1, 1]).reshape((-1, 1, 1))*xGrid*yGrid
28+
>>> # u0 has shape [2, nX, nY]
2629
>>> for t in times:
2730
>>> fOut.addField(t, t*u0)
2831
>>>
29-
>>> # Read the file using a the generic interface
32+
>>> # Read the file using the generic interface
33+
>>> from pySDC.helpers.fieldsIO import FieldsIO
3034
>>> fIn = FieldsIO.fromFile("file.pysdc")
3135
>>> times = fIn.times
3236
>>> assert len(times) == fIn.nFields
@@ -36,7 +40,7 @@
3640
Notes
3741
-----
3842
🚀 :class:`Rectilinear` is compatible with a MPI-based cartesian decomposition.
39-
See :class:`pySDC.tests.test_helpers.test_fieldsIO.writeFields_MPI` for an illustrative example.
43+
See :class:`pySDC.helpers.fieldsIO.writeFields_MPI` for an illustrative example.
4044
4145
Warning
4246
-------

0 commit comments

Comments
 (0)