# Monitoring the energy of a cavity by observing the emission of a repeatedly excited qubit

Hector Hutin, Antoine Essig, Réouven Assouly, Pierre Rouchon, Audrey

Bienfait, Benjamin Huard

► To cite this version:

Hector Hutin, Antoine Essig, Réouven Assouly, Pierre Rouchon, Audrey Bienfait, et al. Monitoring the energy of a cavity by observing the emission of a repeatedly excited qubit. Physical Review Letters, 2024, 133 (15), pp.153602. 10.1103/PhysRevLett.133.153602. hal-04743685

HAL Id: hal-04743685

https://hal.science/hal-04743685v1

Submitted on 18 Oct 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Monitoring the energy of a cavity by observing
the emission of a repeatedly excited qubit

H. Hutin,¹ A. Essig,¹ R. Assouly,¹ P. Rouchon,² A. Bienfait,¹ and B. Huard¹

¹Ecole Normale Supérieure de Lyon, CNRS, Laboratoire de Physique, F-69342 Lyon, France

²Laboratoire de Physique de l'Ecole normale supérieure, Mines-Paris - PSL, Inria, ENS-PSL, CNRS, Université PSL, Paris, France.

(Dated: February 8, 2024)

The number of excitations in a large quantum system (harmonic oscillator or qudit) can be measured in a quantum non demolition manner using a dispersively coupled qubit. It typically requires a series of qubit pulses that encode various binary questions about the photon number. Recently, a method based on the fluorescence measurement of a qubit driven by a train of identical pulses was introduced to track the photon number in a cavity, hence simplifying its monitoring and raising interesting questions about the measurement backaction of this scheme. A first realization with superconducting circuits demonstrated how the average number of photons could be measured in this way. Here we present an experiment that reaches single shot photocounting and number tracking owing to a cavity decay rate 4 orders of magnitude smaller than both the dispersive coupling rate and the qubit emission rate. An innovative notch filter and pogo-pin based galvanic contact makes possible these seemingly incompatible features. The qubit dynamics under the pulse train is characterized. We observe quantum jumps by monitoring the photon number via the qubit fluorescence as photons leave the cavity one at a time. Besides, we extract the measurement rate and induced dephasing rate and compare them to theoretical models. Our method could be applied to quantum error correction protocols on bosonic codes or qudits.

Resolving the number of photons in an electromag-
netic mode is at the core of many quantum information
protocols [1–4]. Most of them require quantum nonde-
molition (QND) measurements for measurement based
feedback or heralding. In the microwave domain, such
measurements can be performed using dispersively cou-
pled Rydberg atoms [5] or superconducting qubits [6].
Predetermined [7, 8] or adaptive [9–13] measurement se-
quences can monitor the photon number in time and even
detect quantum jumps. Each measurement step yields
at most a single bit of information about the photon
number. By adapting each step, it is possible to reach
this upper bound and photocount in a number of cy-
cles that scales logarithmically with the maximal photon
number [11–13]. Recently, another qubit-based detector
was introduced, which is able to track the photon number
using a train of identical qubit pulses forming a frequency
comb [14]. Consequently the frequency of the qubit
fluorescence encodes the photon number at any time.
While a proof-of-principle experiment demonstrated sig-
nals proportional to the photon number [14], the mea-
surement rate was insufficient compared to the cavity
lifetime for single-shot extraction. Here, we demonstrate
photon number tracking in a 3D cavity using a frequency
comb driving a dispersively coupled qubit. We experi-
mentally compare the photon number measurement rate
of our scheme based on heterodyne detection of the qubit
fluorescence to the rate at which the environment could
extract information. This QND photon number moni-
tor, with a fixed drive and detection scheme, could sim-
plify feedback schemes and quantum error correction for
bosonic codes [15] or qudits [16, 17].

The detection principle can easily be grasped with a
classical analogy (Fig. 1a). Consider a basket (cavity)
filled with apples (photons) that can escape. The number
*n* of apples can be determined by hitting a string (qubit)
from which the basket hangs. The string oscillates at
a frequency depending on *n* and recording the emitted
sound (heterodyne measurement of fluorescence signal)
reveals the apple number. Hitting repeatedly the string
leads to the monitoring of *n*: in the frequency domain, it
corresponds to driving the string with a comb.

Experimentally, the basket is an aluminum λ/4 coaxial
cavity [18] at frequency ω_c/2π = 4.573 GHz. The qubit
is a transmon at ω_q/2π = 6.247 GHz, dispersively cou-
pled to the cavity with a frequency shift −χ/2π = −5.25
MHz per photon. Photon number tracking requires to
operate in the photon number resolved regime χ > Γ₂,
with Γ₂/2π ≈ 3.5 MHz the qubit coherence rate [14].
To optimize the information rate, we maximize the qubit
emission rate 1/T_q ≤ 2Γ₂ into the measurement line un-
der this constraint.

To protect the cavity from decaying through the qubit,
we use a notch filter at the cavity frequency (Fig. 1b).
The filter circuit is composed of two on-chip spurlines
in series (Fig. 1c). The qubit and the notch filter are
patterned out of a tantalum film on the same sapphire
chip, which is inserted into the cavity [19]. A galvanic
connection is ensured between the measurement line and
the on-chip filter using an SMA microwave connector ter-
minated by a pogo pin [20], which is a pin connected to
a spring (Fig. 1c). This filter design leads to a high cou-
pling rate 1/T<sub>q</sub> = (23 ± 3 ns)<sup>-1</sup> between the qubit and the
measurement line, while preserving a cavity lifetime T<sub>c</sub>
<figure><img src="image_2.png" /><figcaption>FIG. 1. (a) Acoustic analogy of the experiment. In order to monitor the number of apples in a basket, it is attached to a string. By repeatedly hitting the string, recording the emitted sound reveals the number $n$ at any time. (b) The heterodyne detection of the driven qubit (red) emission into the line leads to the monitoring of the photon number of the dispersively coupled cavity (green). A notch filter centered on $\omega_c$ (box) prevents the cavity from decaying through the qubit. (c) The cavity is a high purity aluminium $\lambda/4$ coaxial resonator. Two transmon qubits on sapphire chips stick into the cavity. The filter on the (red) qubit drive line is composed of two tantalum spurlines and galvanically connected to a transmission line using a pogo pin (photograph in inset). Wigner tomography of the cavity is performed using the auxiliary transmon qubit (purple) and its dedicated readout resonator (not shown).</figcaption></figure>

larger than 200 µs for a single photon. The heterodyne detection benefits from the large bandwidth of a traveling wave parametric amplifier (TWPA [21]) that covers many $\chi$. An auxiliary transmon qubit and its readout resonator are used to perform direct Wigner tomography of the cavity state [19, 22–24].

The qubit is driven with a frequency comb of amplitude $\Omega$ and peaks at $\omega_q + k\Delta\omega$ where $k$ spans all integers between $-K$ and $K$. In the lab frame, the qubit drive Hamiltonian thus reads

$$ \hat{H}_d = -\hbar \frac{\Omega}{2} \sum_{k=-K}^{K} \cos[(\omega_q + k\Delta\omega)t] \hat{\sigma}_y. \quad (1) $$

In the limit of an infinite Dirac comb ($K \to \infty$), it becomes a series of Dirac peaks in the time domain with a

period $2\pi/\Delta\omega$. In the frame rotating at $\omega_q - \chi\hat{c}^\dagger\hat{c}$, and under the rotating wave approximation, it gives

$$ \hat{H}_d = \hbar \frac{\pi \Omega}{\Delta \omega} \sum_{l=-\infty}^{\infty} \delta\left(t - \frac{2\pi l}{\Delta \omega}\right) \hat{\sigma}(t), \quad (2) $$

where $\hat{\sigma}(t) = \sin(\hat{c}^\dagger\hat{c}\chi t)\hat{\sigma}_x - \cos(\hat{c}^\dagger\hat{c}\chi t)\hat{\sigma}_y$ and $\hat{c}^\dagger\hat{c}$ is the photon number in the cavity. The dynamics of the qubit Bloch vector thus consists in periodic kicks every $2\pi/\Delta\omega$ by an angle $\theta = 2\pi\Omega/\Delta\omega$. The natural choice is to have one peak per possible qubit frequency ($\Delta\omega = \chi$). The rotation axis of the kicks would then be the same for any photon number since $\varphi = 2\pi\hat{c}^\dagger\hat{c}\chi/\Delta\omega$ is a multiple of $2\pi$. However, the period between two kicks would then be $2\pi/\chi \approx 190$ ns, which is much longer than $T_q$. To limit idle times in the qubit fluorescence signal, we choose a twice larger peak spacing $\Delta\omega = 2\chi$, which doubles the information rate (Fig. 2a). Consequently, $\varphi$ is equal to 0 mod $2\pi$ for even photon numbers and $\pi$ mod $2\pi$ for odd photon numbers. Therefore the kick direction flips with each kick for odd photon numbers.

In the experiment, we choose a finite number $2K+1 = 21$ peaks in the comb. In the frequency domain the drive is the product of a square window of width $21\chi/2\pi$ and the infinite comb. Consequently, in the time domain, the resulting waveform is the convolution of the infinite comb with a sinc function. This width sets the timescale of each qubit kick to $\pi/21\chi \approx 5$ ns, which is much shorter than $T_q$. Additionally, this choice guarantees that the qubit frequency remains well within the bandwidth of the comb, regardless of the desired photon number ranging from 0 to $N_{max} = 9$. To further minimize boundary effects, we position the comb center frequency at $\omega_q - 4\chi$, which corresponds to the qubit frequency associated with 4 photons in the cavity.

