OldStyleField

class hcipy.field.OldStyleField(arr, grid)[source]

Bases: FieldBase, ndarray

A Field based on subclassing a Numpy array.

This constitutes an “old-style” Field object. Due to problems and inflexibilities in the way subclassing works, we are gradually transitioning to “new-style” fields (see NewStyleField) which use the dispatch mechanism introduced by Numpy 1.13.

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.

Methods Summary

from_dict(tree)

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

to_dict()

Convert the object to a dictionary for serialization.

Methods Documentation

classmethod from_dict(tree)[source]

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()[source]

Convert the object to a dictionary for serialization.

Returns:
dictionary

The created dictionary.