Welcome to example-sphinx’s documentation!¶
Contents:
Example of a module with a class and a function autodocumented by sphinx and readthedos.
- class myexpackage.classmodule.myclass(val)[source]¶
Class holding a single member variable x.
Parameters: val : float, mandatory
initial value of the instance variable x
Attributes
var (float storing member value x) Methods
- myexpackage.classmodule.myfunc(x)[source]¶
returns the square of the argument x.
Parameters: x : float, mandatory
value that you want to square
Returns: xsquared: float, desired square of x
Examples
>>> myfunc(2.0) 4.0
Added to check the building of documentation with two modules
- myexpackage.funcmodule.newfunc(x)[source]¶
returns the argument
Parameters: x : float, mandatory
single argument x of the function
Returns: xvalue : float, returns the argument f the function
Note
Yes, this is a stupid function.
Examples
>>> x = newfunc(2.) >>> x * x 4.0 >>> newfunc(3.) 3.0
- myexpackage.funcmodule.readmatrix(fname, exampledata=True)[source]¶
reads the matrix in an ASCII file to a np.ndarray
Parameters: fname: mandatory, string
filename for ASCII file containing the data
exampledata: bool, optional defaults to True
if true, implies that the file is in the exampledata directory
Returns: matrix : np.ndarray
Examples
>>> import numpy as np >>> d = readmatrix('smallmatrix.dat') >>> max( abs (d[0] - np.array([3., 2., 1.])) ) < 1.0e-4 True