The average predicted dynamics of the qubit is shown in Fig. 2b,c when the cavity has 0 (blue) or 1 (orange) photon. At intervals of $\pi/\chi$, the qubit state undergoes a kick lasting approximately 5 ns, followed by relaxation as it fluoresces into the measurement line. In contrast with even photon numbers, the rotation axis flips at every kick for odd photon numbers. Heterodyne detection of the fluorescence field measures the two quadratures $(\hat{a}_{\text{out}}^\dagger + \hat{a}_{\text{out}})/2$ and $i(\hat{a}_{\text{out}} - \hat{a}_{\text{out}}^\dagger)/2$. The emitted field amplitude can be expressed as $\hat{a}_{\text{out}} = \hat{a}_{\text{in}} - \hat{\sigma}_{-}/\sqrt{T_q}$, where $\langle\hat{a}_{\text{in}}\rangle$ is the driving comb and $\hat{\sigma}_{-} = (\hat{\sigma}_x - i\hat{\sigma}_y)/2$ is the qubit lowering operator [25]. The average dynamics of the qubit coherences (Fig. 2c) can thus be directly observed in the heterodyne signal.

We first prepare a Fock state $|n\rangle$ using a coherent excitation on the cavity followed by heralding using the qubit emission under a drive at a single tone $\omega_q - n\chi$ [14, 19, 26]. We then apply the comb. The qubit fluorescence is amplified and downconverted by a local oscillator at $\omega_q + \omega_{\text{IF}}$, with $\omega_{\text{IF}} = 2\pi \times 66$ MHz. The amplified fluorescence signal is recorded as a voltage $V(t)$ using an analog-
<figure><img src="image_3.png" /><figcaption>FIG. 2. (a) Black peaks: driving comb amplitude $\Omega$ Eq. (1) in the frequency domain. Colored Lorentzian shapes: qubit frequency spectra corresponding to cavity photon numbers from 0 to 6. (b) Simulated average trajectories of the qubit in the Bloch sphere for $n = 0$ (blue) and $n = 1$ (green). The kick angle is set to $\theta = \pi\Omega/\chi = 3\pi/4$, and as in the experiment, $\chi T_q = 0.76$. (c) Corresponding average values of $\langle \hat{\sigma}_x \rangle$ as a function of time. (d) Averaged measured record $\overline{V_n}(t)$ when the cavity is prepared in a Fock state $|n\rangle$ from $n = 0$ to 4 from bottom to top, and for a comb amplitude such that $\theta = \pi\Omega/\chi \approx \pi/2$. The curves are offset by the much larger driving comb signal $c(t)$. (e) Corresponding quadrature $\overline{I_n}(t)$ of the emitted fluorescence signal reconstructed (see text) at each qubit frequency $\omega_q - n\chi$.</figcaption></figure>

to-digital-converter. The average $\overline{V_n}(t)$ of these records under the heralding of $n$ photons is shown in Fig. 2d offset by the contribution of the reflected driving comb $c(t) \propto \text{Re}(\langle \hat{a}_{in} \rangle)$ [19]. These signals can be processed to reveal the evolution of $\langle \hat{\sigma}_x \rangle$ and $\langle \hat{\sigma}_y \rangle$ in the qubit frame when there are $n$ photons. To do so, we extract their analytic representations [19] and demodulate them at $\omega_{IF} + n\chi$ to obtain two average quadratures $\overline{I_n}(t)$ and $\overline{Q_n}(t)$. The traces of $\overline{I_n}(t)$ are shown in Fig. 2e for $n = 0$ to 4 and match the expected evolution of $\langle \hat{\sigma}_x \rangle$. The kicks and the subsequent decays are visible. The kick direction alternates for odd numbers of photons as expected. The remaining oscillations in the reconstructed signal may be due to an imperfect subtraction of the driving comb $c(t)$, or to a distortion of the driving comb or output signal by the measurement setup.

Decoding the measurement record $V(t)$ in order to infer the photon number is a task similar to quantum sensing using continuous measurement [27–35]. Here we use the average records $\overline{V_n}$ as demodulation weight functions, and define $N_{max}+1$ measurement outcomes represented

<figure><img src="image_4.png" /><figcaption>FIG. 3. (a) Evolution of the measurement outcomes $m_n$ as a function of time $t$ after a linear transform by $G^{-1}$. The measurement is performed on one realization using a driving comb whose amplitude corresponds to an expected kick rotation angle $\theta = \pi/2$. (b) Evolution of the inferred probability distribution $\mathbb{P}_t(n)$ of the photon number $n$ using the outcomes in (a).</figcaption></figure>

as a vector $\vec{m}$ whose components are

$$m_n(t) = \int_{t-\tau}^{t} V(t') \overline{V_n(t')} dt', \quad (3)$$

where the integration time $\tau = 2 \mu$s is chosen much shorter than the cavity lifetime $T_c$ and multiple (21×) of $\pi/\chi$. As a demonstration, we excite the cavity with more than 20 photons on average using a strong resonant pulse, then drive the qubit with the frequency comb and record $\vec{m}$ as a function of time $t$. Quantum jumps can already be visualized by a simple data processing. We perform a time independent linear transform [19] $\vec{r}(t) = G^{-1}\vec{m}(t)$ so that, on average, $r_n(t) = 1$ for $n$ photons in the cavity, while all the other components $r_{k \neq n}$ vanish. Concretely, $G$ is the Gram matrix of the average records $\overline{V_n}(t)$ so that $G_{nm} = \int_0^\tau \overline{V_n(t)} \overline{V_m(t)} dt$. The evolution of $\vec{r}$ is shown in Fig. 3a for one realization of the experiment. A faint red trace emerges from the noise, which reveals the successive losses of single photons in the cavity that here decays from 9 to 0 photons over 1 ms.

To predict the number $n$ of photons at any time of the evolution, the probability distribution of $n$ is updated conditionally on the outcome $\vec{m}(t)$ through Bayesian update at every time step $j\tau$. It first requires determining the likelihood $\mathbb{P}(\vec{m}|n)$ conditioned on the cavity being in the Fock state $|n\rangle$. $\mathbb{P}(\vec{m}|n)$ can be approximated by a Gaussian function of $\vec{m}$ owing to the small measurement
<figure><img src="image_5.png" /><figcaption>FIG. 4. (a) Red dots: observed average measurement rate $\Gamma_m$ as a function of drive amplitude, expressed as the qubit expected rotation angle $\theta$ per kick. Orange shadow: measurement rate obtained using a stochastic master equation with detection efficiency $\eta$ spanning the range [0.17, 0.20]. Blue shadow: theoretical bound for an infinite comb and heterodyne measurement with efficiencies $\eta \in [0.17, 0.20]$. (b) Red dots: observed cavity dephasing rate $\Gamma_d$ as a function of $\theta$. Orange: simulated measurement induced dephasing rate. Black: theoretical accessible information rate. Blue: theoretical maximal ($\eta = 1$) measurement rate obtained by heterodyne detection.</figcaption></figure>

efficiency $\eta = 0.17 \pm 0.02$. Therefore, we characterize its distribution by the measured mean $\langle \vec{m} \rangle_n$ and covariance matrix of $\vec{m}$ for each $|n\rangle$ only [19]. Using this procedure, along with accounting for photon loss during each time step $j\tau$, the noisy measurement outcomes $\vec{m}(j\tau)$ of Fig. 3a lead to the probability distribution $P_{j\tau}(n)$ shown in Fig. 3b for the same realization. Note that we assume no prior information ($P_0(n) = 1/10$), but this choice has anyway no impact on the quantum trajectory after a few $\tau$. With many realizations, we extract the average photon number decay. Interestingly, it is not exponential, which indicates a subtle interplay between cavity dissipation and qubit dynamics [19].

We now determine the measurement rate $\Gamma_m$ of the photon number. Formally, it is the time derivative of the mutual information between the photon number $n$ and the outcome $\vec{m}$ at $t = 0$ [36, 37]. In the weak measurement regime $\tau\Gamma_m \ll 1$, it can be approximated by

$$ \tau\Gamma_m = - \int \mathbb{P}(\vec{m}) \log \mathbb{P}(\vec{m}) d\vec{m} + \sum_n \mathbb{P}_0(n) \int \mathbb{P}(\vec{m}|n) \log \mathbb{P}(\vec{m}|n) d\vec{m}, \quad (4) $$

where $\mathbb{P}(\vec{m}) = \sum_n \mathbb{P}_0(n)\mathbb{P}(\vec{m}|n)$. As shown in Fig. 3b,

at most two photon numbers are likely at any time. We thus choose the prior $P_0(q) = P_0(q+1) = 1/2$, and average over all $q$ values to compute a measurement rate $\Gamma_m$ [19]. Plugging in Eq. (4) the measured distributions $\mathbb{P}(\vec{m}|n)$ at various driving amplitudes $\Omega$, $\Gamma_m$ is obtained as a function of the kick angle $\theta = \pi\Omega/\chi$ (Fig. 4a). It is maximal when the qubit is kicked to states corresponding to the largest $\langle \hat{\sigma}_x \rangle$. It can be intuitively understood since heterodyne detection probes the quadratures of the emitted fluorescence signal, which are on average proportional to the coherence $\langle \hat{\sigma}_x - i\hat{\sigma}_y \rangle$. Notably, the rate $\Gamma_m$ is much larger than the cavity decay rate $1/T_c$ (more than 16 times), which is well in the single shot measurement regime. Our complete model [19] reproduces the observed rate $\Gamma_m$ using simulated measurement records by a stochastic master equation with detection efficiency $\eta = 0.185 \pm 0.015$ as a fit parameter, in agreement with the independently measured $\eta$.

It is interesting to compare this measurement rate to the rate at which information about the photon number leaks into the environment, i.e. the cavity dephasing rate $\Gamma_d$. We compute it as the added decay rate of $\text{Tr}\{\hat{\rho}(t)\hat{a}\}$ on top of the natural decoherence rate [19].

