Field

class hcipy.field.Field(arr, grid)

Bases: object

The value of some physical quantity for each point in some coordinate system.

Parameters:
arrarray_like

An array of values or tensors for each point in the Grid.

gridGrid

The corresponding Grid on which the values are set.

Attributes:
gridGrid

The grid on which the values are defined.

Attributes Summary

is_scalar_field

True if this field is a scalar field (ie.

is_valid_field

True if the field corresponds with its grid.

is_vector_field

True if this field is a vector field (ie.

shaped

The reshaped version of this field.

tensor_order

The order of the tensor of the field.

tensor_shape

The shape of the tensor of the field.

Methods Summary

at(p)

The value of this field closest to point p.

from_dict(tree)

Make a Field from a dictionary, previously created by to_dict().

to_dict()

Convert the object to a dictionary for serialization.

Attributes Documentation

is_scalar_field

True if this field is a scalar field (ie. a tensor order of 0), False otherwise.

is_valid_field

True if the field corresponds with its grid.

is_vector_field

True if this field is a vector field (ie. a tensor order of 1), False otherwise.

shaped

The reshaped version of this field.

Raises:
ValueError

If this field isn’t separated, no reshaped version can be made.

tensor_order

The order of the tensor of the field.

tensor_shape

The shape of the tensor of the field.

Methods Documentation

at(p)

The value of this field closest to point p.

Parameters:
parray_like

The point at which the closest value should be returned.

Returns:
array_like

The value, potentially tensor, closest to point p.

classmethod from_dict(tree)

Make a Field from a dictionary, previously created by to_dict().

Parameters:
treedictionary

The dictionary from which to make a new Field object.

Returns:
Field

The created object.

Raises:
ValueError

If the dictionary is not formatted correctly.

to_dict()

Convert the object to a dictionary for serialization.

Returns:
dictionary

The created dictionary.