Skip to content
Construct PsiQDK Workbench

Reference: units Module

The psiqdk.workbench.units module provides helpers for specifying rotation angles in different units.

RotationAngle

RotationAngle(mag: float, units: str)

RotationAngle is a class with magnitude and units.

In Workbench, these are primarily used to handle conversion between rotation units (radians, degrees, turns).

RotationAngle class supports arithmetic and comparison operators, such as +, <=, etc.

Parameters:

Name Type Description Default
mag float

Magnitude

required
units str

Units such as 'deg' or 'rad'

required

mag instance-attribute

mag = mag

units instance-attribute

units = units

to

to(to_units: str)

Return equivalent RotationAngle in units specified.

Parameters:

Name Type Description Default
to_units str

Units to convert the angle to ('deg' or 'rad').

required

rad module-attribute

rad = RotationAngle(1, 'rad')

Rotation angle that corresponds to 1 radian.

deg module-attribute

deg = RotationAngle(1, 'deg')

Rotation angle that corresponds to 1 degree.