We use the auxiliary transmon qubit (purple in Fig. 1c) to perform Wigner tomography on the cavity state and extract $\text{Tr}\{\hat{\rho}(t)\hat{a}\} = \int \alpha W_t(\alpha) d^2\alpha$, with $W_t(\alpha)$ the Wigner function of $\hat{\rho}(t)$. The dependence of $\Gamma_d$ on kick angle is shown as red dots in Fig. 4b. Strikingly, its maximum is reached at $\theta \approx \pi$, where the qubit has the largest energy to emit, and thus the most information to leak out. We note that the model that successfully predicts the measurement rate (orange) underestimates the measurement induced dephasing rate at large drive amplitudes, indicating that the driving comb leads to stronger decoherence than anticipated.

The dephasing rate $\Gamma_d$ is about 20 times larger than $\Gamma_m$ at $\theta = \pi/2$ (its maximum). Indeed our measurement setup does not recover the full information available because of a limited detection efficiency and the very use of heterodyne detection. To better understand this information loss, we use a simplified model where the comb is infinite. It reproduces the measured $\Gamma_m$ with $0.17 < \eta < 0.20$ (blue in Fig. 4a) for small angles $\theta$. However, the dephasing rate is larger than the measurement rate of an ideal ($\eta = 1$) heterodyne measurement (blue in Fig. 4b). Accordingly, with the same model, the upper bound on the measurement rate for any detection scheme – accessible information rate – (black in Fig. 4b) is close to the measured $\Gamma_d$ for small angles $\theta$ and up to about 3 times larger than what the best heterodyne detector could do: Even an ideal heterodyne detector would destroy up to about 2/3 of the accessible information. The experiment provides here a textbook example of destroyed information by a measurement apparatus, here the heterodyne detector [38]. In contrast to low detection efficiency, heterodyne measurement with $\eta = 1$
would reveal information even for $\theta = \pi$. Indeed, while the average heterodyne signal is zero, its cumulants reveal the photon number. The signal-to-noise ratio on the cumulants of order $l$ scales as $\eta^l$ so that, in the experiment, the average is the main source of information, hence the minimum at $\theta = \pi$.

In conclusion, our superconducting circuit and signal processing demonstrate the possibility to monitor photon numbers in a cavity with a fixed driving. This result was obtained with a TWPA [21] that led to close to 20% detection efficiency. Information about the photon number is extracted up to 16 times faster than the cavity decay rate. A simple model quantitatively explains the dephasing and measurement rates for small drive amplitudes. As we look ahead to more integrated amplifiers, it would be interesting to observe how the driving amplitude that maximizes the measurement rate evolves with increased efficiency. Additionally, the pogo-pin and spurline filters offer a convenient architecture for achieving galvanic coupling with quantum circuits within a long lived microwave cavity. Interesting open questions remain to be explored such as the origin of the dependence of Fock state decay rates on the comb amplitude. This seems to be a dual effect to the readout problem of superconducting qubit [39–46].

This research was supported by the QuantERA grant ARTEMIS, by ANR under the grant ANR-22-QUA1-0004, and PR received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. [884762]). We acknowledge IARPA and Lincoln Labs for providing a Josephson Traveling-Wave Parametric Amplifier. We thank Rémy Dassonneville, Pierre Guilmin, Sébastien Jezouin, Perola Milman, Mazar Mirrahimi, Klaus Mølmer, Alain Sarlette, Antoine Tilloy, Benoît Vermersch and Mattia Walschaers for useful discussions.

[1] E. Knill, R. Laflamme, and G. J. Milburn, Nature 409, 46 (2001).

[2] C. Simon, H. de Riedmatten, M. Afzelius, N. Sangouard, H. Zbinden, and N. Gisin, Physical Review Letters 98, 190503 (2007).

[3] S. Aaronson and A. Arkhipov, Optics InfoBase Conference Papers 9, 143 (2014).

[4] C. S. Hamilton, R. Kruse, L. Sansoni, S. Barkhofen, C. Silberhorn, and I. Jex, Physical Review Letters 119, 170501 (2017).

[5] S. Gleyzes, S. Kuhr, C. Guerlin, J. Bernu, S. Deléglise, U. Busk Hoff, M. Brune, J.-M. Raimond, and S. Haroche, Nature 446, 297 (2007).

[6] D. I. Schuster, A. A. Houck, J. A. Schreier, A. Wallraff, J. M. Gambetta, A. Blais, L. Frunzio, J. Majer, B. Johnson, M. H. Devoret, S. M. Girvin, and R. J. Schoelkopf, Nature 445, 515 (2007).

[7] C. Guerlin, J. Bernu, S. Deleglise, C. Sayrin, S. Gleyzes, S. Kuhr, M. Brune, J.-M. Raimond, and S. Haroche, Nature 448, 889 (2007).

[8] B. R. Johnson, M. D. Reed, A. A. Houck, D. I. Schuster, L. S. Bishop, E. Ginossar, J. M. Gambetta, L. DiCarlo, L. Frunzio, S. M. Girvin, and R. J. Schoelkopf, Nature Physics 6, 663 (2010).

[9] B. Peaudecerf, C. Sayrin, X. Zhou, T. Rybarczyk, S. Gleyzes, I. Dotsenko, J. Raimond, M. Brune, and S. Haroche, Physical Review A 87, 042320 (2013).

[10] B. Peaudecerf, T. Rybarczyk, S. Gerlich, S. Gleyzes, J. Raimond, S. Haroche, I. Dotsenko, and M. Brune, Physical Review Letters 112, 080401 (2014).

[11] C. S. Wang, J. C. Curtis, B. J. Lester, Y. Zhang, Y. Y. Gao, J. Freeze, V. S. Batista, P. H. Vaccaro, I. L. Chuang, L. Frunzio, L. Jiang, S. M. Girvin, and R. J. Schoelkopf, Physical Review X 10, 021060 (2020).

[12] R. Dassonneville, R. Assouly, T. Peronnin, P. Rouchon, and B. Huard, Physical Review Applied 14, 044022 (2020).

[13] J. C. Curtis, C. T. Hann, S. S. Elder, C. S. Wang, L. Frunzio, L. Jiang, and R. J. Schoelkopf, Physical Review A 103, 023705 (2021).

[14] A. Essig, Q. Ficheux, T. Peronnin, N. Cottet, R. Lescanne, A. Sarlette, P. Rouchon, Z. Leghtas, and B. Huard, Physical Review X 11, 031045 (2021).

[15] W. Cai, Y. Ma, W. Wang, C.-L. Zou, and L. Sun, Fundamental Research 1, 50 (2021).

[16] J. Joo, C.-W. Lee, S. Kono, and J. Kim, Scientific Reports 9, 16592 (2019).

[17] Y. Wang, Z. Hu, B. C. Sanders, and S. Kais, Frontiers in Physics 8, 589504 (2020).

[18] M. Reagor, W. Pfaff, C. Axline, R. W. Heeres, N. Ofek, K. Sliwa, E. Holland, C. Wang, J. Blumoff, K. Chou, M. J. Hatridge, L. Frunzio, M. H. Devoret, L. Jiang, and R. J. Schoelkopf, Physical Review B 94, 014506 (2016).

[19] Supplemental Material.

[20] POGO-PIN-19.0-1 by Emulation Technology.

[21] C. Macklin, D. Hover, M. E. Schwartz, X. Zhang, W. D. Oliver, and I. Siddiqi, Science 350, 307 (2015).

[22] L. Lutterbach and L. Davidovich, Physical Review Letters 78, 2547 (1997).

[23] P. Bertet, A. Auffeves, P. Maioli, S. Osnaghi, T. Meunier, M. Brune, J. Raimond, and S. Haroche, Physical Review Letters 89, 200402 (2002).

[24] B. Vlastakis, G. Kirchmair, Z. Leghtas, S. E. Nigg, L. Frunzio, S. M. Girvin, M. Mirrahimi, M. H. Devoret, and R. J. Schoelkopf, Science 342, 607 (2013).

[25] C. W. Gardiner and M. J. Collett, Physical Review A 31, 3761 (1985).

[26] M. F. Gely and G. A. Steele, New Journal of Physics 22, 013025 (2020).

[27] J. Gambetta and H. M. Wiseman, Phys. Rev. A 64, 042105 (2001).

[28] S. Gammelmark and K. Mølmer, Physical Review A - Atomic, Molecular, and Optical Physics 87, 1 (2013).

[29] S. Gammelmark and K. Mølmer, Physical Review Letters 112, 1 (2014).

[30] C. Catana, L. Bouten, and M. Guță, Journal of Physics A: Mathematical and Theoretical 48, 365301 (2015).

[31] A. H. Kiilerich and K. Mølmer, Physical Review A 94, 032103 (2016).

[32] F. Albarelli, M. A. C. Rossi, D. Tamascelli, and M. G. Genoni, Quantum 2, 110 (2018).
[33] F. Albarelli, M. A. C. Rossi, D. Tamascelli, and M. G. Genoni, in *11th Italian Quantum Information Science conference (IQIS2018)* (MDPI, Basel Switzerland, 2019) p. 47.

[34] T. Ilias, D. Yang, S. F. Huelga, and M. B. Plenio, *PRX Quantum* **3**, 010354 (2022).

[35] E. Descamps, N. Fabre, A. Keller, and P. Milman, *arxiv:2210.05511* (2022).

[36] A. Clerk, Girvin, and A. Stone, *Physical Review B* **67**, 165324 (2003).

[37] A. A. Clerk, M. H. Devoret, S. M. Girvin, F. Marquardt, and R. J. Schoelkopf, *Reviews of Modern Physics* **82**, 1155 (2010).

[38] R. Han, G. Leuchs, and M. Grassl, *Physical Review Letters* **120**, 160501 (2018).

