NewStyleField
- class hcipy.field.NewStyleField(data, grid=None)[source]
Bases:
FieldBaseThe value of some physical quantity for each point in some coordinate system.
- Parameters:
- Attributes:
Attributes Summary
Tranpose of the array.
The hardware device the array data resides on.
The data type of the array elements.
The imaginary part of the field.
The transpose of a matrix or stack of matrices.
The number of axes in the array.
The real part of the field.
The dimensions of the array.
The number of elements in the array.
Methods Summary
all(*[, axis, keepdims])any(*[, axis, keepdims])argmax(*[, axis, keepdims])argmin(*[, axis, keepdims])argsort(*[, axis, stable])astype(dtype, /, *[, copy, device])clip([min, max])conj()copy()Create a copy of the field.
cumprod(*[, axis, dtype, include_initial])cumsum(*[, axis, dtype, include_initial])cumulative_prod(*[, axis, dtype, ...])cumulative_sum(*[, axis, dtype, include_initial])dot(b)flatten()Return a flattened field.
from_dict(val)Create a Field from a dict.
max(*[, axis, keepdims])mean(*[, axis, keepdims])min(*[, axis, keepdims])nonzero()prod(*[, axis, dtype, keepdims])ravel()Return a flattened field.
repeat(repeats, /, *[, axis])Repeat elements of a field.
reshape(shape, *[, copy])round()sort(*[, axis, stable])squeeze(*[, axis])std(*[, axis, correction, keepdims])sum(*[, axis, dtype, keepdims])to_device(device, /, *[, stream])Copy the Field from the device on which it currently resides to the specified device.
to_dict()Convert the Field to a dict.
var(*[, axis, correction, keepdims])Attributes Documentation
- T
Tranpose of the array.
- data
- device
The hardware device the array data resides on.
- dtype
The data type of the array elements.
- grid
- imag
The imaginary part of the field.
- mT
The transpose of a matrix or stack of matrices.
- ndim
The number of axes in the array.
- real
The real part of the field.
- shape
The dimensions of the array.
- size
The number of elements in the array.
- trace = None
- transpose = None
Methods Documentation
- all(*, axis=None, keepdims=False)
- any(*, axis=None, keepdims=False)
- argmax(*, axis=None, keepdims=False)
- argmin(*, axis=None, keepdims=False)
- argsort(*, axis=-1, stable=True)
- astype(dtype, /, *, copy=True, device=None)
- clip(min=None, max=None)
- conj()
- conjugate()
- cumprod(*, axis=None, dtype=None, include_initial=False)
- cumsum(*, axis=None, dtype=None, include_initial=False)
- cumulative_prod(*, axis=None, dtype=None, include_initial=False)
- cumulative_sum(*, axis=None, dtype=None, include_initial=False)
- flatten()[source]
Return a flattened field.
A copy is made only when needed.
- Returns:
- Field
A contiguous 1-D field with the same datatype.
- classmethod from_dict(val)[source]
Create a Field from a dict.
- Parameters:
- valdict
A dictionary generated from Field.to_dict().
- Returns:
- Field
The created field.
- max(*, axis=None, keepdims=False)
- mean(*, axis=None, keepdims=False)
- min(*, axis=None, keepdims=False)
- nonzero()
- prod(*, axis=None, dtype=None, keepdims=False)
- ravel()[source]
Return a flattened field.
A copy is made only when needed.
- Returns:
- Field
A contiguous 1-D field with the same datatype.
- repeat(repeats, /, *, axis=None)[source]
Repeat elements of a field.
- Parameters:
- repeatsint or array of ints
The number of repetitions for each element.
- axisint, optional
The axis (dimension) along which to repeat elements. If this is None (default), the field is is flattened first after which elements are repeated. The flattened field is returned.
- Returns:
- Field
The output field containing repeated elements.
- reshape(shape, *, copy=None)
- round()
- sort(*, axis=-1, stable=True)
- squeeze(*, axis=None)
- std(*, axis=None, correction=0.0, keepdims=False)
- sum(*, axis=None, dtype=None, keepdims=False)
- to_device(device, /, *, stream=None)[source]
Copy the Field from the device on which it currently resides to the specified device.
- Parameters:
- devicedevice
A device object.
- streamstream or None
The stream to use. For CUDA and ROCm, a Python integer representing a pointer to a stream, on devices that support streams. stream is provided by the consumer to the producer to instruct the producer to ensure that operations can safely be performed on the array (e.g., by inserting a dependency between streams via “wait for event”). The pointer must be an integer larger than or equal to -1 (see below for allowed values on each platform). If stream is -1, the value may be used by the consumer to signal “producer must not perform any synchronization”. The ownership of the stream stays with the consumer. On CPU and other device types without streams, only None is accepted.
- Returns:
- Field
An array with the same data and data type as self and located on the specified device.
- var(*, axis=None, correction=0.0, keepdims=False)