kqcircuits.util.parameters

kqcircuits.util.parameters.add_parameters_from(cls, /, *param_names, **param_with_default_value)[source]

Decorator function to add parameters to the decorated class.

Only the named parameters are added or changed. Use a starting wildcard ("*") argument to get all parameters of cls. For simplicity, if nothing is specified it gets all parameters.

Parameters in param_names after the starting "*" will be excluded. The "*" is also useful together with param_with_default_value to get all parameters but change some.

Parameters:
  • cls – the class to take parameters from

  • *param_names – parameter names to take (or remove if ‘*’ is the first)

  • **param_with_default_value – dictionary of parameter names and new default values

kqcircuits.util.parameters.add_parameter(cls, name, **change)[source]

Decorator function to add a single parameter to the decorated class.

Makes it possible to have fine-grained control over the Parameter’s properties. Particularly, changing the “hidden” or the “choices” property of the parameter.

Parameters:
  • cls – the class to take parameters from

  • name – name of the re-used parameter

  • **change – dictionary of properties to change, like hidden=True

class kqcircuits.util.parameters.pdt[source]

Bases: object

A namespace for pya.PCellParameterDeclaration types.

TypeDouble = 1
TypeInt = 0
TypeList = 6
TypeString = 2
TypeShape = 5
TypeBoolean = 3
TypeLayer = 4
TypeNone = 8
class kqcircuits.util.parameters.Param(data_type, description, default, **kwargs)[source]

Bases: object

PCell parameters as Element class attributes.

This should be used for defining PCell parameters in Element subclasses. The attributes of Param are same as pya.PCellParameterDeclaration’s attributes, except for:

  • data_type: same as type in pya.PCellParameterDeclaration

  • choices: List of (description, value) tuples or plain str values that are used as description too.

  • docstring: Longer description of the parameter that gets used by Sphinx to generate API docs.

classmethod get_all(owner)[source]

Get all parameters of given owner.

Parameters:

owner – get all parameters of this class

Returns:

a name-to-Param dictionary of all parameters of class owner or an empty one if it has none.

../_images/kqcircuits.util.parameters.png