[39] D. Sank, Z. Chen, M. Khezri, J. Kelly, R. Barends, B. Campbell, Y. Chen, B. Chiaro, A. Dunsworth, A. Fowler, E. Jeffrey, E. Lucero, A. Megrant, J. Mutus, M. Neeley, C. Neill, P. J. O'Malley, C. Quintana, P. Roushan, A. Vainsencher, T. White, J. Wenner, A. N. Korotkov, and J. M. Martinis, *Physical Review Letters* **117**, 01 (2016).

[40] R. Lescanne, L. Verney, Q. Ficheux, M. H. Devoret, B. Huard, M. Mirrahimi, and Z. Leghtas, *Physical Review Applied* **11**, 014030 (2019).

[41] A. Petrescu, M. Malekakhlagh, and H. E. Türeci, *Physical Review B* **101** (2020), 10.1103/Phys-RevB.101.134510.

[42] R. Shillito, A. Petrescu, J. Cohen, J. Beall, M. Hauru, M. Ganahl, A. G. M. Lewis, G. Vidal, and A. Blais, *Phys. Rev. Appl.* **18**, 34031 (2022).

[43] M. Khezri, A. Opremcak, Z. Chen, K. C. Miao, M. McEwen, A. Bengtsson, T. White, O. Naaman, D. Sank, A. N. Korotkov, Y. Chen, and V. Smelyanskiy, *Physical Review Applied* **20**, 054008 (2023).

[44] M. Burgelman, P. Rouchon, A. Sarlette, and M. Mirrahimi, *Physical Review Applied* **18**, 064044 (2022).

[45] T. Thorbeck, Z. Xiao, A. Kamal, and L. C. G. Govia, *arXiv:2305.10508* (2023).

[46] A. Bengtsson, A. Opremcak, M. Khezri, D. Sank, A. Bourassa, K. J. Satzinger, S. Hong, C. Erickson, B. J. Lester, K. C. Miao, A. N. Korotkov, J. Kelly, Z. Chen, and P. V. Klimov, *arXiv:2308.02079* (2023).
# Supplementary materials: Monitoring the energy of a cavity by observing the emission of a repeatedly excited qubit

## I. DEVICE AND MEASUREMENT SETUP

### A. Device fabrication

The circuit is composed of one 3D $\lambda/4$ coaxial cavity resonator, into which two samples are inserted. The first sample comprises the monitoring transmon and its notch filter, the second contains the tomography transmon qubit with its readout resonator and Purcell filter. These samples are made of a 200 nm thick film of sputtered Tantalum on a 430 $\mu$m thick sapphire substrate (deposited by Star Cryoelectronics, Santa Fe, USA). The Josephson junctions of both transmons are standard Dolan bridge e-beam evaporated Al/AlOx/Al junctions [1].

### B. Measurement setup

The readout resonator, the tomography qubit, and the qubit are driven on resonance by pulses that are generated using an OPX from Quantum Machines®. It has a sampling rate of 1 GS/s. AWG driving pulses are modulated at a frequency 125 MHz for readout, 110 MHz for tomography qubit, 70 MHz for cavity and 68 MHz for the monitoring qubit. They are up-converted using I-Q mixers for the readout resonator, monitoring qubit and cavity, regular mixers for the tomography qubit, with continuous microwave tones produced by three channels of an AnaPico® APUASYN20-4 for the readout resonator, cavity and qubit, Agilent® E8257D for tomography qubit. The fourth channel of AnaPico® APUASYN20-4 is used for the TWPA pump. An AnaPico® APSIN12G is used to provide a strong detuned drive on the qubit in order to calibrate the reflection coefficient [2].

The two reflected signals from the readout and qubit are combined with a diplexer and then amplified with a TWPA provided by Lincoln Labs [3]. The follow-up amplification is performed by a HEMT amplifier from Low Noise Factory® at 4 K and by two room-temperature amplifiers. The two signals are down-converted using image reject mixers before digitization by the input ports of the OPX. We tune the TWPA pump frequency (6.079 GHz) and power in order to reach a total quantum efficiency of $\eta = 17 \pm 1\%$ at $\omega_q/2\pi + 10$ MHz. The efficiency was extracted from the measured mean and variance of the demodulated quadratures using the qubit as a reference for calibrating the gain of the amplification chain (see section 6 in Ref. [4]). However, we observed on posterior experiments that this efficiency can fluctuate by almost 20% between $\omega_q/2\pi$ and $\omega_q/2\pi - 9\chi$.

The frequency comb is generated by numerically computing the temporal shape corresponding to a frequency comb. The use of an I-Q mixer allows to use negative intermediate frequencies to expand the comb on both sides of the source frequency.

<table><caption>TABLE S1. Table of circuit parameters</caption><thead><tr><th colspan="4">Table of circuit parameters</th></tr><tr><th>Circuit parameter</th><th>Symbol</th><th>Hamiltonian term</th><th>Value</th></tr></thead><tbody><tr><td>Cavity frequency</td><td>$\omega_c/2\pi$</td><td>$\hbar\omega_c\hat{a}^\dagger\hat{a}$</td><td>4.573 GHz</td></tr><tr><td>Qubit frequency</td><td>$\omega_q/2\pi$</td><td>$\hbar\omega_q\hat{a}^\dagger\hat{a}^\dagger/2$</td><td>6.181 GHz</td></tr><tr><td>Tomography qubit frequency</td><td>$\omega_t/2\pi$</td><td>$\hbar\omega_t\hat{a}^\dagger\hat{a}^\dagger/2$</td><td>3.459 GHz</td></tr><tr><td>Readout frequency</td><td>$\omega_r/2\pi$</td><td>$\hbar\omega_r\hat{r}^\dagger\hat{r}$</td><td>7.875 GHz</td></tr><tr><td>Cavity-qubit cross Kerr rate</td><td>$\chi/2\pi$</td><td>$-\hbar\chi\hat{a}^\dagger\hat{a}\hat{a}^\dagger\hat{a}$</td><td>5.25 MHz</td></tr><tr><td>Cavity-tomography qubit cross-Kerr rate</td><td>$\chi_{ct}/2\pi$</td><td>$-\hbar\chi_{ct}\hat{a}^\dagger\hat{a}\hat{a}^\dagger\hat{a}^\dagger/2$</td><td>593 kHz</td></tr><tr><td>Cavity self-Kerr rate</td><td>$\chi_{cc}/2\pi$</td><td>$-\hbar\chi_{cc}\hat{a}^\dagger\hat{a}^\dagger\hat{a}^\dagger\hat{a}$</td><td>9 kHz</td></tr><tr><th>Circuit parameter</th><th>Symbol</th><th>Dissipation operator</th><th>Value</th></tr><tr><td>Qubit decay time</td><td>$T_q$</td><td>$1/T_q\mathbb{D}_{\hat{a}^-}$</td><td>22 ns</td></tr><tr><td>Cavity decay time</td><td>$T_c$</td><td>$1/T_c\mathbb{D}_{\hat{a}^-}$</td><td>200 $\mu$s</td></tr><tr><td>Tomography qubit decay time</td><td>$T_t$</td><td>$1/T_t\mathbb{D}_{\hat{a}^-\dagger}$</td><td>3.6 $\mu$s</td></tr><tr><td>Readout decay time</td><td>$T_{1,r}$</td><td>$1/T_{1,r}\mathbb{D}_{\hat{a}^-\dagger}$</td><td>415 ns</td></tr><tr><td>Cavity dephasing time</td><td>$T_{c,\phi}$</td><td>$2/T_{c,\phi}\mathbb{D}_{\hat{a}^\dagger\hat{a}^-}$</td><td>36 $\mu$s</td></tr><tr><td>Tomography qubit dephasing time</td><td>$T_{q,\phi}$</td><td>$1/2T_{q,\phi}\mathbb{D}_{\hat{a}^\dagger\hat{a}^-\dagger}$</td><td>12.3 $\mu$s</td></tr></tbody></table>
<figure><img src="image_6.png" /><figcaption>FIG. S1. Schematic of the setup. Each element has its RF source, whose color is matched. Room-temperature isolators are not represented for the sake of clarity.</figcaption></figure>

## II. SINGLE-TONE PHOTON COUNTING FOR PRE- AND POST-SELECTION

### A. Single shot measurement with a single tone

In this section, we focus on the case where the qubit is driven with a single tone to determine whether the cavity contains a certain number of photons [4, 5]. This configuration is reciprocal to the usual dispersive readout of a qubit. We introduce the reflection coefficient as the ratio $\bar{r} = \langle \hat{a}_{\text{out}} \rangle / \langle \hat{a}_{\text{in}} \rangle$ in the steady state. The denominator is calibrated by applying a strong ac Stark shift drive to the qubit (Fig. S3a), so that it is detuned far from $\omega_q$. We generalize the definition of a reflection coefficient $r$ to the case of single measurement records. Therefore, after a displacement
<figure><img src="image_7.png" /><figcaption>FIG. S2. Top panel: pictures of, from right to left, the qubit and the on-chip filter on its support, the pogo pin, and the pogo pin inserted in the tunnel in which the chip is inserted. Red arrows show the pogo pin and the contact point on the sample. Bottom panel: frequency profile of the spurline filters, from an HFSS simulation. The actual frequency of the cavity is represented in green, that of the qubit in dark red.</figcaption></figure>

