Coord#
- class nextnanopy.utils.datasets.Coord(name, value, dim, unit=None, offset=0, metadata=None, **kwargs)#
Bases:
DataIndependent variable read from a nextnano data file.
Holds one axis of the dataset; the quantities sampled on it are
Variableobjects.- Parameters:
- namestr
Name of the dataset.
- valuearray_like
Stored value.
- dimint
Index of the axis this coordinate spans in the shape of the data it belongs to. For a dataset of shape
(100, 2), a coordinate of 100 points hasdim = 0.- unitstr, default=None
Unit of the value.
- offsetarray_like, default=0
Shift added to
valuewhen the offset is requested.- metadatadict, default=None
Extra information.
- label_fmtcallable, default=None
Called as
label_fmt(name, unit)to buildlabel. If not defined, the two are joined as'{name} ({unit})'.
- Attributes:
- namestr
Name of the dataset.
- valuenumpy.ndarray
Stored value.
- dimint
Index of the axis this coordinate spans in the shape of the data it belongs to. For a dataset of shape
(100, 2), a coordinate of 100 points hasdim = 0.- unitstr
Unit of the value.
- offsetnumpy.ndarray
Shift added to
valuewhen the offset is requested.- metadatadict
Extra information. Empty unless the loader filled it in.
- labelstr
Name and unit rendered by
label_fmt, ready to use as an axis label. Read-only.- label_fmtcallable
Called as
label_fmt(name, unit)to buildlabel. If omitted, the two are joined as'{name} ({unit})'.- valueonumpy.ndarray
valueshifted byoffset. Computed once at construction, so it does not follow later changes to either.
- get_value(use_offset=False)#
Return a copy of the value, with or without the offset.
- Parameters:
- use_offsetbool, default=False
Whether to add
offsetto the returned copy.
- Returns:
- numpy.ndarray
A copy, so changing it does not change
value.