NDDataArray¶
-
class
gammapy.utils.nddata.
NDDataArray
(axes, data=None, meta=None, interp_kwargs=None)[source]¶ Bases:
object
ND Data Array Base class
for usage examples see nddata_demo.html
Parameters: axes : list
List of
DataAxis
data :
Quantity
Data
meta : dict
Meta info
interp_kwargs : dict
TODO
Attributes Summary
axes
Array holding the axes in correct order data
Array holding the n-dimensional data. default_interp_kwargs
Default interpolation kwargs used to initialize the scipy.interpolate.RegularGridInterpolator
.dim
Dimension (number of axes) Methods Summary
axis
(name)Return axis by name evaluate
([method])Evaluate NDData Array evaluate_at_coord
(points[, method])Evaluate NDData Array on set of points. find_node
(**kwargs)Find next node Attributes Documentation
-
axes
¶ Array holding the axes in correct order
-
data
¶ Array holding the n-dimensional data.
-
default_interp_kwargs
= {'bounds_error': False, 'fill_value': None}¶ Default interpolation kwargs used to initialize the
scipy.interpolate.RegularGridInterpolator
. The interpolation behaviour of an individual axis (‘log’, ‘linear’) can be passed to the axis on initialization.
-
dim
¶ Dimension (number of axes)
Methods Documentation
-
evaluate
(method=None, **kwargs)[source]¶ Evaluate NDData Array
This function provides a uniform interface to several interpolators. The evaluation nodes are given as
kwargs
.Currently available:
RegularGridInterpolator
, methods: linear, nearestParameters: method : str {‘linear’, ‘nearest’}, optional
Interpolation method
kwargs : dict
Keys are the axis names, Values the evaluation points
Returns: array :
Quantity
Interpolated values, axis order is the same as for the NDData array
-
evaluate_at_coord
(points, method='linear', **kwargs)[source]¶ Evaluate NDData Array on set of points.
TODO: merge with
evaluate
? This method was added to support evaluating on arbitrary arrays of coordinates, not just on the outer product likeevaluate
.Parameters: points: dict
contains the coordinates on which you want to interpolate (axis_name: value)
method : str {‘linear’, ‘nearest’}, optional
Interpolation method
kwargs : dict
Keys are the axis names, Values the evaluation points
Returns: array :
Quantity
Interpolated values, axis order is the same as for the NDData array
-