of the cavity, we can build histograms of $r$ as a function of the frequency of the tone (Fig. S3b). For a given photon number, the average reflection coefficient spans a circle in the complex plane as the probe frequency is changed [1]. We introduce a phase $\varphi$ relative to the center $r_0 = 0.3 + 0 \times i$ of that circle (see Fig. S3b). We recover the usual $2\pi$ phase shift of the reflection coefficient on a harmonic oscillator in the angular distribution $P(\varphi)$. Each number of photons leads to a unique phase shift as can be observed in Fig. S3c. In particular, when we drive at $\omega_q - n\chi$, the histogram peak corresponding to Fock state $|n\rangle$ is centered on a $\pi$ phase shift. Thus, even though the histograms of various photon numbers overlap, it is possible to pre/post-select this Fock state by setting a threshold on the real value of one averaged single record. The tighter the threshold, the higher the fidelity but the smaller the selection yield as we discuss now.

## B. Pre- and post selection using the qubit

The protocol we use to pre- and post-select a given number of photons is shown in Fig. S4a. It is performed by sending a 20 $\mu$-drive at $\omega_q - n\chi$ before and after the measurement. For each pulse, we determine the associated reflection coefficient. The measurement is heralded to Fock state $|n\rangle$ if both measurements give reflection coefficients falling below threshold. The thresholds we use are shown in Fig. S5a,c as dashed red lines on the measured histograms at the post-selection step for each desired photon number $n$.

There is a trade-off between preparation fidelity by heralding and its yield. We choose a drastic pre-selection threshold on $Re(r)$ that ensures preparation fidelities of at least 97 % by the pre-selection pulse alone as shown in Fig. S4b while the selection yields (below 1 %) are reported in Table S2.
<figure><img src="image_8.png" /></figure>

FIG. S3. (a) Pulse sequence. The cavity is driven on resonance so as to excite it with large number of photons, and a series of 10 µs readout pulse (red) with amplitude Ω and detuning Δ = ω − ω$_{q}$ are applied on the qubit while the reflected signal is recorded to infer a reflection coefficient r. The same protocol is then performed while applying a strong ac Stark shift drive (gray, dashed). It detunes the qubit far from the frequencies of interest, which provides a reference signal to properly calibrate the reflection coefficient. (b) Histograms of the reflection coefficient r constructed from this procedure. We can clearly distinguish the components coming from the different number of photons. (c) Distribution of the argument ϕ of the complex number r computed from (b) as a function of the detuning Δ. χ appears as the frequency translation parameter of the resonance of the qubit.

<table><caption>TABLE S2. Yield table of the pre- and post-selection after a displacement of α ≈ 3.4 when the kick angle θ is set to 0.</caption><thead><tr><th>Fock state</th><th>Pre-selection fraction (%)</th><th>Post-selection fraction (%)</th><th>Typical number of samples 2N<sub>n</sub> after post-selection</th></tr></thead><tbody><tr><td>0</td><td>0.5</td><td>33.3</td><td>200580</td></tr><tr><td>1</td><td>0.7</td><td>26.0</td><td>157370</td></tr><tr><td>2</td><td>0.7</td><td>19.7</td><td>119370</td></tr><tr><td>3</td><td>0.6</td><td>14.1</td><td>85800</td></tr><tr><td>4</td><td>0.5</td><td>11.1</td><td>67150</td></tr><tr><td>5</td><td>0.4</td><td>7.4</td><td>44990</td></tr><tr><td>6</td><td>0.3</td><td>4.2</td><td>25650</td></tr><tr><td>7</td><td>0.2</td><td>3.2</td><td>19330</td></tr><tr><td>8</td><td>0.2</td><td>1.9</td><td>11360</td></tr><tr><td>9</td><td>0.1</td><td>0.9</td><td>5580</td></tr></tbody></table>
<figure><img src="image_9.png" /><figcaption>FIG. S4. (a) Pre- and post-selection pulse sequence. The cavity is alternatively displaced by $\pm\alpha = 3.4$ (which is believed to improve slightly the pre-selection yield without reset compared to $+\alpha$ always). A first pre-selection 20 µs pulse is then applied to the qubit. This heralding sequence (dashed box) is repeated until the measured Re($r$) gets below a threshold. A 20 µs comb pulse is then applied to the qubit. In practice, it results from the concatenation of 10 identical sequences of 2 µs. We then apply a post-selection pulse on the qubit. (b) Estimated pre-selection fidelity as a function of the Fock state. The selection yields associated to the threshold we used (red dashed lines in Fig. S5) are given in Table S2. These fidelities are determined by computing the probability to get the right number of photons after applying the threshold. For this, a prior probability distribution for the number of photons is needed, which we deduced from the yield statistics in Table S2.</figcaption></figure>

<figure><img src="image_10.png" /><figcaption>FIG. S5. (a) and (c) Histograms of the measured quadratures during the second (post-selection) pulse on the qubit for each number $n$ of photons corresponding to a driving tone and heterodyne measurement at $\omega_n$. The upper threshold on Re($r$) for the pre- and post-selection readout is materialized by the dashed red lines. (b) and (d) Reconstructed average fluorescence of the qubit for each number of photons. Note that the figure (b) is identical to Fig. 2e.</figcaption></figure>
<figure><img src="image_11.png" /><figcaption>FIG. S6. Calculated probability distributions of $P(\tilde{m}_n = x)$ as a function of $x$ when the cavity is in $|n\rangle$ for (a) $|\psi\rangle = |1\rangle$ and (b) $|\psi\rangle = (|0\rangle + |1\rangle)/\sqrt{2}$. Blue: $\eta = 1$. Orange: its Gaussian approximation with same mean and covariance matrix (on the whole complex plane $\tilde{m}_n \in \mathbb{C}$). Green: $\eta = 0.2$. Red: its Gaussian approximation. Purple: case where $|\psi\rangle = |0\rangle$.</figcaption></figure>

### III. COMPUTING THE THEORETICAL MEASUREMENT RATES

Our model for the measurement focuses on what happens after a single kick of the qubit state. Indeed, the experiment can be decomposed into a repetition of the same sequence. Every $\pi/\chi$, the qubit is prepared in a certain state $\hat{\rho}_q$ that depends on the amplitude of the comb, and decays. Since in our case, $\pi/\chi \simeq 4T_q$, we use a model where the qubit fully relaxes to its ground state between each kick. We can thus assume the kick places the qubit in a pure state $\hat{\rho}_q = |\psi\rangle\langle\psi|$ with $|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle$, where $\theta = 2\pi\Omega/2\chi$ is the kick angle (see main text).

Following section F of the supplemental material of Ref. [6], the measurement rate of the photocounting can be extracted from the mutual information between the qubit frequency and a measurement record, for the most entropic prior (all states assumed equally likely initially). We compute it in the case where the qubit can only have one out of two frequencies separated by $\chi$ corresponding to a given photon number or one more. The details of the method can be found in Ref. [7].

We model the experiment as follows. The bipartite system {cavity, qubit} starts in the initial state $\hat{\rho}(0) = \hat{\rho}_c \otimes \hat{\rho}_q$. The full Stochastic Master Equation (SME), neglecting the pure dephasing of the qubit, of the system reads

$$d\hat{\rho} = -i \left[ \omega_c \hat{a}^\dagger \hat{a} + \frac{1}{2} \omega_q \hat{\sigma}_z - \frac{1}{2} \chi \hat{a}^\dagger \hat{a} \hat{\sigma}_z, \hat{\rho} \right] dt + \left( \frac{1}{T_q} \mathbb{D}_{\hat{\sigma}_-}(\hat{\rho}) + \frac{1}{T_c} \mathbb{D}_{\hat{a}}(\hat{\rho}) \right) dt + \sqrt{\frac{\eta}{T_q}} (\hat{\sigma}_- \hat{\rho} - \text{Tr}\{\hat{\sigma}_- \hat{\rho}\} \hat{\rho}) dW + \sqrt{\frac{\eta}{T_q}} (\hat{\rho} \hat{\sigma}_+ - \text{Tr}\{\hat{\rho} \hat{\sigma}_+\} \hat{\rho}) dW^* \quad (S1)$$

where $dW$ is now a complex Wiener process such that $dW dW^* = dt$. The complex measurement record with efficiency $0 < \eta < 1$ reads

$$dy_t = \sqrt{\eta/T_q} \text{Tr}\{\hat{\rho}\hat{\sigma}_+\}dt + dW.$$

It can be proven that the information contained in the measurement record $y_t$ about the photon number in the cavity is preserved by demodulating the measurement record as follows

$$\tilde{m}_k = \frac{1}{\sqrt{T_q}} \int_0^{+\infty} e^{i(\omega_q - k\chi)t - \frac{t}{2T_q}} dy_t, \quad (S2)$$

for all possible photon numbers $k$.

We can take into account the finite efficiency $\eta$ of the detection as a beam-splitter that combines a fraction of the field emitted by the qubit with vacuum noise. Assuming the cavity is in state $|n\rangle$, the outcome $\tilde{m}_n$ is a stochastic variable that reads

$$\tilde{m}_n = \sqrt{\eta\alpha} + \sqrt{1 - \eta\gamma}, \quad (S3)$$
where $\alpha$ and $\gamma$ are stochastic variables whose probability densities are respectively given by the Husimi Q functions of the qubit state $\hat{\rho}_q$ and of the vacuum. Owing to the low measurement efficiency $\eta \approx 0.2$, the distribution function of $\tilde{m}_n$ is almost Gaussian as can be seen in Fig. S6 in the cut along the real axis. For the quantum efficiency $\eta \le 0.2$ of the experiment, we see that the two curves are very close, thus justifying the Gaussian approximation of the measurement outcomes.

The other measurement outcomes $\tilde{m}_{k \ne n}$ are obtained with a wrong demodulation frequency $\omega_q - k\chi$. However there is still a finite overlap $\frac{\Gamma_q}{\Gamma_q + i(k-n)\chi}$ between the decaying modulation functions at $n$ and $k$, where $\Gamma_q = 1/T_q$. The outcome $\tilde{m}_{k \ne n}$ can thus be written as a combination of $\tilde{m}_n$ and of a stochastic variable $\beta_k$ distributed as the Husimi Q function of the vacuum state with weights corresponding to that overlap.

