Utilities

Unit conversions between circuit parameters (inductance, capacitance) and energy scales, trigonometric phase operators, and error metrics.

HybridSuperQubits.utilities.calculate_error_metrics(fitted_values, measured_values, relative=True)[source]

Calculate error metrics between fitted and measured values.

Parameters:

fitted_valuesnp.ndarray

Fitted values from a model

measured_valuesnp.ndarray

Measured/observed values

relativebool, optional

Whether to calculate relative errors. Default is True.

Returns:

Dict[str, Union[np.ndarray, float]]

Dictionary with different error metrics

Parameters:
Return type:

dict[str, Any]

HybridSuperQubits.utilities.sin_kphi_operator(k, dimension, phi_ext=0)[source]

Generate the matrix representation of the sin(khat{phi}) operator in the number basis.

The operator is defined via the exponential representation:

sin(kphi) = (e^(ikphi) - e^(-ikphi))/(2i)

In the number basis, the matrix element corresponding to a shift by +k is 1/(2i) and by -k is -1/(2i). Note that 1/(2i) equals -0.5j.

Parameters:
  • k (int) – The integer multiplier of hat{phi}.

  • dimension (int) – Dimension of the Hilbert space.

  • phi_ext (float, optional) – External phase offset, by default 0.

Returns:

Matrix representation of sin(khat{phi}).

Return type:

numpy.ndarray

Notes

When k == 0, sin(0) = 0, so the operator is the zero operator.

HybridSuperQubits.utilities.cos_kphi_operator(k, dimension, phase=0)[source]

Generate the matrix representation of the cos(khat{phi}) operator in the number basis.

Parameters:

k (int): The integer multiplier of hat{phi}. dimension (int): Dimension of the Hilbert space. phase (float, optional): Phase offset, by default

Returns:

numpy.ndarray: Matrix representation of cos(khat{phi}).

Parameters:
Return type:

ndarray

HybridSuperQubits.utilities.L_to_El(L)[source]
HybridSuperQubits.utilities.C_to_Ec(C)[source]
HybridSuperQubits.utilities.El_to_L(El)[source]
HybridSuperQubits.utilities.Ec_to_C(Ec)[source]