qdesignoptimizer.utils.names_parameters module
Standard naming conventions for physical parameters and modes in quantum circuit designs.
- qdesignoptimizer.utils.names_parameters.CAPACITANCE = 'capacitance'
Maps branch to capacitance matrix elements in capacitance matrix simulation. Capacitance matrix elements are in femto Farads (fF).
Format: (capacitance_name, capacitance_name): value
- Example: {
(‘comb_NAME_QB1’, ‘comb_NAME_QB1’): 100, (‘comb_NAME_QB1’, ‘comb_NAME_QB2’): 5, }
- Type:
- qdesignoptimizer.utils.names_parameters.ITERATION = 'ITERATION'
Special parameter identifier used for tracking optimization iterations.
- qdesignoptimizer.utils.names_parameters.Mode
Type representing a unique mode name in the format ‘modetype_identifier’.
The mode name must be unique within a design and follows a standardized format of lowercase mode type, optionally followed by an underscore and an identifier.
Examples
>>> "qubit" # A single qubit without an identifier >>> "qubit_1" # First qubit in a multi-qubit system >>> "resonator_a" # A resonator with string identifier 'a'
- qdesignoptimizer.utils.names_parameters.Parameter
Type representing a parameter name, formed by concatenating a unique mode name with a parameter type.
The parameter name uniquely identifies a physical quantity associated with one or more modes in the system.
Examples
>>> "qubit_freq" # Frequency of a qubit >>> "qubit_1_kappa" # Decay rate of qubit 1 >>> "qubit_1_to_resonator_1_nonlin" # Cross-Kerr interaction
- qdesignoptimizer.utils.names_parameters.mode(mode_type: str, identifier: int | str | None = None) str [source]
Construct a standardized mode name from a mode type and optional identifier.
Creates a unique mode name by combining the mode type with an optional identifier. The resulting name follows the convention ‘modetype_identifier’ and must be unique within a design.
- Parameters:
- Returns:
A standardized mode name in the format ‘modetype_identifier’.
- Return type:
Mode
- Raises:
AssertionError – If mode_type or identifier contains forbidden characters.
Examples
>>> mode("qubit", 1) 'qubit_1' >>> mode("resonator", "a") 'resonator_a' >>> mode("cavity") 'cavity'
- qdesignoptimizer.utils.names_parameters.param(mode_instance: str, param_type: Literal['freq', 'kappa', 'charge_line_limited_t1']) str [source]
Construct a parameter name from a mode and parameter type.
Creates a parameter name by concatenating the mode name with the parameter type. Used for parameters associated with a single mode, such as frequency or decay rate.
- Parameters:
mode_instance (Mode) – The mode name (e.g., “qubit_1”).
param_type (Literal) – The type of parameter, must be one of: - “freq”: Frequency - “kappa”: Decay rate/linewidth - “charge_line_limited_t1”: T1 limited by charge line
- Returns:
A parameter name in the format ‘mode_paramtype’.
- Return type:
Parameter
- Raises:
AssertionError – If param_type is not one of the allowed values.
Examples
>>> param("qubit_1", "freq") 'qubit_1_freq' >>> param("resonator_a", "kappa") 'resonator_a_kappa'
- qdesignoptimizer.utils.names_parameters.param_nonlin(mode_1: str, mode_2: str) str [source]
Construct a nonlinear parameter name from two modes.
Creates a parameter name for nonlinear interactions between two modes, such as cross-Kerr coupling or anharmonicity (self-Kerr). The modes are sorted alphabetically to ensure consistency regardless of argument order.
- Parameters:
mode_1 (Mode) – First mode name.
mode_2 (Mode) – Second mode name.
- Returns:
A nonlinearity parameter name in the format ‘mode1_to_mode2_nonlin’.
- Return type:
Parameter
Note
If mode_1 == mode_2, the returned parameter represents the anharmonicity (self-Kerr) of the mode.
Examples
>>> param_nonlin("qubit_1", "qubit_2") 'qubit_1_to_qubit_2_nonlin' >>> param_nonlin("qubit_2", "qubit_1") # Order is normalized 'qubit_1_to_qubit_2_nonlin' >>> param_nonlin("qubit_1", "qubit_1") # Anharmonicity 'qubit_1_to_qubit_1_nonlin'
- qdesignoptimizer.utils.names_parameters.param_capacitance(capacitance_name_1: str, capacitance_name_2: str) str [source]
Construct a parameter name for capacitance matrix elements.
Creates a parameter name for capacitance between two islands or components in the system. The capacitance names are sorted alphabetically to ensure consistency regardless of argument order.
- Parameters:
- Returns:
- A capacitance parameter name in the format
’name1_to_name2_capacitance’, with values measured in femto Farads (fF).
- Return type:
Parameter
Examples
>>> param_capacitance("island_1", "island_2") 'island_1_to_island_2_capacitance' >>> param_capacitance("island_2", "island_1") # Order is normalized 'island_1_to_island_2_capacitance'
- qdesignoptimizer.utils.names_parameters.get_mode_from_param(parameter: str) str [source]
Extract the mode identifier from a parameter name.
Parses a parameter name to retrieve the original mode name by removing the parameter type suffix.
- Parameters:
parameter (Parameter) – The parameter name to parse.
- Returns:
The extracted mode name.
- Return type:
Mode
Examples
>>> get_mode_from_param("qubit_1_freq") 'qubit_1' >>> get_mode_from_param("resonator_a_kappa") 'resonator_a'
- qdesignoptimizer.utils.names_parameters.get_modes_from_param_nonlin(parameter: str) Tuple[str, ...] [source]
Extract mode identifiers from a nonlinear parameter name.
Parses a nonlinearity parameter name to retrieve the original mode names that are involved in the interaction.
- Parameters:
parameter (Parameter) – The nonlinearity parameter name to parse. Must end with “_nonlin”.
- Returns:
A tuple containing the extracted mode names.
- Return type:
Tuple[Mode, …]
- Raises:
AssertionError – If parameter does not end with “_nonlin”.
Examples
>>> get_modes_from_param_nonlin("qubit_1_to_qubit_2_nonlin") ('qubit_1', 'qubit_2') >>> get_modes_from_param_nonlin("qubit_1_to_qubit_1_nonlin") ('qubit_1', 'qubit_1')