qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec. unit_vector  (  indexes ,  dim ,  axis=-1 ,  dtype=float  )[source]

Unit vectors with a 1 at the specified indexes.

Parameters:
indexesarray_like

The indexes of the vector components that are 1.

dimint_like

The dimension of the unit vectors.

axisint_like

The axis with the dimension dim.

dtypetype

The data type of the unit vectors.

Returns:
endarray

Unit vectors with 1 at the specified indexes and dimension dim along the specified axis.