anastruct.basic

Exceptions

FEMException

Common base class for all non-exit exceptions.

Functions

find_nearest(→ Tuple[float, int])

Find the nearest value in an array

integrate_array(→ numpy.ndarray)

Integrate an array y*dx using the trapezoidal rule

arg_to_list(→ list)

Convert an argument to a list of length n

rotation_matrix(→ numpy.ndarray)

Create a 2x2 rotation matrix

rotate_xy(→ numpy.ndarray)

Rotate a 2D matrix around the origin

Module Contents

anastruct.basic.find_nearest(array: numpy.ndarray, value: float) Tuple[float, int][source]

Find the nearest value in an array

Args:

array (np.ndarray): array to search within value (float): value to search for

Returns:

Tuple[float, int]: Nearest value, index

anastruct.basic.integrate_array(y: numpy.ndarray, dx: float) numpy.ndarray[source]

Integrate an array y*dx using the trapezoidal rule

Args:

y (np.ndarray): Array to integrate dx (float): Step size

Returns:

np.ndarray: Integrated array

exception anastruct.basic.FEMException(type_: str, message: str)[source]

Bases: Exception

Common base class for all non-exit exceptions.

type[source]
message[source]
anastruct.basic.arg_to_list(arg: Any, n: int) list[source]

Convert an argument to a list of length n

Args:

arg (Any): Argument to convert n (int): Length of list to create

Returns:

list: List of length n

anastruct.basic.rotation_matrix(angle: float) numpy.ndarray[source]

Create a 2x2 rotation matrix

Args:

angle (float): Angle in radians

Returns:

np.ndarray: 2x2 Euclidean rotation matrix

anastruct.basic.rotate_xy(a: numpy.ndarray, angle: float) numpy.ndarray[source]

Rotate a 2D matrix around the origin

Args:

a (np.ndarray): Matrix to rotate angle (float): Angle in radians

Returns:

np.ndarray: Rotated matrix