bluemira.magnetostatics.tools
Just-in-time compilation and LowLevelCallable speed-up tools.
Functions
|
Decorator for coordinate input handling in array-return functions and methods. |
|
Parse Coordinates or array to an array. |
|
Decorator for 6-argument integrand function to a low-level callable. |
|
Decorator for 4-argument integrand function to a low-level callable. |
|
Decorator for 3-argument integrand function to a low-level callable. |
|
Decorator for 2-argument integrand function to a low-level callable. |
|
Utility for integration of a function between bounds. Easier to refactor |
|
Utility for n-dimensional integration of a function between bounds. Easier |
Module Contents
- bluemira.magnetostatics.tools.process_xyz_array(func)
Decorator for coordinate input handling in array-return functions and methods.
- Returns:
decorator
- Return type:
wrapper
- Raises:
MagnetostaticsError – Coordinates must be the same length and 1D or 2D
- bluemira.magnetostatics.tools.process_coords_array(shape: numpy.ndarray | bluemira.geometry.coordinates.Coordinates) numpy.ndarray
Parse Coordinates or array to an array.
- Parameters:
shape (numpy.ndarray | bluemira.geometry.coordinates.Coordinates) – The Coordinates or array to make into a coordinate array
- Returns:
Array in proper dimensions
- Return type:
shape
- Raises:
MagnetostaticsError – Unknown Type
- bluemira.magnetostatics.tools.jit_llc7(f_integrand: collections.abc.Callable) scipy.LowLevelCallable
Decorator for 6-argument integrand function to a low-level callable.
- Parameters:
f_integrand (collections.abc.Callable) – The integrand function
- Returns:
The decorated integrand function as a LowLevelCallable
- Return type:
scipy.LowLevelCallable
- bluemira.magnetostatics.tools.jit_llc5(f_integrand: collections.abc.Callable) scipy.LowLevelCallable
Decorator for 4-argument integrand function to a low-level callable.
- Parameters:
f_integrand (collections.abc.Callable) – The integrand function
- Returns:
The decorated integrand function as a LowLevelCallable
- Return type:
scipy.LowLevelCallable
- bluemira.magnetostatics.tools.jit_llc4(f_integrand: collections.abc.Callable) scipy.LowLevelCallable
Decorator for 3-argument integrand function to a low-level callable.
- Parameters:
f_integrand (collections.abc.Callable) – The integrand function
- Returns:
The decorated integrand function as a LowLevelCallable
- Return type:
scipy.LowLevelCallable
- bluemira.magnetostatics.tools.jit_llc3(f_integrand: collections.abc.Callable) scipy.LowLevelCallable
Decorator for 2-argument integrand function to a low-level callable.
- Parameters:
f_integrand (collections.abc.Callable) – The integrand function
- Returns:
The decorated integrand function as a LowLevelCallable
- Return type:
scipy.LowLevelCallable
- bluemira.magnetostatics.tools.integrate(func: collections.abc.Callable, args: collections.abc.Iterable, bound1: float, bound2: float) float
Utility for integration of a function between bounds. Easier to refactor integration methods.
- Parameters:
func (collections.abc.Callable) – The function to integrate. The integration variable should be the last argument of this function.
args (collections.abc.Iterable) – The iterable of static arguments to the function.
bound1 (float) – The lower integration bound
bound2 (float) – The upper integration bound
- Returns:
The value of the integral of the function between the bounds
- Raises:
MagnetostaticsIntegrationError – Integration failed
- Return type:
float
- bluemira.magnetostatics.tools.n_integrate(func: collections.abc.Callable, args: collections.abc.Iterable, bounds: list[collections.abc.Iterable[int | float]]) float
Utility for n-dimensional integration of a function between bounds. Easier to refactor integration methods.
- Parameters:
func (collections.abc.Callable) – The function to integrate. The integration variable should be the last argument of this function.
args (collections.abc.Iterable) – The iterable of static arguments to the function.
bounds (list[collections.abc.Iterable[int | float]]) – The list of lower and upper integration bounds applied to x[0], x[1], ..
- Returns:
The value of the integral of the function between the bounds
- Return type:
float