DesignPlanar.parse_value¶
- DesignPlanar.parse_value(value: Union[Any, List, Dict, Iterable]) Any ¶
Main parsing function. Parse a string, mappable (dict, Dict), iterable (list, tuple) to account for units conversion, some basic arithmetic, and design variables.
- Parameters
value (str) – String to parse or
variable_dict (dict) – dict pointer of variables
- Returns
Parsed 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 interpertation 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.
- Iterables(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 arithemetic 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