UniformDataAxis#
- class pyxem.utils.calibration.UniformDataAxis(index_in_array=None, name=None, units=None, navigate=False, size=1, scale=1.0, offset=0.0, is_binned=False, **kwargs)#
Bases:
BaseDataAxis
,UnitConversion
DataAxis class for a uniform axis defined through a
scale
, anoffset
and asize
.The most common type of axis. It is defined by the
offset
,scale
andsize
parameters, which determine the initial value, spacing and length of the axis, respectively. The actualaxis
array is automatically calculated from these three values. TheUniformDataAxis
is a special case of theFunctionalDataAxis
defined by the functionscale * x + offset
.- Parameters:
offset (float) – The first value of the axis vector.
scale (float) – The spacing between axis points.
size (int) – The number of points in the axis.
Examples
Sample dictionary for a UniformDataAxis:
>>> dict0 = {'offset': 300, 'scale': 1, 'size': 500} >>> s = hs.signals.Signal1D(np.ones(500), axes=[dict0]) >>> s.axes_manager[0].get_axis_dictionary() {'_type': 'UniformDataAxis', 'name': <undefined>, 'units': <undefined>, 'navigate': False, 'size': 500, 'scale': 1.0, 'offset': 300.0}
Attributes
UniformDataAxis.trait_added
An event fired when a new trait is dynamically added to the object.
UniformDataAxis.trait_modified
An event that can be fired to indicate that the state of the object has been modified.
Methods
UniformDataAxis.calibrate
(value_tuple, ...)UniformDataAxis.crop
([start, end])Crop the axis in place.
UniformDataAxis.update_from
(axis[, attributes])Copy values of specified axes fields from the passed AxesManager.
UniformDataAxis.value2index
(value[, rounding])Return the closest index/indices to the given value(s) if between the axis limits.