Skip to content

designs

designs

Super class for all design classes (factorial and spacefilling).

Attributes:

Name Type Description
designs List

A list of designs.

k int

The dimension of the design.

seed int

The seed for the random number generator.

rng Generator

A random number generator instance.

Source code in spotpython/design/designs.py
 5
 6
 7
 8
 9
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
38
39
40
41
42
43
44
45
46
47
class designs:
    """
    Super class for all design classes (factorial and spacefilling).

    Attributes:
        designs (List):
            A list of designs.
        k (int):
            The dimension of the design.
        seed (int):
            The seed for the random number generator.
        rng (Generator):
            A random number generator instance.
    """

    def __init__(self, k: int = 2, seed: int = 123) -> None:
        """
        Initializes a Designs object with the given dimension and seed.

        Args:
            k (int):
                The dimension of the design. Defaults to 2.
            seed (int):
                The seed for the random number generator. Defaults to 123.
        Examples:
            >>> designs = designs(k=2, seed=123)
            >>> designs.get_dim()
            2

        """
        self.designs: List = []
        self.k: int = k
        self.seed: int = seed
        self.rng = default_rng(self.seed)

    def get_dim(self) -> int:
        """
        Returns the dimension of the design.

        Returns:
            int: The dimension of the design.
        """
        return self.k

__init__(k=2, seed=123)

Initializes a Designs object with the given dimension and seed.

Parameters:

Name Type Description Default
k int

The dimension of the design. Defaults to 2.

2
seed int

The seed for the random number generator. Defaults to 123.

123

Examples: >>> designs = designs(k=2, seed=123) >>> designs.get_dim() 2

Source code in spotpython/design/designs.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
def __init__(self, k: int = 2, seed: int = 123) -> None:
    """
    Initializes a Designs object with the given dimension and seed.

    Args:
        k (int):
            The dimension of the design. Defaults to 2.
        seed (int):
            The seed for the random number generator. Defaults to 123.
    Examples:
        >>> designs = designs(k=2, seed=123)
        >>> designs.get_dim()
        2

    """
    self.designs: List = []
    self.k: int = k
    self.seed: int = seed
    self.rng = default_rng(self.seed)

get_dim()

Returns the dimension of the design.

Returns:

Name Type Description
int int

The dimension of the design.

Source code in spotpython/design/designs.py
40
41
42
43
44
45
46
47
def get_dim(self) -> int:
    """
    Returns the dimension of the design.

    Returns:
        int: The dimension of the design.
    """
    return self.k