pyvale.sensorsim.fieldtransform module

Functions for transforming vector and tensor fields based on an input transformation matrix.

transform_vector_2d(trans_mat, vector)[source]

Transforms a 2D vector field based on the input transformation matrix.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (2, 2).

  • vector (np.ndarray) – Vector field with shape (2, num_points), where row 0 is the X component and row 1 is the Y component.

Returns:

np.ndarray – Transformed vector field with shape (2, num_points).

transform_vector_3d(trans_mat, vector)[source]

Transforms a 3D vector field based on the input transformation matrix.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (3, 3).

  • vector (np.ndarray) – Vector field with shape (3, num_points), where rows are X, Y, and Z components of the vector field.

Returns:

np.ndarray – Transformed vector field with shape (3, num_points).

transform_vector_2d_batch(trans_mat, vector)[source]

Performs a batched 2D vector transformation for an array of sensors.

Assumes all sensors share the same transformation matrix.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (2, 2).

  • vector (np.ndarray) – Input vector field with shape (num_sensors, 2, num_time_steps) where dimension 1 holds the X and Y components.

Returns:

np.ndarray – Transformed vector field with shape (num_sensors, 2, num_time_steps).

transform_vector_3d_batch(trans_mat, vector)[source]

Performs a batched 3D vector transformation for an array of sensors.

Assumes all sensors share the same transformation matrix.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (3, 3).

  • vector (np.ndarray) – Input vector field with shape (num_sensors, 3, num_time_steps) where dimension 1 holds X, Y, and Z components.

Returns:

np.ndarray – Transformed vector field with shape (num_sensors, 3, num_time_steps).

transform_tensor_2d(trans_mat, tensor)[source]

Transforms a 2D symmetric tensor field (XX, YY, XY).

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (2, 2).

  • tensor (np.ndarray) – Tensor field with shape (3, num_points) where rows are the XX, YY, and XY components.

Returns:

np.ndarray – Transformed tensor field with shape (3, num_points).

transform_tensor_3d(trans_mat, tensor)[source]

Transforms a 3D symmetric tensor field (XX, YY, ZZ, XY, XZ, YZ).

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (3, 3).

  • tensor (np.ndarray) – Tensor field with shape (6, num_points) where rows are the XX, YY, ZZ, XY, XZ, and YZ components.

Returns:

np.ndarray – Transformed tensor field with shape (6, num_points).

transform_tensor_2d_batch(trans_mat, tensor)[source]

Performs a batched transformation of a 2D symmetric tensor field.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (2, 2).

  • tensor (np.ndarray) – Tensor field with shape (num_sensors, 3, num_time_steps) where dimension 1 holds the XX, YY, and XY components.

Returns:

np.ndarray – Transformed tensor field with shape (num_sensors, 3, num_time_steps).

transform_tensor_3d_batch(trans_mat, tensor)[source]

Performs a batched transformation of a 3D symmetric tensor field.

Parameters:
  • trans_mat (np.ndarray) – Transformation matrix with shape (3, 3).

  • tensor (np.ndarray) – Tensor field with shape (num_sensors, 6, num_time_steps) where dimension 1 holds the XX, YY, ZZ, XY, XZ, and YZ components.

Returns:

np.ndarray – Transformed tensor field with shape (num_sensors, 6, num_time_steps).

validate_rotation_planar_2d(rmat, tol=1e-06)[source]

Validates that a 3D rotation matrix represents a planar rotation about Z.

Parameters:
  • rmat (np.ndarray) – Transformation matrix with shape (3, 3) or larger.

  • tol (float, optional) – Tolerance for checking out-of-plane elements (default 1e-6).

Raises:

ValueError – If any out-of-plane rotation component exceeds tolerance.