c3.c3objs

Basic custom objects.

Module Contents

exception c3.c3objs.QuantityOOBException[source]

Bases: ValueError

Inheritance diagram of c3.c3objs.QuantityOOBException

Inappropriate argument value (of correct type).

class __cause__

exception cause

class __context__

exception context

__delattr__()

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__()

Return self==value.

__format__()

Default object formatter.

__ge__()

Return self>=value.

__getattribute__()

Return getattr(self, name).

__gt__()

Return self>value.

__hash__()

Return hash(self).

__le__()

Return self<=value.

__lt__()

Return self<value.

__ne__()

Return self!=value.

__reduce__()

Helper for pickle.

__reduce_ex__()

Helper for pickle.

__repr__()

Return repr(self).

__setattr__()

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

class c3.c3objs.C3obj(name, desc='', comment='', params=None)[source]

Represents an abstract object with parameters. To be inherited from.

Parameters
  • name (str) – short name that will be used as identifier

  • desc (str) – longer description of the component

  • comment (str) – additional information about the component

  • params (dict) – Parameters in this dict can be accessed and optimized

__str__() str[source]

Return str(self).

class c3.c3objs.Quantity(value, unit='undefined', min_val=None, max_val=None, symbol='\\alpha')[source]

Represents any physical quantity used in the model or the pulse specification. For arithmetic operations just the numeric value is used. The value itself is stored in an optimizer friendly way as a float between -1 and 1. The conversion is given by

scale (value + 1) / 2 + offset

Parameters
  • value (np.array(np.float64) or np.float64) – value of the quantity

  • min_val (np.array(np.float64) or np.float64) – minimum this quantity is allowed to take

  • max_val (np.array(np.float64) or np.float64) – maximum this quantity is allowed to take

  • unit (str) – physical unit

  • symbol (str) – latex representation

asdict() dict[source]

Return a config-compatible dictionary representation.

__lt__(other)[source]

Return self<value.

__le__(other)[source]

Return self<=value.

__eq__(other)[source]

Return self==value.

__ne__(other)[source]

Return self!=value.

__ge__(other)[source]

Return self>=value.

__gt__(other)[source]

Return self>value.

__repr__()[source]

Return repr(self).

__str__()[source]

Return str(self).

numpy() numpy.ndarray[source]

Return the value of this quantity as numpy.

get_value() tensorflow.Tensor[source]

Return the value of this quantity as tensorflow.

Parameters
  • val (tf.float64) –

  • dtype (tf.dtypes) –

get_other_value(val) tensorflow.Tensor[source]

Return an arbitrary value of the same scale as this quantity as tensorflow.

Parameters
  • val (tf.float64) –

  • dtype (tf.dtypes) –

get_opt_value() tensorflow.Tensor[source]

Get an optimizer friendly representation of the value.

set_opt_value(val: float) None[source]

Set value optimizer friendly.

Parameters

val (tf.float64) – Tensorflow number that will be mapped to a value between -1 and 1.