Scalable2D#

class tqec.utils.Scalable2D(x, y)[source]#

Bases: object

A pair of scalable quantities.

Parameters:
x#

a linear function representing the value of the x coordinate.

Type:

tqec.utils.scale.LinearFunction

y#

a linear function representing the value of the y coordinate.

Type:

tqec.utils.scale.LinearFunction

Methods

__init__(x, y)

to_numpy_shape(k)

Get a tuple of coordinates in numpy-coordinates.

to_shape_2d(k)

Get the represented value for a given scaling parameter k.

Attributes

x

y

Detailed methods

__init__(x, y)#
Parameters:
Return type:

None

to_numpy_shape(k)[source]#

Get a tuple of coordinates in numpy-coordinates.

Raises:

TQECException – if any of self.x(k) or self.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) or self.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:

Shape2D