FieldQuantity#

class FieldQuantity#

Bases: object

A functor representing a physical field quantity.

__init__(impl)#
property name: str#

Return instance’s name.

property unit: str#

Return the unit of the quantity.

Returns:

unit – The unit of the quantity, the default value is an empty string.

Return type:

str

property ncomp: int#

Return the number of components of the quantity.

In most cases this would be either 1 (scalar field) or 3 (vector fields).

Returns:

ncomp – The number of components of the quantity.

Return type:

int

property grid: Grid#

Return grid on which the quantity will be evaluated.

Returns:

grid – The grid on which the quantity will be evaluated.

Return type:

Grid

property shape#

Return the shape of the output numpy array of this quantity.

Returns:

shape – The shape of the output numpy array of this quantity.

Return type:

tuple of ints

eval()#

Evaluate the quantity.

average()#

Evaluate the quantity and return the average of each component.

Return type:

float

get_rgb()#

Evaluate the vector field quantity and return its rgb representation as a numpy ndarray of the same shape (3, nz, ny, nx).

Note

The final color scheme is different from mumax³. In this case, the saturation does not depend on the z-component anymore, meaning the z=0 plane remains unchanged, but other colors will appear slightly less saturated. This ensures that the color sphere is continuous everywhere, particularly when crossing the xz- or yz-plane with a normalized length less than 1, where the colors will fade through gray.

property meshgrid#

Return a numpy meshgrid with the x, y, and z coordinate of each cell.