CoupledLineTee.parse_value#

CoupledLineTee.parse_value(value: Any | List | Dict | Iterable) Any | List | Dict | Iterable#

Parse a string, mappable (dict, Dict), iterable (list, tuple) to account for units conversion, some basic arithmetic, and design variables. This is the main parsing function of Qiskit Metal.

Parameters:
  • value (str) – String to parse or

  • variable_dict (dict) – dict pointer of variables

Returns:

Parse value

Return type:

str, float, list, tuple, or ast eval

Handled Inputs:
Strings:
Strings of numbers, numbers with units; e.g., ‘1’, ‘1nm’, ‘1 um’

Converts to int or float. Some basic arithmetic is possible, see below.

Strings of variables ‘variable1’.

Variable interpretation will use string method isidentifier ‘variable1’.isidentifier()`

Dictionaries:

Returns ordered Dict with same key-value mappings, where the values have been subjected to parse_value.

Itterables(list, tuple, …):

Returns same kind and calls itself parse_value on each element.

Numbers:

Returns the number as is. Int to int, etc.

Arithemetic:

Some basic arithmetic can be handled as well, such as ‘-2 * 1e5 nm’ will yield float(-0.2) when the default units are set to mm.

Default units:

User units can be set in the design. The design will set config.DEFAULT.units

Examples

See the docstring for this module.

>> ?qiskit_metal.toolbox_metal.parsing