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,UnitConversionDataAxis class for a uniform axis defined through a
scale, anoffsetand asize.The most common type of axis. It is defined by the
offset,scaleandsizeparameters, which determine the initial value, spacing and length of the axis, respectively. The actualaxisarray is automatically calculated from these three values. TheUniformDataAxisis a special case of theFunctionalDataAxisdefined 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_addedAn event fired when a new trait is dynamically added to the object.
UniformDataAxis.trait_modifiedAn 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.