Python library for simulating superconducting qubits with energy spectra, plotting, and QuTiP integration
—
Comprehensive tools for analyzing noise effects in superconducting qubits, including thermal noise, coherence calculations, and decoherence time estimation. Essential for understanding qubit performance in realistic environments.
Functions for calculating thermal effects on qubit transitions and computing temperature-dependent properties.
def calc_therm_ratio(omega: float, T: float, omega_in_standard_units: bool = False) -> float:
"""
Calculate thermal ratio β*ω = ℏω/(k_B*T).
Parameters:
- omega (float): Transition frequency in system units
- T (float): Temperature in Kelvin
- omega_in_standard_units (bool): If True, omega already in standard units
Returns:
- float: Thermal ratio β*ω
"""Abstract base classes and concrete implementations for various noise channels affecting superconducting qubits.
class NoiseChannel:
"""Abstract base class for noise channels."""
def __init__(self, noise_op, system: QuantumSystem, truncated_dim: int = None): ...
def spectrum(self, omega: float, esys: tuple = None, **kwargs) -> float: ...
def t1_effective(self, esys: tuple = None, **kwargs) -> float: ...
def t2_effective(self, esys: tuple = None, **kwargs) -> float: ...
class DephasingNoise(NoiseChannel):
"""Dephasing noise channel for pure dephasing processes."""
def __init__(self, noise_op, system: QuantumSystem, **kwargs): ...
class RelaxationNoise(NoiseChannel):
"""Relaxation noise channel for energy decay processes."""
def __init__(self, noise_op, system: QuantumSystem, **kwargs): ...Methods for computing T1 (energy relaxation) and T2 (dephasing) times from noise spectra and system parameters.
def t1_coherence(omega_01: float, noise_spectrum: callable, esys: tuple = None,
T: float = 0.015, total: bool = True) -> float:
"""
Calculate T1 coherence time from noise spectrum.
Parameters:
- omega_01 (float): Transition frequency
- noise_spectrum (callable): Noise spectral density function
- esys (tuple): Eigensystem data
- T (float): Temperature in Kelvin
- total (bool): Return total rate vs individual contributions
Returns:
- float: T1 time in system units
"""
def t2_coherence(omega_01: float, noise_spectrum: callable, esys: tuple = None,
T: float = 0.015, total: bool = True) -> float:
"""
Calculate T2 coherence time (pure dephasing).
Parameters:
- omega_01 (float): Transition frequency
- noise_spectrum (callable): Noise spectral density function
- esys (tuple): Eigensystem data
- T (float): Temperature in Kelvin
- total (bool): Return total rate vs individual contributions
Returns:
- float: T2 time in system units
"""Standard noise operators for common decoherence channels in superconducting circuits.
def charge_matrix_element(n1: int, n2: int) -> float:
"""Matrix element of charge operator between charge states."""
def flux_matrix_element(phi1: float, phi2: float, operator_func: callable) -> float:
"""Matrix element of flux-dependent operator between flux states."""
def critical_current_noise_operator(system: QuantumSystem) -> np.ndarray:
"""Noise operator for critical current fluctuations."""
def charge_noise_operator(system: QuantumSystem) -> np.ndarray:
"""Noise operator for charge noise effects."""
def flux_noise_operator(system: QuantumSystem) -> np.ndarray:
"""Noise operator for flux noise effects."""import scqubits as scq
import numpy as np
# Create a transmon qubit
transmon = scq.Transmon(EJ=25.0, EC=0.2, ng=0.0, ncut=30)
# Calculate eigenvalues and eigenvectors
evals, evecs = transmon.eigensys(evals_count=6)
# Calculate thermal ratio at dilution fridge temperature
T_mK = 15 # millikelvin
T_K = T_mK * 1e-3 # convert to Kelvin
omega_01 = evals[1] - evals[0] # transition frequency
thermal_ratio = scq.calc_therm_ratio(omega_01, T_K)
print(f"Thermal ratio β*ω = {thermal_ratio:.2f}")
# Thermal occupation probability
thermal_occupation = 1 / (np.exp(thermal_ratio) + 1)
print(f"Thermal occupation: {thermal_occupation:.6f}")# Define a simple 1/f charge noise spectrum
def charge_noise_spectrum(omega):
"""1/f charge noise spectral density."""
A_charge = 1e-6 # noise amplitude
return A_charge / max(omega, 1e-3) # avoid divergence at ω=0
# Calculate charge noise operator
charge_op = scq.charge_noise_operator(transmon)
# Create noise channel
charge_noise = scq.DephasingNoise(charge_op, transmon)
# Calculate coherence times
esys = (evals, evecs)
t1_time = charge_noise.t1_effective(esys=esys, T=T_K)
t2_time = charge_noise.t2_effective(esys=esys, T=T_K)
print(f"T1 time: {t1_time:.2f} μs")
print(f"T2 time: {t2_time:.2f} μs")class QuantumSystem:
"""Base class for quantum systems with noise analysis support."""
def __init__(self): ...
def supported_noise_channels(self) -> list: ...
def default_params(self) -> dict: ...
class NoiseEnvironment:
"""Container for multiple noise channels affecting a quantum system."""
def __init__(self, system: QuantumSystem): ...
def add_noise_channel(self, channel: NoiseChannel) -> None: ...
def total_t1_time(self, esys: tuple = None) -> float: ...
def total_t2_time(self, esys: tuple = None) -> float: ...Install with Tessl CLI
npx tessl i tessl/pypi-scqubits