Skip to content

API references

A brief description of the available functions and classes in mypackage is provided below.

mypackage.foo

A generic module to use as example.

This module provides:

  • a_function(x, dim): a function tailored for a calculation.

a_function(x, dim)

Define a generic function.

Parameters:

Name Type Description Default
x float

The function's argument array.

required
dim int

Number of dimensions to expand.

required

Returns:

Type Description
ndarray

The evaluated function at the given input array.

Source code in src/mypackage/foo.py
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
def a_function(x: float, dim: int) -> np.ndarray:
    """
    Define a generic function.

    :param x:
        The function's argument array.

    :param dim:
        Number of dimensions to expand.

    :return:
        The evaluated function at the given input array.
    """
    f = np.ones(dim) + x
    return f

mypackage.goo

Another dummy module to be use as an example.

This module provides:

  • calculate_something_big(x, dim): a function that performs a nice calculation.

calculate_something_big(x, slope=1.0, y_intercept=0.0)

This function calculates something big.

In summary, this function calculates a linear relationship between x and y. This relationship is given as:

\[ y = m x + b, \]

where m is the slope and b is the y_intercept, both are exposed as args to this function.

Parameters:

Name Type Description Default
x float

The independent variable.

required
slope float

The slope of the linear function.

1.0
y_intercept float

The value that the linear function intercepts the y-axis.

0.0

Returns:

Type Description
float

The dependent variable of the linear function (y).

Source code in src/mypackage/goo.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
def calculate_something_big(x: float, slope: float = 1.0, y_intercept: float = 0.0) -> float:
    """
    This function calculates something big.

    In summary, this function calculates a linear relationship between x and y.
    This relationship is given as:

    $$
    y = m x + b,
    $$

    where `m` is the slope and `b` is the `y_intercept`, both are exposed as
    args to this function.

    :param x:
        The independent variable.

    :param slope:
        The slope of the linear function.

    :param y_intercept:
        The value that the linear function intercepts the y-axis.

    :return:
        The dependent variable of the linear function (y).
    """
    f = slope * x + y_intercept
    return f