$$ \tilde{m}_{k \ne n} = \frac{\Gamma_q}{\Gamma_q + i(k-n)\chi} \tilde{m}_n + \frac{i(k-n)\chi}{\Gamma_q + i(k-n)\chi} \beta_k \quad (S4) $$

Knowing that $\alpha, \beta_k, \gamma$ are independent variables, one can compute $\mathbb{P}(\vec{m}|n)$. Knowing that the repetition time is $\tau = \frac{\pi}{\chi}$, we use equation (4) in the main text to predict the measurement rates for $\eta = 0.17, 0.2$ (blue in Fig. 4a) and $\eta = 1$ (blue in Fig. 4b).

## IV. DATA PROCESSING

This section provides details on all the steps involved in the data processing used in the letter.

### A. Quantum model of the recorded voltage

The qubit couples the incoming modes $\hat{a}_{\text{in}}(t)$ to the outgoing modes $\hat{a}_{\text{out}}(t)$ following the input-output relation

$$ \hat{a}_{\text{out}}(t) = \hat{a}_{\text{in}}(t) - \sqrt{\frac{1}{T_q}} \hat{\sigma}_{-}(t). \quad (S5) $$

The outgoing modes $\hat{a}_{\text{out}}(t)$ get amplified and downconverted by a local oscillator at a frequency $\omega_{LO}/2\pi = 6.247$ GHz. The noise added by the amplifiers can be modeled as a finite temperature of input modes $\hat{b}_{\text{in}}(t)$, which are assumed to be in a Gibbs state. This model (Fig. S7) leads to the following expression for the voltage $V(t)$ that is measured by the analog-to-digital converter (ADC) at room temperature, where G encompasses the conversion factor between the $\sqrt{Hz}$ of the propagating mode amplitudes and Volts of the ADC records. $V(t)$ is the measurement outcome of the observable

$$ \hat{V}(t) = \sqrt{G} \left( \hat{a}_{\text{out}}(t) e^{-i\omega_{\text{LO}}t} + \hat{a}_{\text{out}}^{\dagger}(t) e^{i\omega_{\text{LO}}t} \right) + \sqrt{G-1} \left( \hat{b}_{\text{in}}^{\dagger}(t) e^{-i\omega_{\text{LO}}t} + \hat{b}_{\text{in}}(t) e^{i\omega_{\text{LO}}t} \right). \quad (S6) $$

### B. Data processing flow

From the measured voltages, we get several relevant quantities that are discussed in the main text. Here, we show how they are related. Each Fock state $|n\rangle$ from 0 to 9 is prepared a large number of times (see Table. S2) by pre- and post-selection, leading to as many measurement records $V_n(t)$ of the voltage $\hat{V}(t)$ over 10 slices of 2 $\mu$s.

<figure><img src="image_12.png" /><figcaption>FIG. S7. Scheme of the quantum model of the detection of the fluorescence.</figcaption></figure>
<figure><img src="image_13.png" /><figcaption>FIG. S8. Diagram of the signal processing (see text).</figcaption></figure>

For any measurement record $V(t)$, we define the measurement outcome $\vec{m}$ whose components are

$$m_j = \int_0^2 \mu s V(t) \overline{V_j}(t) dt, \qquad (S7)$$

which corresponds to $m_j(2 \mu s)$ in Eq. (3) of the main text.

For each photon number $n$, we compute the mean $\overline{V}_n(t)$ of the $V_n(t)$ whose expectation is $\langle \hat{V}(t) \rangle|_n$. We can then calculate the Gram matrix (matrix of scalar products)

$$\mathbf{G}_{nm} = (\overline{V}_n | \overline{V}_m) = \int_0^2 \mu s \overline{V}_n(t) \overline{V}_m(t) dt. \qquad (S8)$$

Since the number of samples is finite, the mean $\overline{V}_n$ is a stochastic variable. In order to avoid biasing the Gram matrix with the particular realization of $\overline{V}_n$, we compute each scalar product between averages $(\overline{V}_n|\overline{V}_m)$ by taking half the samples for the left part and the other half for the right part (see Fig. S8). We also compute the covariance matrices $\Sigma^n$ of the probability distribution of the measurement outcomes $\vec{m}^n$ obtained from $V_n(t)$ when there are $n$ photons. Its matrix elements read

$$\Sigma_{jk}^n = \mathrm{Cov}\{(V_n|\overline{V}_j), (V_n|\overline{V}_k)\} = (\overline{m}_j^n - \mathbf{G}_{jn})(\overline{m}_k^n - \mathbf{G}_{kn}). \qquad (S9)$$

As for the Gram matrix, we compute each scalar product $(V_n|\overline{V}_j)$ by taking half the samples for the left part and the other half for the right part.

As explained in Fig. S6, the distribution probability $P(\vec{m}|n)$ of $\vec{m}^n$ can be approximated by a Gaussian law for our low efficiency $\eta \approx 0.2$. Therefore, we use the experimentally determined Gram and covariance matrices to reconstruct
this law $\mathcal{N}(G_n, \Sigma^n)$. It is used in the Bayesian update of the photon number and for the computation of the measurement rate. For the estimation of $P(\tilde{m}|n)$ used in the Bayesian filter for the photon number tracking in Fig. 3, we pre- and post-selected 60600 × 10 realizations following the protocol in Fig. S4. However, since we require many drive amplitudes for Fig. 4, we selected only 6600 × 10 realizations for each amplitude in that figure. We there chose to remove the numbers 8 and 9 from the analysis as the insufficient number of samples induces very large uncertainties on the measurement rate.

### C. Reconstruction of the qubit fluorescence signal

In order to avoid being blinded by the drive, we remove the comb contribution (which is measured by driving the qubit off resonance using ac-Stark effect)

$$c(t) = \sqrt{G} \left( \langle \hat{a}_{\text{in}}(t) \rangle e^{-i\omega_{\text{LO}}t} + \langle \hat{a}_{\text{in}}^{\dagger}(t) \rangle e^{i\omega_{\text{LO}}t} \right) \qquad (\text{S10})$$

to the average measurement records $\overline{V}_n(t)$ (Fig. 2d in the main text).

Following Eqs. (S6) and (S10), we express the expectation value of $\overline{V}_n(t) - c(t)$ as

$$\overline{V}_n(t) - c(t) = -\sqrt{\frac{G}{T_q}} \left( \langle \hat{\sigma}_-(t) \rangle_{|n\rangle} e^{-i\omega_{\text{LO}}t} + \langle \hat{\sigma}_+(t) \rangle_{|n\rangle} e^{i\omega_{\text{LO}}t} \right). \qquad (\text{S11})$$

Here, $\langle \hat{\sigma}_-(t) \rangle_{|n\rangle}$ oscillates at $(\omega_q - n\chi)$, so $\langle \hat{\sigma}_-(t) \rangle_{|n\rangle} e^{-i\omega_{\text{LO}}t}$ oscillates at $-\omega_{\text{LO}} + \omega_q - n\chi = -\omega_{\text{IF}} - n\chi$. To reconstruct the fluorescence of the qubit in the frame rotating at its frequency, we bring these oscillating signals to zero frequency. This is performed using their Hilbert transform $\mathcal{H}$ to reconstruct their analytic form $-\sqrt{\frac{G}{T_q}} \langle \hat{\sigma}_-(t) \rangle_{|n\rangle} e^{-i\omega_{\text{LO}}t}$ (here with negative frequencies). This allows to perform a sideband-free numerical demodulation to recover the average coherence of the qubit. It yields

$$\overline{I}_n(t) - i\overline{Q}_n(t) = e^{i(\omega_{\text{IF}}+n\chi)t+i\phi_n} \left(\overline{V}_n(t) - c(t) - i\mathcal{H}[\overline{V}_n - c](t)\right) \qquad (\text{S12})$$

where $\phi_n$ is chosen such that the most significant quadrature, i.e the one carrying the most fluorescence, is $\overline{I}_n$. These quadratures are plotted in Fig. 2.e in the main text and Fig. S5. Note that the demodulation frequency is $(\omega_{\text{IF}}+n\chi)/2\pi$ and not $-n\chi$, which originates from the fact that the qubit is driven with a lower sideband.

### D. Relevance of the demodulation procedure

In this section, we justify how well the demodulation we perform following Eq. (3) (main text) preserves the information about the photon number that is contained in the measurement records. Indeed, using the average measurement record $\overline{V}_n(t)$ as a demodulation function does not straightforwardly appear equivalent to Eq. (S2) that states that using the demodulation function $e^{i(\omega_q - n\chi)t - \frac{t}{2T_q}}$ preserves all the information about the photon number.

Actually, the demodulation function $e^{i(\omega_q - n\chi)t - \frac{t}{2T_q}}$ is proportional to $\text{Tr}(\hat{\rho}_n(t)\hat{\sigma}_-)$, where $\hat{\rho}_n(t)$ is the solution of a simple Lindblad master equation describing the evolution of a qubit at frequency $\omega_q - n\chi$ and with a relaxation time $T_q$. Therefore a valid way to demodulate the measurement record in the experiment would be to measure the average down-converted and pre/post-selected complex amplitude $e^{-i\omega_{\text{LO}}t} \text{Tr}(\hat{\rho}_n(t)\hat{\sigma}_-)$ first, and to use it to demodulate the measurement record. Formally, it corresponds to $\overline{V}_n(t) - c(t) - i\mathcal{H}[\overline{V}_n - c](t)$ defined in Eq. (S12), where $\mathcal{H}$ is the Hilbert transform. However, using $\overline{V}_n(t)$ alone does not lead to any visible loss of information between the two methods. As a matter of fact, demodulating by $\overline{V}_n(t) - c(t) - i\mathcal{H}[\overline{V}_n - c](t)$, $\overline{V}_n(t) - c(t)$ alone or $\overline{V}_n(t)$ does gather the same amount of information, up to experimental uncertainties.

Note that this simplification is only possible thanks to the relatively low quantum efficiency $\eta$. Were the efficiency $\eta$ close to 1, we would be able to gather information in all cumulants of the probability distribution of $\tilde{m}$ as well (see Fig. S6), which would require to keep the full expression $\overline{V}_n(t) - c(t) - i\mathcal{H}[\overline{V}_n - c](t)$.
E. Measurement rate estimation

Once $\mathbf{G}$ and $\mathbf{\Sigma}$ known, the measurement rate can be computed using

$$ \tau\Gamma_m = I(n: \vec{m}) = -\int \mathbb{P}(\vec{m}) \log \mathbb{P}(\vec{m}) d\vec{m} + \sum_n \mathbb{P}_0(n) \int \mathbb{P}(\vec{m}|n) \log \mathbb{P}(\vec{m}|n) d\vec{m}, \quad (S13) $$

for any prior $\mathbb{P}_0$ for which there exists a number $q$ such that $\mathbb{P}_0(q) = \mathbb{P}_0(q+1) = 1/2$, and where $I(n: \vec{m})$ is the mutual information of $n$ and $\vec{m}$.

A subtlety arises from the fact that this expression is only valid for times $\tau$ such that $\tau\Gamma_m \ll 1$. For the largest measurement rates we obtained in the experiment, we cannot use the full integration time of 2 $\mu$s. However it is straightforward to compute what this expression gives if $\tau$ were as small as the period of the pulse train driving the qubit, which is here $\pi/\chi = \tau/21$. For this computation, we then rescale the Gram matrix into $\mathbf{G}' = \mathbf{G}/\sqrt{21}$.

Note that we chose to integrate over 2 $\mu$s because of a technical reason. It is simply the smallest multiple of the pulse train period that is also a multiple of the inverse sampling rate of the OPX instrument (1 ns).

The mutual information obtained in this way is actually biased. Indeed, even if all the $\mathbf{G}_n$ and $\mathbf{\Sigma}^n$ are equal ($I(n: \vec{m}) = 0$), their experimental value are slightly different owing to noise, thus rendering $I(n: \vec{m})$ positive. To estimate this bias, we measured $I(n: \vec{m}_0)$ for zero driving amplitude, and assumed that it should be zero exactly, neglecting the thermal emission of the qubit. We observed that $I(n: \vec{m}_0)$ scales linearly with the inverse of the number of samples. We then used the computed $I(n: \vec{m}_0)$ at zero amplitude as a calibration of the systematic errors for all the other amplitudes. For each driving amplitude, the expected positive systematic error inversely scales with the number of measured samples given in Table S2. The error bars displayed in Fig. 4 correspond to this systematic error.

F. Simulation

In order to simulate the experiment, we numerically solve the following Stochastic Master Equations (SME), for each $n$ between 0 and 7.

$$ d\hat{\rho}(t) = -\frac{i}{\hbar}[\hat{H}_n, \hat{\rho}]dt + \frac{1}{T_q}\mathbb{D}_{\hat{\sigma}_-}(\hat{\rho}(t))dt + \sqrt{\frac{\eta}{T_q}}\mathcal{H}_{\hat{\sigma}_-}(\hat{\rho}(t))dW(t), \quad (S14) $$

with

$$ \hat{H}_n = -\hbar(\omega_{IF} + n\chi)|e\rangle\langle e| \quad (S15) $$

$$ \mathbb{D}_{\hat{A}}(\hat{\rho}) = \hat{A}\hat{\rho}\hat{A}^{\dagger} - \frac{1}{2}(\hat{A}^{\dagger}\hat{A}\hat{\rho} + \hat{\rho}\hat{A}^{\dagger}\hat{A}) \quad (S16) $$

$$ \mathcal{H}_{\hat{A}}(\hat{\rho}) = \hat{\rho}\hat{A}^{\dagger} + \hat{A}\hat{\rho} - \mathrm{Tr}\{\hat{\rho}\hat{A}^{\dagger} + \hat{A}\hat{\rho}\}. \quad (S17) $$

The homodyne measurement record reads

$$ dy_t = \sqrt{\frac{\eta}{T_q}} \mathrm{Tr}(\hat{\sigma}_x \hat{\rho}(t)) dt + dW(t), \quad (S18) $$

where $dW$ is a Wiener process with zero mean and variance $dW^2 = dt$. The record models the outcome of a homodyne detection of the fluorescence of the qubit for a known number of photons $n$ in the cavity, with a quantum efficiency of $\eta$. The intermediate frequency is $\omega_{IF}/2\pi = 66$ MHz.

The orange curve of Fig. 4a results from calculating 10 000 quantum trajectories solutions of these SME for each amplitude and frequency, for $\eta = 0.17$ and 0.2 and applied the same procedure as for the experimental records for $V(t) = \sqrt{G}dy_t/dt$. The only difference is that the average signal $\bar{V}$ was directly obtained as the solution $\hat{\rho}(t)$ to the Lindblad equations, given by Eq. (S14) when $\eta = 0$, and computing $\sqrt{\frac{\eta G}{T_q}} \mathrm{Tr}(\hat{\sigma}_x \hat{\rho}(t))$.
## G. Bayesian filter for the photon number

Tracking the photon number corresponds to actuating the probability of having $n$ photons in the cavity $P_t(n)$ conditioned on the measurement record $V$ from time 0 to $t$. Given $P_{j\tau}(n)$ and the measured $\vec{m}(j\tau + \tau)$, we compute $P_{j\tau+\tau}(n)$ as follows:

* During $\Delta t = 2$ µs, apply the dissipation operator $1/T_c D_{\hat{a}}$ on the diagonal density matrix of the cavity, whose diagonal elements are the $P_{j\tau}(n)$ coefficients. We denote the resulting diagonal elements of the density matrix as $P'_{j\tau}(n)$, and use a cavity lifetime $T_c = 200$ µs,

* Actuate it with the corresponding $\vec{m}(j\tau + \tau)$ following

$$P_{j\tau+\tau}(n) = P'_{j\tau}(n)P(\vec{m}(t)|n)/Z, \qquad (S19)$$

where $Z$ is a normalization constant ensuring $\sum_n P_{j\tau+\tau}(n) = 1$.

# V. DEPHASING RATE

## A. Measuring the dephasing rate

To extract the dephasing rate of the cavity in Fig. 4b, we use the technique of Ref. [4].

Performing Wigner tomography via the tomography qubit, we extract $|\langle\hat{a}(t)\rangle|$ after preparing a coherent state $\langle\hat{a}(0)\rangle = -1.11$ in the cavity. In order to cover the full range of dephasing rates, we perform the tomography for multiples of $\pi/\chi \simeq 95$ ns (period of the comb), with an uneven spacing to cover fast and slow dynamics alike. An example of such dynamics with an exponentially decaying amplitude is shown Fig. S9a. We use an exponential fit to extract the dephasing rate $\gamma_\phi$. Note that, at small qubit driving amplitude, the decay of $|\langle\hat{a}\rangle|$ is driven by the self-Kerr effect leading to a non-exponential behavior. Fig. S9d shows the measured Wigner function without drive, 15.2 µs after the displacement.

If the measurement was QND, we could obtain the measurement induced dephasing rate by subtracting the measured dephasing rate at zero drive $1/T_{c,\phi}$ to the dephasing rate $\gamma_\phi$ at finite drive. However, as explained below, we observe a yet unexplained increase in the cavity decay rate for large qubit drive that forbids such a simple approach. We therefore proceed in two steps.

First, to obtain pure dephasing rates $\Gamma_\phi(\theta)$, we subtract the contribution related to the decay rate $\kappa$ of the cavity to the measured $\gamma$. This decay rate is determined using the tomography at various times. For each measured Wigner function $W_{\hat{\rho}(t)}(\alpha)$, we compute the mean photon number

$$\bar{n}(t) = \mathrm{Tr}\{\hat{a}^\dagger \hat{a} \hat{\rho}(t)\} \approx \sum_{k=0}^{7} k P_k(\hat{\rho}(t)), \qquad (S20)$$

where $P_k(\hat{\rho}) = \int W_{\hat{\rho}}(\alpha)W_{|k\rangle\langle k|}(\alpha)d^2\alpha$ with $W_{|k\rangle\langle k|}(\alpha)$ the Wigner map of $|k\rangle\langle k|$ (see (B4) in [4]). The resulting fitted decay rate $\kappa$ is shown in Fig. S9c as a function of the qubit kick angle $\theta$.

Second, in order to extract the measurement induced dephasing rate $\Gamma_d$ plotted in Fig. 4b, we subtract the measured pure dephasing rate without qubit driving $1/T_{c,\phi} = (36 \pm 6)$ µs$^{-1}$ to the pure dephasing rate $\Gamma_\phi(\theta)$.

For clarity, the final expression for $\Gamma_d(\theta)$ reads

$$\Gamma_d(\theta) = \gamma(\theta) - \kappa/2 - 1/T_{c,\phi}. \qquad (S21)$$

## B. Simulation of the dephasing rates

To predict the expected dephasing rate, we use the Lindblad equation of the qubit-cavity coupled system in the interaction picture

$$\frac{d\hat{\rho}(t)}{dt} = -\frac{i}{\hbar}[\hat{H}_{\mathrm{int}} + \hat{H}_{\mathrm{d}}, \hat{\rho}] + \frac{1}{T_q}D_{\hat{\sigma}_{-}}(\hat{\rho}(t)), \qquad (S22)$$

with

$$\hat{H}_{\mathrm{int}} = -\hbar \frac{\chi}{2} (1 + \hat{\sigma}_z) \hat{a}^\dagger \hat{a}, \qquad (S23)$$
<figure><img src="image_14.png" /><figcaption>FIG. S9. (a) Blue dots: measured $|\text{Tr}\{\hat{a}\hat{\rho}(t)\}|$ as a function of time for a comb amplitude leading to a qubit kick angle $\theta = \pi$. Solid orange line: fitted exponential decay at a rate $\gamma_{\phi}$. Inset: timeframes of the measured Wigner functions. (b) Blue line and dots: simulated $|\text{Tr}\{\hat{a}\hat{\rho}(t)\}|$ as a function of time for $\theta = \pi$ using Eq. (S22). Solid orange line: fitted exponential decay from which the predicted dephasing rate is extracted. Inset: timeframes of the simulated Wigner functions. A zoom on the earliest times shows the dephasing dynamics during a period of the comb drive. (c) Decay rate $\kappa$ of the cavity extracted from the decay of the mean photon number Eq. (S20). (d) Measured (left) and simulated (right) Wigner functions at time $t = 15.2 \ \mu s$ without driving the qubit. The simulation is performed using Eq. (S24) where the self-Kerr rate is $\chi_{cc}/2\pi = 10 \pm 1 \text{ kHz}$, and pure dephasing rate is $\frac{1}{T_{c,\phi}} = (36 \pm 6 \ \mu s)^{-1}$.</figcaption></figure>

and $\hat{H}_d$ defined in Eq. (1).

Here, we neglect any other dephasing source, as well as the decay rate of the cavity. We use this simulation to compute $\text{Tr}\{\hat{a}\hat{\rho}(t)\}$. Taking only one point per period of the comb. It fits well with an exponential decay (see Fig. S9b).

The dephasing rate at zero drive $1/T_{c,\phi}$ can be precisely determined by fitting the dynamics of the cavity state when starting in a coherent state. The Linblad Master equation we use takes into account the self-Kerr effect as well as pure dephasing without drive:

$$ \frac{d\hat{\rho}(t)}{dt} = -\frac{i}{\hbar}[\hat{H}_{\text{kerr}}, \hat{\rho}] + \frac{2}{T_{c,\phi}}\mathbb{D}_{\hat{a}^{\dagger}\hat{a}}(\hat{\rho}(t)), \qquad (S24) $$
where

$$ \hat{H}_{\text{kerr}} = -\hbar\chi_{\text{cc}}\hat{a}^{\dagger 2}\hat{a}^2. \qquad (\text{S25}) $$

We find that the measured evolution of the cavity state is well reproduced when $\chi_{cc}/2\pi = 10 \pm 1$ kHz and $1/T_{c,\phi} = (36 \pm 6 \mu s)^{-1}$ (see Fig. S9d).

### C. Predicted dephasing rate

We start with the same model as in Sec. III where the qubit is kicked once and has infinite time to decay. We can model the experiment as follows. Irrespective of the state of the cavity, the qubit is prepared in a state $|\psi\rangle = \cos\theta/2|0\rangle + e^{i\phi}\sin\theta/2|1\rangle$. It emits a state $|\phi\rangle_n$ in the transmission line that depends on the number of photons $n$, which we can write

$$ |\phi\rangle_n = \left( \cos(\theta/2) |1\rangle + e^{i\phi} \sin(\theta/2) \sqrt{\frac{1}{T_q}} \int_0^{+\infty} e^{-i(\omega_q - n\chi)t - \frac{t}{2T_q}} \hat{a}_{\text{out}}^{\dagger} dt \right) |\text{vac}\rangle \quad (\text{S26}) $$

where $|\text{vac}\rangle$ is the vacuum state of the outgoing transmission line. In the simple case where $n = 0$ or $n = 1$, the cavity can be treated as a qubit as in Ref. [6]. Each period $\tau = \pi/\chi$ of the train of pulses leads to a decay of the off-diagonal matrix elements of the cavity density matrix by a factor $|\langle 0|\phi|\phi\rangle_1|$. The dephasing rate $\Gamma_d$ (black solid line in Fig. 4b) is thus given by

$$ e^{-\Gamma_d \tau} = |\langle 0|\phi|\phi\rangle_1| $$

where

$$ \langle 0|\phi|\phi\rangle_1 = \cos^2(\theta/2) + \frac{\sin^2\theta/2}{1 - i\chi T_q t}. $$

## VI. DEVIATION TO QUANTUM NONDEMOLITION

In order to better characterize how the driving amplitude of the qubit affects the number of photons in the cavity (deviation to QNDness of the photon number tracking), we perform several experiments. The drive amplitude is given either as a Rabi frequency $\Omega$ for single tone driving or an angle of rotation $\theta$ during a qubit kick.

<figure><img src="image_15.png" /><figcaption>FIG. S10. Probability of measuring Re($r$) below threshold during the post-selection pulse of the sequence in Fig. S4a as a function of the qubit rotation angle $\theta$ associated to the comb. Each line corresponds to a different selected photon number $n$ from 0 (dark blue) to 9 (red). The selection thresholds are the same as in Table S2.</figcaption></figure>
<figure><img src="image_16.png" /><figcaption>FIG. S11. (a) Pulse sequence tracking the occupation of the vacuum state. (b) Pulse sequence tracking the number of photons. (c) Blue dots: probability $\overline{P_t(n=0)}$ that the cavity is in vacuum as a function of time. The measurement is obtained by single-tone readout of the number of photons after a strong ($|\alpha|^2 > 20$) displacement of the memory. The fit (orange) to Eq. (S27) gives $T_c = 230$ µs. The absence of a plateau at early times despite the large displacement could be attributed to an increasing decay rate for higher number of photons. (d) Blue dots: reconstructed average number of photons using 1100 records of the tracked photon number. Exponential fits with $T_c = 130$ µs (orange) and $T_c = 250$ µs (red) are superimposed.</figcaption></figure>

A direct signature of non-QNDness can be seen in Fig. S10. It shows the yield of the post-selection for each $n$ (each color) as a function of the rotation angle $\theta$. The yield decreases with driving amplitude, showing that driving the qubit changes the transition rates between Fock states. The variation is more pronounced for larger driving amplitudes ($\theta > \pi$). As a matter of fact, the curves for $n=1$ and $n=2$ cross, which indicates a decay rate that changes with $n$.

In Fig. S9c, we show the observed cavity decay rate $\kappa$ as a function of the angle $\theta$. It is obtained by computing the number of photons as a function of time from the Wigner tomography. A small increase of $\kappa$ seems to occur as $\theta$ grows but still an order of magnitude smaller than the measurement rate for $\theta = \pi/2$. However a sharp rise in $\kappa$ occurs for $\theta \approx 3\pi/2$.

## VII. DEPENDENCE OF THE CAVITY LIFETIME ON PHOTON NUMBER

We also performed a measurement of the average probability of having 0 photons $\overline{P_t(n=0)}$ as a function of time (Fig. S11a,c). This is obtained with a single frequency tone on the qubit at $\Omega = 5.4$ MHz after a cavity displacement. Fitting it with the decay of a coherent state

$$ \overline{P_t(n=0)} = |\langle\sqrt{n_0}e^{-t/T_c}|0\rangle|^2 = e^{-n_0 e^{-t/T_c}} \quad (S27) $$

extracts the decay time $T_c$ of one photon in the cavity.

We do not observe a plateau at initial times (small effective $n_0$ in Eq. (S27)) despite the large variation of displacement amplitudes we tested. We believe that this could be due to a nonlinear decay rate of the cavity owing the presence of the transmon and its Purcell filter.

Using the quantum trajectories obtained with the comb drive, we can also reconstruct the average number of photons as a function of time. It does not decay exponentially. This non exponential cavity decay was also observed using the tomography qubit on a different run. As a side remark, the slight increase of the estimated mean number
of photons at small times is well understood. Indeed the comb signal is only analyzed within the range from 0 to 9 photons so that a wrong prior estimates the average number of photons at 4.5 initially. As the number of photons decreases and enters the detecting window $[0, 9]$, the update tends to increase the average number of photons at short times.

[1] A. Essig, Photon counting with a multiplexed dispersive readout, Ph.D. thesis, Ecole Normale Superieure de Lyon (2021).

[2] J. Stevens, D. Szombati, M. Maffei, C. Elouard, R. Assouly, N. Cottet, R. Dassonneville, Q. Ficheux, S. Zeppetzauer, A. Bienfait, A. N. Jordan, A. Auffèves, and B. Huard, Energetics of a Single Qubit Gate, Physical Review Letters 129, 110601 (2022).

[3] C. Macklin, D. Hover, M. E. Schwartz, X. Zhang, W. D. Oliver, and I. Siddiqi, A near - quantum-limited Josephson traveling-wave parametric amplifier, Science 350, 307 (2015).

[4] A. Essig, Q. Ficheux, T. Peronnin, N. Cottet, R. Lescanne, A. Sarlette, P. Rouchon, Z. Leghtas, and B. Huard, Multiplexed Photon Number Measurement, Physical Review X 11, 031045 (2021).

[5] M. F. Gely, M. Kounalakis, C. Dickel, J. Dalle, R. Vatré, B. Baker, M. D. Jenkins, and G. A. Steele, Observation and stabilization of photonic Fock states in a hot radio-frequency resonator, Science 363, 1072 (2019).

[6] A. A. Clerk, M. H. Devoret, S. M. Girvin, F. Marquardt, and R. J. Schoelkopf, Introduction to quantum noise, measurement, and amplification, Reviews of Modern Physics 82, 1155 (2010).

[7] H. Hutin, P. Rouchon, A. Sarlette, A. Bienfait, and B. Huard, How much information about its frequency does a linear freely decaying quantum system emit?, in preparation.