src.matnimation.helper package

Submodules

src.matnimation.helper.helper_functions module

class src.matnimation.helper.helper_functions.HelperFunctions

Bases: object

FxFy_to_grid(func_Fy: Callable, x_array: ndarray, y_array: ndarray, t_array: ndarray) ndarray

Given a 2D vector field vec[F](x,y,t) = F_x(x,y,t) * xhat + F_y(x,y,t) * yhat, the arguments are:

  • The Callable functions func_Fx and func_Fy correspond to the mathematical functions F_x(x,y,t) and F_y(x,y,t), and should have signature (x: float, y: float, t: float).

  • The 1D arrays x_array = [x1, x2, … xN] and y_array = [y1, y2, …, yN] contain the (x,y) coordinates of the N points at which vec[F] should be plotted.

  • The time array t_array = [t1, t2, … tM] contains the M chronological timevalues at which the field should be plotted.

Warning: x_array and y_array must have the same length!

Returns: Fx_data: 2D numpy array with F_x components at all N plotting points (rows) and timesteps (cols), #nrows = N, #cols = M Fy_data: 2D numpy array with F_y components at all N plotting points (rows) and timesteps (cols), #nrows = N, #cols = M

__init__()
func_ab_to_grid(a: ndarray, b: ndarray, **func_kwargs) ndarray

Takes a mathematical function f(a,b) called func, and two 1D arrays a and b. Returns a 2D numpy array called func_grid, where entry [i,j] contains function value func(a[i], b[j]).

xy_grid(y_grid: ndarray)

Given x_grid = [x1, …, xM] and y_grid = [y1, …, yN], make an (x,y) coordinate grid of size (M,N):

# —————————– # | (x1,y1) … (xM,y1) | | : : | | : : | | (x1,yN) … (xM,yN) | # —————————– #

Return the grid as 1D arrays for x and y, which have the form:

x_array = [x1,…,xM, x1,…,xM, … x1,…,xM] total of N copies of x1,…,xM y_array = [y1,…,y1, y2,…,y2, … yN,…,yN] total of N copies of yi,…,yi

Module contents