Check out the Hyperspy Workshop May 13-17, 2024 Online

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, an offset and a size.

The most common type of axis. It is defined by the offset, scale and size parameters, which determine the initial value, spacing and length of the axis, respectively. The actual axis array is automatically calculated from these three values. The UniformDataAxis is a special case of the FunctionalDataAxis defined by the function scale * 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.offset_as_quantity

UniformDataAxis.scale_as_quantity

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.convert_to_functional_data_axis(...)

UniformDataAxis.convert_to_non_uniform_axis()

UniformDataAxis.crop([start, end])

Crop the axis in place.

UniformDataAxis.get_axis_dictionary()

UniformDataAxis.update_axis()

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.