A QuTiP-based simulator for continuous-wave (CW) spectroscopy experiments on transmon qubits.
- Single-tone spectroscopy: Sweep drive frequency to find qubit transitions
- Two-tone spectroscopy: Probe multi-level structure with two simultaneous drives
- Power-frequency sweeps: 2D parameter scans with parallel processing
- Realistic physics:
- Steady-state master equation solver
- T1/T2 decoherence
- Dispersive readout with Lorentzian resonator response
- Multi-photon transitions at high power
pip install cw-spectroscopy-simulatorOr install from source:
git clone https://github.com/shuxiangcao/cw-spectroscopy-simulator.git
cd cw-spectroscopy-simulator
pip install -e .from cw_simulator import VirtualTransmon, SimulationSetup, CWSpectroscopySimulator
import numpy as np
# Create a virtual transmon qubit
qubit = VirtualTransmon(
name="Q1",
qubit_frequency=5000.0, # MHz
anharmonicity=-200.0, # MHz
t1=50.0, # us
t2=30.0, # us
readout_frequency=6500.0, # MHz
)
# Setup simulator
setup = SimulationSetup(virtual_qubits={1: qubit})
sim = CWSpectroscopySimulator(setup)
# Single-tone frequency sweep
freqs = np.arange(4800, 5200, 2.0)
results = sim.sweep_frequency(
channel=1,
freq_array=freqs,
amplitude=10.0,
readout_frequency=6500.0
)
# Find qubit frequency
f_01 = freqs[np.argmax(np.abs(results))]
print(f"Qubit frequency: {f_01} MHz")# Sweep two tones to map the energy level structure
freqs = np.arange(4600, 5200, 5.0)
results_2d = sim.sweep_two_tone(
channel=1,
freq1_array=freqs,
freq2_array=freqs,
amp1=15.0,
amp2=15.0,
readout_frequency=6500.0
)
# Expected features:
# - Horizontal/vertical lines at f_01 = 5000 MHz (0→1 transition)
# - Horizontal/vertical lines at f_12 = 4800 MHz (1→2 transition)
# - Diagonal features from multi-photon processesE_n = n·f_q + (α/2)·n(n-1)
Transitions:
f_01 = f_q (ground to first excited)
f_12 = f_q + α (first to second excited)
f_23 = f_q + 2α (second to third excited)
For multi-tone driving, the simulator uses a transition-resolved secular RWA:
- Each ladder transition is assigned to the nearest drive tone
- Cumulative rotating frames eliminate fast oscillations
- Valid for CW steady-state spectroscopy
See the examples/ directory:
single_tone_spectroscopy.py- Basic frequency sweeptwo_tone_spectroscopy.py- Two-tone 2D scandemo_notebook.ipynb- Interactive Jupyter notebook
See docs/SPECTROSCOPY_GUIDE.md for detailed usage.
MIT License - see LICENSE