c3.c3objs

Basic custom objects.

Module Contents

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__(self) 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(self) dict[source]

Return a config-compatible dictionary representation.

__lt__(self, other)[source]

Return self<value.

__le__(self, other)[source]

Return self<=value.

__eq__(self, other)[source]

Return self==value.

__ne__(self, other)[source]

Return self!=value.

__ge__(self, other)[source]

Return self>=value.

__gt__(self, other)[source]

Return self>value.

__repr__(self)[source]

Return repr(self).

__str__(self)[source]

Return str(self).

numpy(self) numpy.ndarray[source]

Return the value of this quantity as numpy.

get_value(self, val: tensorflow.float64 = None, dtype: tensorflow.dtypes = None) tensorflow.Tensor[source]

Return the value of this quantity as tensorflow.

Parameters
  • val (tf.float64) –

  • dtype (tf.dtypes) –

get_opt_value(self) numpy.ndarray[source]

Get an optimizer friendly representation of the value.

set_opt_value(self, 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.