loom.eka.utilities.enums
Copyright (c) Entropica Labs Pte Ltd 2025.
Use, distribution and reproduction of this program in its source or compiled form is prohibited without the express written consent of Entropica Labs Pte Ltd.
- class loom.eka.utilities.enums.DiagonalDirection(*values)[source]
Bases:
str,EnumDiagonal direction indicator for Operations (e.g. Grow and Shrink).
- BOTTOM_LEFT = 'bottom-left'
- BOTTOM_RIGHT = 'bottom-right'
- TOP_LEFT = 'top-left'
- TOP_RIGHT = 'top-right'
- property components
Return the two cardinal directions composing this diagonal.
- direction_along_orientation(orientation)[source]
Get the cardinal direction along the given orientation.
- Return type:
- classmethod from_directions(directions)[source]
Get the diagonal direction from two cardinal directions. The two directions must be perpendicular.
- Return type:
- classmethod from_vector(vector)[source]
Get the diagonal direction from a 2D vector. The vector should have only two non-zero components in the first and the second dimension. The direction is determined by the sign of the components. The direction is returned as a DiagonalDirection enum.
- Return type:
- mirror_across_orientation(orientation)[source]
Get the mirrored diagonal direction across the given orientation.
- Return type:
- class loom.eka.utilities.enums.Direction(*values)[source]
Bases:
str,EnumDirection indicator for Operations (e.g. Grow and Shrink).
- BOTTOM = 'bottom'
- LEFT = 'left'
- RIGHT = 'right'
- TOP = 'top'
- classmethod from_vector(vector, bottom_is_plus=True)[source]
Get the direction from a 2D vector. The vector should have only one non-zero component in the first or the second dimension. The direction is determined by the non-zero component. The direction is returned as a Direction enum.
- Return type:
- mirror_across_orientation(orientation)[source]
Get the mirrored direction across the given orientation.
- Return type:
- class loom.eka.utilities.enums.Orientation(*values)[source]
Bases:
str,EnumOrientation indicator for Operations (e.g. Split) and for Block initialization.
- HORIZONTAL = 'horizontal'
- VERTICAL = 'vertical'
- classmethod from_vector(vector)[source]
Get the orientation from a 2D vector. The orientation is determined by the direction of the vector. The orientation is returned as an Orientation enum.
- Return type:
- class loom.eka.utilities.enums.ResourceState(*values)[source]
Bases:
str,EnumSupported states in state injection operations.
- S = 's'
- T = 't'
- class loom.eka.utilities.enums.SingleQubitPauliEigenstate(*values)[source]
Bases:
str,EnumSupported states in reset operations.
- MINUS = '-'
- MINUS_I = '-i'
- ONE = '1'
- PLUS = '+'
- PLUS_I = '+i'
- ZERO = '0'
- property basis_expectation_value: int
Get the expectation value of the state in the Pauli basis of the state.
- property pauli_basis: str
Get the Pauli basis of the state.
- loom.eka.utilities.enums.enum_missing(cls, value)[source]
This method is called when value is not found in the Enum. This could be the case when the input is not lower case but its lower case version is in the Enum. Therefore value is first converted to lower-case and then compared to the values in the Enum.
If no match is found, an exception is raised. Also note that the exception message is more informative than the default one since we here include the allowed values.