Skip to content

Transmon Floquet analysis¤

Here we perform a Floquet simulation of a transmon subject to off-resonant drives. We extract as a function of drive strength and drive frequency the probability of ionization for the two qubit states. We then compare the 2D plots (with the x and y axes drive frequency and induced ac stark shift on the qubit, respectively and the z axis ionization probability) with Blais-style branch crossing plots, which identify the states the qubit states leak to.

import matplotlib.pyplot as plt
import numpy as np
import qutip as qt
import scqubits as scq
from cycler import cycler

import floquet as ft


color_cycler = cycler(plt.rcParams["axes.prop_cycle"])
ls_cycler = cycler(ls=["-", "--", "-.", ":"])
alpha_cycler = cycler(alpha=[1.0, 0.6, 0.2])
color_ls_alpha_cycler = alpha_cycler * ls_cycler * color_cycler
/Users/danielweiss/anaconda3/envs/floquet_usr_v4/lib/python3.10/site-packages/qutip/__init__.py:66: UserWarning: The new version of Cython, (>= 3.0.0) is not supported.
  warnings.warn(

Define simulation parameters¤

filepath = ft.generate_file_path("h5py", "transmon_floquet", "out")

# drive frequencies to scan over
omega_d_values = 2.0 * np.pi * np.linspace(7.5, 10.0, 120)
# induced ac stark shifts to scan over
chi_ac_values = 2.0 * np.pi * np.linspace(0.0, 0.1, 59)

# transmon parameters
num_states = 20
qubit_params = {"EJ": 20.0, "EC": 0.2, "ng": 0.25, "ncut": 41}
tmon = scq.Transmon(**qubit_params, truncated_dim=num_states)
state_indices = [0, 1]  # get data for ground and first excited states

# express operators in eigenbasis of transmon
hilbert_space = scq.HilbertSpace([tmon])
hilbert_space.generate_lookup()
evals = hilbert_space["evals"][0][0:num_states]
H0 = 2.0 * np.pi * qt.Qobj(np.diag(evals - evals[0]))
H1 = hilbert_space.op_in_dressed_eigenbasis(tmon.n_operator)

# to achieve same range of chi_ac for the various drive frequencies,
# need to drive at different strengths
chi_to_amp = ft.ChiacToAmp(H0, H1, state_indices, omega_d_values)
# resulting array has shape (a,w), where a is amplitude and w is frequency
drive_amplitudes = chi_to_amp.amplitudes_for_omega_d(chi_ac_values)

model = ft.Model(
    H0, H1, omega_d_values=omega_d_values, drive_amplitudes=drive_amplitudes
)

options = ft.Options(
    fit_range_fraction=0.5,  # split the fit into segments based on this fraction
    floquet_sampling_time_fraction=0.0,  # what part of the period to look at
    fit_cutoff=4,  # polynomial cutoff
    overlap_cutoff=0.8,  # cutoff for the excluding from the fit
    nsteps=30_000,  # qutip integration parameter
    num_cpus=6,
    save_floquet_modes=True,  # whether or not to save floquet modes themselves
)
floquet_analysis = ft.FloquetAnalysis(
    model, state_indices=state_indices, options=options
)
data_vals = floquet_analysis.run(filepath=filepath)
Running floquet simulation with parameters: 
model: H0: Quantum object: dims = [[20], [20]], shape = (20, 20), type = oper, isherm = True
Qobj data =
[[  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.          34.23724704   0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.          67.09785619   0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.          98.47961089   0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.         128.25003724
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
  156.22750407   0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.         182.13850375   0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.         205.48208586   0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.         225.20183516   0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.         242.25351923
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
  262.47586566   0.           0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.         287.04537981   0.           0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.         315.06068744   0.           0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.         346.13087396   0.
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.         380.07263397
    0.           0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
  416.78049749   0.           0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.         456.18745091   0.           0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.         498.24831205   0.           0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.         542.93133281   0.        ]
 [  0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.           0.
    0.           0.           0.           0.         590.21349905]]
H1: Quantum object: dims = [[20], [20]], shape = (20, 20), type = oper, isherm = True
Qobj data =
[[ 2.50000000e-01  1.30478755e+00 -6.68334662e-09  3.17222270e-02
  -1.64984006e-07  1.61075693e-03 -2.07812079e-06 -1.43721227e-04
   1.16018937e-05  2.13132384e-05 -7.99948826e-06 -3.18805473e-06
   1.04639272e-06 -3.10309538e-07  8.39730634e-08 -2.09701869e-08
   4.86970014e-09 -1.05788021e-09 -2.16029041e-10  4.16382826e-11]
 [ 1.30478755e+00  2.50000010e-01  1.80742562e+00  3.69773627e-07
   6.71662233e-02  6.42561273e-06  4.56400223e-03 -5.78531553e-05
  -5.27290640e-04  1.36992485e-04  8.80028474e-05 -3.20034041e-05
  -1.06211468e-05 -3.14638730e-06 -8.51517057e-07 -2.12644048e-07
  -4.93802504e-08 -1.07272291e-08  2.19060059e-09  4.22224930e-10]
 [-6.68334659e-09  1.80742562e+00  2.49999530e-01  2.16241211e+00
  -1.16060998e-05  1.13301038e-01 -1.46189185e-04 -1.01103216e-02
   8.16156310e-04  1.49931842e-03 -5.62738565e-04 -2.24269498e-04
   7.36104011e-05 -2.18292878e-05  5.90723804e-06 -1.47518587e-06
   3.42567922e-07 -7.44185041e-08 -1.51969562e-08  2.92912059e-09]
 [ 3.17222270e-02  3.69773627e-07  2.16241211e+00  2.50013997e-01
   2.43026270e+00  2.43219743e-04  1.72711829e-01 -2.18983477e-03
  -1.99586933e-02  5.18538893e-03  3.33104470e-03 -1.21138153e-03
  -4.02026972e-04 -1.19095940e-04 -3.22312486e-05 -8.04892737e-06
  -1.86911949e-06 -4.06043285e-07  8.29176487e-08  1.59819088e-08]
 [-1.64984006e-07  6.71662233e-02 -1.16060998e-05  2.43026270e+00
   2.49713494e-01  2.63063767e+00 -3.60880279e-03 -2.49425482e-01
   2.01476133e-02  3.70104777e-02 -1.38919909e-02 -5.53614116e-03
   1.81717950e-03 -5.38860835e-04  1.45828741e-04 -3.64152921e-05
   8.45678617e-06 -1.83703736e-06 -3.75158912e-07  7.23059948e-08]
 [ 1.61075693e-03  6.42561273e-06  1.13301038e-01  2.43219743e-04
   2.63063767e+00  2.54226467e-01  2.76628941e+00 -3.80536855e-02
  -3.46216593e-01  9.01297038e-02  5.78594502e-02 -2.10585389e-02
  -6.98334213e-03 -2.07036036e-03 -5.59867716e-04 -1.39922323e-04
  -3.24672394e-05 -7.05864487e-06  1.44030767e-06  2.77829047e-07]
 [-2.07812079e-06  4.56400223e-03 -1.46189185e-04  1.72711829e-01
  -3.60880279e-03  2.76628941e+00  2.04542944e-01 -2.81615764e+00
   2.54037460e-01  4.62827007e-01 -1.75725879e-01 -6.94106631e-02
   2.29944935e-02 -6.75640428e-03  1.84531749e-03 -4.56586389e-04
   1.07012209e-04 -2.30333525e-05 -4.74726253e-06  9.06595313e-07]
 [-1.43721227e-04 -5.78531553e-05 -1.01103216e-02 -2.18983477e-03
  -2.49425482e-01 -3.80536855e-02 -2.81615764e+00  5.93152653e-01
   2.65099921e+00 -8.32223252e-01 -4.99643412e-01  1.97279990e-01
   6.04956096e-02  1.94033973e-02  4.85022592e-03  1.31135485e-03
   2.81269080e-04  6.61537636e-05 -1.24776243e-05 -2.60381949e-06]
 [ 1.16018937e-05 -5.27290640e-04  8.16156310e-04 -1.99586933e-02
   2.01476133e-02 -3.46216593e-01  2.54037460e-01  2.65099921e+00
  -1.24102292e+00 -1.92510513e+00  1.22979930e+00  3.17713172e-01
  -1.64435461e-01  3.09813813e-02 -1.31996456e-02  2.09369846e-03
  -7.65464670e-04  1.05620532e-04  3.39574501e-05 -4.15723586e-06]
 [ 2.13132384e-05  1.36992485e-04  1.49931842e-03  5.18538893e-03
   3.70104777e-02  9.01297038e-02  4.62827007e-01 -8.32223252e-01
  -1.92510513e+00  3.46132081e+00  7.31230736e-01 -1.20480871e+00
  -9.11245421e-02 -1.20491448e-01 -7.30838786e-03 -8.14434036e-03
  -4.23820940e-04 -4.10856790e-04  1.88014925e-05  1.61713689e-05]
 [-7.99948826e-06  8.80028474e-05 -5.62738565e-04  3.33104470e-03
  -1.38919909e-02  5.78594502e-02 -1.75725879e-01 -4.99643412e-01
   1.22979930e+00  7.31230736e-01 -4.22952572e+00 -1.39005908e-01
   1.11321708e+00 -1.35954307e-02  9.03610644e-02 -9.18790285e-04
   5.24047300e-03 -4.63500972e-05 -2.32477263e-04  1.82434498e-06]
 [-3.18805473e-06 -3.20034041e-05 -2.24269498e-04 -1.21138153e-03
  -5.53614116e-03 -2.10585389e-02 -6.94106631e-02  1.97279990e-01
   3.17713172e-01 -1.20480871e+00 -1.39005908e-01  5.49963470e+00
   1.74766803e-02  1.01917513e+00  1.40181770e-03  6.94093920e-02
   8.12928994e-05  3.50159269e-03 -3.60630562e-06 -1.37823087e-04]
 [ 1.04639272e-06 -1.06211468e-05  7.36104011e-05 -4.02026972e-04
   1.81717950e-03 -6.98334213e-03  2.29944935e-02  6.04956096e-02
  -1.64435461e-01 -9.11245421e-02  1.11321708e+00  1.74766803e-02
  -5.63541764e+00  1.70964555e-03 -9.39091932e-01  1.15539421e-04
  -5.47513969e-02  5.82860259e-06  2.42891284e-03 -2.29414446e-07]
 [-3.10309538e-07 -3.14638730e-06 -2.18292878e-05 -1.19095940e-04
  -5.38860835e-04 -2.07036036e-03 -6.75640428e-03  1.94033973e-02
   3.09813813e-02 -1.20491448e-01 -1.35954307e-02  1.01917513e+00
   1.70964555e-03  6.72125544e+00  1.37132293e-04  8.71266532e-01
   7.95244762e-06  4.41238222e-02 -3.52785504e-07 -1.73673366e-03]
 [ 8.39730634e-08 -8.51517057e-07  5.90723804e-06 -3.22312486e-05
   1.45828741e-04 -5.59867716e-04  1.84531749e-03  4.85022592e-03
  -1.31996456e-02 -7.30838786e-03  9.03610644e-02  1.40181770e-03
  -9.39091932e-01  1.37132293e-04 -6.78035538e+00  9.26752684e-06
  -8.13023933e-01  4.67517757e-07  3.61722947e-02 -1.84015509e-08]
 [-2.09701869e-08 -2.12644048e-07 -1.47518587e-06 -8.04892737e-06
  -3.64152921e-05 -1.39922323e-04 -4.56586389e-04  1.31135485e-03
   2.09369846e-03 -8.14434036e-03 -9.18790285e-04  6.94093920e-02
   1.15539421e-04  8.71266532e-01  9.26752684e-06  7.82306753e+00
   5.37433745e-07  7.62372518e-01 -2.38415698e-08 -3.00739904e-02]
 [ 4.86970014e-09 -4.93802504e-08  3.42567922e-07 -1.86911949e-06
   8.45678617e-06 -3.24672394e-05  1.07012209e-04  2.81269080e-04
  -7.65464670e-04 -4.23820940e-04  5.24047300e-03  8.12928994e-05
  -5.47513969e-02  7.95244762e-06 -8.13023933e-01  5.37433745e-07
  -7.85498898e+00  2.71118523e-08  7.17853486e-01 -1.06712552e-09]
 [-1.05788021e-09 -1.07272291e-08 -7.44185041e-08 -4.06043285e-07
  -1.83703736e-06 -7.05864487e-06 -2.30333525e-05  6.61537636e-05
   1.05620532e-04 -4.10856790e-04 -4.63500972e-05  3.50159269e-03
   5.82860259e-06  4.41238222e-02  4.67517757e-07  7.62372518e-01
   2.71118523e-08  8.87945806e+00 -1.20273266e-09 -6.78374395e-01]
 [-2.16029041e-10  2.19060059e-09 -1.51969562e-08  8.29176487e-08
  -3.75158912e-07  1.44030767e-06 -4.74726253e-06 -1.24776243e-05
   3.39574501e-05  1.88014925e-05 -2.32477263e-04 -3.60630562e-06
   2.42891284e-03 -3.52785504e-07  3.61722947e-02 -2.38415698e-08
   7.17853486e-01 -1.20273266e-09 -8.89859690e+00  4.73396912e-11]
 [ 4.16382826e-11  4.22224930e-10  2.92912059e-09  1.59819088e-08
   7.23059948e-08  2.77829047e-07  9.06595313e-07 -2.60381949e-06
  -4.15723586e-06  1.61713689e-05  1.82434498e-06 -1.37823087e-04
  -2.29414446e-07 -1.73673366e-03 -1.84015509e-08 -3.00739904e-02
  -1.06712552e-09 -6.78374395e-01  4.73396912e-11  9.91381802e+00]]
omega_d_values: [47.1238898  47.2558895  47.38788919 47.51988888 47.65188857 47.78388826
 47.91588795 48.04788764 48.17988733 48.31188703 48.44388672 48.57588641
 48.7078861  48.83988579 48.97188548 49.10388517 49.23588487 49.36788456
 49.49988425 49.63188394 49.76388363 49.89588332 50.02788301 50.1598827
 50.2918824  50.42388209 50.55588178 50.68788147 50.81988116 50.95188085
 51.08388054 51.21588023 51.34787993 51.47987962 51.61187931 51.743879
 51.87587869 52.00787838 52.13987807 52.27187777 52.40387746 52.53587715
 52.66787684 52.79987653 52.93187622 53.06387591 53.1958756  53.3278753
 53.45987499 53.59187468 53.72387437 53.85587406 53.98787375 54.11987344
 54.25187314 54.38387283 54.51587252 54.64787221 54.7798719  54.91187159
 55.04387128 55.17587097 55.30787067 55.43987036 55.57187005 55.70386974
 55.83586943 55.96786912 56.09986881 56.23186851 56.3638682  56.49586789
 56.62786758 56.75986727 56.89186696 57.02386665 57.15586634 57.28786604
 57.41986573 57.55186542 57.68386511 57.8158648  57.94786449 58.07986418
 58.21186388 58.34386357 58.47586326 58.60786295 58.73986264 58.87186233
 59.00386202 59.13586171 59.26786141 59.3998611  59.53186079 59.66386048
 59.79586017 59.92785986 60.05985955 60.19185925 60.32385894 60.45585863
 60.58785832 60.71985801 60.8518577  60.98385739 61.11585708 61.24785678
 61.37985647 61.51185616 61.64385585 61.77585554 61.90785523 62.03985492
 62.17185462 62.30385431 62.435854   62.56785369 62.69985338 62.83185307]
drive_amplitudes: [[ 0.          0.          0.         ...  0.          0.
   0.        ]
 [ 1.12426412  1.1338659   1.14344842 ...  2.14500354  2.15300056
   2.16098688]
 [ 1.58994957  1.60352853  1.61708027 ...  3.0334931   3.04480259
   3.05609696]
 ...
 [ 8.4132223   8.48507542  8.55678449 ... 16.05173669 16.1115809
  16.17134508]
 [ 8.48800797  8.5604998   8.63284629 ... 16.1944216  16.25479777
  16.3150932 ]
 [ 8.56214045  8.63526541  8.70824376 ... 16.33586028 16.39676376
  16.4575858 ]]
state_indices: [0, 1]
options: fit_range_fraction: 0.5
floquet_sampling_time_fraction: 0.0
fit_cutoff: 4
overlap_cutoff: 0.8
nsteps: 30000
num_cpus: 6
save_floquet_modes: True
calculating for amp_range_idx=0
calculating for amp_range_idx=1
finished in 0.5610183835029602 minutes

Plot the probability of nonlinear transitions¤

# All of the data is saved in data_vals above, but we can also recover the data from
# file as shown here.
_, new_data_dict = ft.read_from_file(filepath)
tmon_idx = 1  # Plot leakage probability for |e>. Try 0 for |g>
omega_d_idx = 100  # Drive frequency where we take a linecut

# Clipping the transition probability data at 0.5 gives nice-looking results.
# try plotting "bare_state_overlaps" or "intermediate_state_overlaps" instead of
# "displaced_state_overlaps" to look at the overlaps with the bare state or the
# displaced state obtained from fitting the intermediate amplitude regions,
# respectively. In the bare_state_overlaps results you can clearly see the effects of
# the ac stark shift, causing deviation of the floquet mode from the bare state
# even in the absence of a resonance.
plot_data = np.clip(
    1 - new_data_dict["displaced_state_overlaps"][:, :, tmon_idx].T ** 2, 0.0, 0.5
)
fig, ax = plt.subplots(figsize=(8, 8))
xticks = omega_d_values / (2.0 * np.pi)
yticks = chi_ac_values / (2.0 * np.pi)
num_x_pts = len(xticks)
num_y_pts = len(yticks)
im = plt.imshow(
    plot_data, origin="lower", cmap="Blues", aspect=0.75, interpolation="none"
)
plt.axvline(omega_d_idx, color="grey", ls="--")
ax.set_title(f"$P_{tmon_idx}$" + r"$\rightarrow$", fontsize=15)
xticklabel_locations = np.linspace(0, num_x_pts - 1, 6, dtype=int)
ax.set_xticks(xticklabel_locations)
ax.set_xticklabels(
    np.array(np.around(xticks[xticklabel_locations], decimals=2), dtype=str),
    fontsize=12,
)
yticklabel_locations = np.linspace(0, num_y_pts - 1, 3, dtype=int)
ax.set_yticks(yticklabel_locations)
ax.set_yticklabels(
    np.array(np.around(yticks[yticklabel_locations], decimals=2), dtype=str),
    fontsize=12,
)
ax.set_ylabel(r"$\chi_{\rm ac}$ [GHz]", fontsize=15)
ax.set_xlabel(r"$\omega_r/2\pi$ [GHz]", fontsize=15)
cax = plt.axes([0.91, 0.35, 0.05, 0.3])
cbar = plt.colorbar(im, cax=cax)
plt.show()
2024-10-14T16:12:59.759942 image/svg+xml Matplotlib v3.9.2, https://matplotlib.org/

Branch analysis¤

We can compare these results with those obtained from the Blais branch analysis, giving us insight into which states are responsible for these transitions

fig, ax = plt.subplots(figsize=(6, 4))
for curve_idx, sty in zip(
    range(floquet_analysis.hilbert_dim), color_ls_alpha_cycler, strict=False
):
    plt.plot(
        chi_ac_values / 2 / np.pi,
        new_data_dict["avg_excitation"][omega_d_idx, :, curve_idx],
        label=curve_idx,
        **sty,
    )
ax.set_xlabel("induced ac stark shift [GHz]")
ax.legend(fontsize=12, ncol=2, loc="upper left", bbox_to_anchor=(1, 1))
plt.tight_layout()
plt.show()
2024-10-14T16:13:03.640457 image/svg+xml Matplotlib v3.9.2, https://matplotlib.org/

Quasienergies¤

We see that the scar plots and Blais plots both predict two locations (in drive power) where the first excited state can ionize. Lets look at the quasienergies to confirm that the quasienergies have an avoided crossing for the states experiencing branch crossings

fig, ax = plt.subplots(figsize=(6, 4))
for curve_idx, sty in zip(
    range(floquet_analysis.hilbert_dim), color_ls_alpha_cycler, strict=False
):
    plt.plot(
        chi_ac_values / 2 / np.pi,
        new_data_dict["quasienergies"][omega_d_idx, :, curve_idx] / 2 / np.pi,
        label=curve_idx,
        **sty,
    )
ax.set_xlabel("induced ac stark shift [GHz]")
ax.set_ylabel("quasienergies [GHz]")
ax.legend(fontsize=12, ncol=2, loc="upper left", bbox_to_anchor=(1, 1))
ax.set_ylim(-27 / 2 / np.pi, -20 / 2 / np.pi)
plt.tight_layout()
plt.show()
2024-10-14T16:13:05.473775 image/svg+xml Matplotlib v3.9.2, https://matplotlib.org/

Exploring the fit¤

The fit coefficients are returned by the analsysis, and if the Floquet modes have been saved we can plot the fitted state against the true Floquet modes.

omega_d = omega_d_values[omega_d_idx]
displaced_state = ft.DisplacedState(
    hilbert_dim=floquet_analysis.hilbert_dim,
    model=model,
    state_indices=state_indices,
    options=options,
)


def state_for_amp(amp: float) -> qt.Qobj:
    return displaced_state.displaced_state(
        omega_d, amp, tmon_idx, new_data_dict["fit_data"][tmon_idx]
    )


fig, ax = plt.subplots()
for comp_idx, color in zip(range(10), color_cycler, strict=False):
    ideal_state_component = [
        np.real(
            qt.basis(floquet_analysis.hilbert_dim, comp_idx).dag() * state_for_amp(amp)
        )
        for amp in drive_amplitudes[:, omega_d_idx]
    ]
    # Components of the true Floquet mode
    plt.plot(
        chi_ac_values / 2 / np.pi,
        np.real(new_data_dict["floquet_modes"][omega_d_idx, :, tmon_idx, comp_idx]),
        label=rf"$\langle\widetilde{tmon_idx}|{comp_idx} \rangle$",
        color=color["color"],
    )
    # Components of the fitted state
    plt.plot(
        chi_ac_values / 2 / np.pi,
        np.real(np.squeeze(ideal_state_component)),
        ls="--",
        label=rf"$\langle\widetilde{tmon_idx}|{comp_idx} \rangle$, fit",
        color=color["color"],
    )
ax.legend(ncol=2, bbox_to_anchor=(1.1, 1.05))
ax.set_xlabel("induced ac stark shift [GHz]")
ax.set_ylabel("overlap")
plt.show()
2024-10-14T16:13:07.983408 image/svg+xml Matplotlib v3.9.2, https://matplotlib.org/

We see that the fit goes straight through the resonances, as desired!