interpolated fields#
This module implements the generic InterpolatedField class
- class atomsmltr.environment.fields.interpolated.InterpolatedField(data_position: ndarray, data_field: ndarray, origin: ndarray = (0, 0, 0), scale: float = 1.0, tag: str = None)[source]#
Bases:
FieldCreates an interpolated field from input values.
- Parameters:
data_position (array) – the ‘position’ data of the field to interpolate
data_field (array) – the ‘value’ data of the field to interpolate
origin (array, shape (3,), optional) – cartesian coordinates of the origin for the field. If not set to (0,0,0), it will shift the interpolated field w.r.t the initial data, by default (0, 0, 0)
scale (float, optional) – a scale factor for the interpolated field, by default 1.0
tag (str, optional) – the field tag, by default None
- abstractmethod interpolate(data_position: ndarray, data_field: ndarray)[source]#
(re)initialize the interpolation
- Parameters:
data_position (array) – the ‘position’ data of the field to interpolate
data_field (array) – the ‘value’ data of the field to interpolate
- property origin: ndarray#
the origin for the interpolated field
- Type:
array, shape (,3)
- property scale: float#
a scale factor for the field
- Type:
float
- class atomsmltr.environment.fields.interpolated.InterpolatedField1D1D(data_position: ndarray, data_field: ndarray, field_direction: ndarray = (1, 0, 0), position_direction: ndarray = (1, 0, 0), origin: ndarray = (0, 0, 0), scale: float = 1.0, tag: str = None)[source]#
Bases:
InterpolatedFieldCreates an interpolated 1D field from 1D input values.
- Parameters:
data_position (array, shape (,n)) – the ‘position’ data of the field to interpolate
data_field (array, shape (,n)) – the amplitude of the field to interpolate
field_direction (array, shape (,3)) – the direction to which the interpolated field will point at
position_direction (array, shape (,3)) – the direction corresponding to the data_position ‘position’ array
origin (array, shape (3,), optional) – cartesian coordinates of the origin for the field. If not set to (0,0,0), it will shift the interpolated field w.r.t the initial data, by default (0, 0, 0)
scale (float, optional) – a scale factor for the interpolated field, by default 1.0
tag (str, optional) – the field tag, by default None
- property data_field: ndarray#
y data used for interpolation
- Type:
array
- property data_position: ndarray#
x data used for interpolation
- Type:
array
- property field_direction: ndarray#
direction of the field
- Type:
array, shape (3,)
- interpolate(data_position, data_field)[source]#
(re)initialize the interpolation
- Parameters:
data_position (array) – the ‘position’ data of the field to interpolate
data_field (array) – the ‘value’ data of the field to interpolate
- property position_direction: ndarray#
the direction corresponding to the data_position ‘position’ array
- Type:
array, shape (,3)
- class atomsmltr.environment.fields.interpolated.InterpolatedField3D3D(data_position: tuple, data_field: ndarray, origin: ndarray = (0, 0, 0), scale: float = 1.0, tag: str = None)[source]#
Bases:
InterpolatedFieldCreates an interpolated 3D field from 3D input values.
- Parameters:
data_position (tuple of 3 ndarray of float, with shapes (m,), (n,) and (p,)) – the ‘x’, ‘y’ and ‘z’ position points of the field to interpolate
data_field (array, shape (m,n,p,3)) – the magnetic field to interpolate
origin (array, shape (3,), optional) – cartesian coordinates of the origin for the field. If not set to (0,0,0), it will shift the interpolated field w.r.t the initial data, by default (0, 0, 0)
scale (float, optional) – a scale factor for the interpolated field, by default 1.0
tag (str, optional) – the field tag, by default None
- property data_field: ndarray#
field data used for interpolation
- Type:
array
- property data_position: tuple#
position data used for interpolation
- Type:
tuple of 3 arrays
- interpolate(data_position: tuple, data_field: ndarray, fill_value: float = None, bounds_error: bool = False, **kwargs)[source]#
(re)initialize the interpolation
- Parameters:
data_position (tuple of 3 ndarray of float, with shapes (m,), (n,) and (p,)) – the ‘x’, ‘y’ and ‘z’ position points of the field to interpolate
data_field (array, shape (m,n,p,3)) – the magnetic field to interpolate
fill_value (float, optional, defaults to None) – The value to use for points outside of the interpolation domain. If None, values outside the domain are extrapolated
bounds_error (bool, optional, default to False) – If True, when interpolated values are requested outside of the domain of the input data, a ValueError is raised. If False, then fill_value is used.
**kwargs – keyword arguments are passed to Scipy
RegularGridInterpolator