Scalable2D#
- class tqec.utils.Scalable2D(x, y)[source]#
Bases:
object
A pair of scalable quantities.
- Parameters:
x (LinearFunction)
y (LinearFunction)
- x#
a linear function representing the value of the
x
coordinate.
- y#
a linear function representing the value of the
y
coordinate.
Methods
__init__
(x, y)Get a tuple of coordinates in
numpy
-coordinates.to_shape_2d
(k)Get the represented value for a given scaling parameter
k
.Attributes
Detailed methods
- __init__(x, y)#
- Parameters:
x (LinearFunction)
y (LinearFunction)
- Return type:
None
- to_numpy_shape(k)[source]#
Get a tuple of coordinates in
numpy
-coordinates.- Raises:
TQECException – if any of
self.x(k)
orself.y(k)
returns a number that is not an integer (or very close to an integer).- Returns:
a tuple of coordinates in
numpy
-coordinates.- Parameters:
k (int)
- Return type:
tuple[int, int]
- to_shape_2d(k)[source]#
Get the represented value for a given scaling parameter
k
.- Parameters:
k (int) – scaling parameter to use to get a value from the scalable quantities stored in
self
.- Raises:
TQECException – if any of
self.x(k)
orself.y(k)
returns a number that is not an integer (or very close to an integer).- Returns:
Shape2D(round_or_fail(self.x(k)), round_or_fail(self.y(k)))
- Return type: