  We experimentally demonstrate a recently proposed single-junction
quantum-circuit refrigerator (QCR) as an in-situ-tunable low-temperature
environment for a superconducting 4.7-GHz resonator. With the help of a
transmon qubit, we measure the populations of the different resonator Fock
states, thus providing reliable access to the temperature of the engineered
electromagnetic environment and its effect on the resonator. We demonstrate
coherent and thermal resonator states and that the on-demand dissipation
provided by the QCR can drive these to a small fraction of a photon on average,
even if starting above 1 K. We observe that the QCR can be operated either with
a dc bias voltage or a gigahertz rf drive, or a combination of these. The
bandwidth of the rf drive is not limited by the circuit itself and
consequently, we show that 2.9-GHz continuous and 10-ns-pulsed drives lead to
identical desired refrigeration of the resonator. These observations answer to
the shortcomings of previous works where the Fock states were not resolvable
and the QCR exhibited slow charging dynamics. Thus this work introduces a
versatile tool to study open quantum systems, quantum thermodynamics, and to
quickly reset superconducting qubits.
