## 4 Stray Fields Compensation  
In cold-atom experiments, bipolar current sources are frequently used to cancel stray magnetic fields inside the experimental chamber and to define a quantization axis. Here, we demonstrate the functionality of the designed power supply by minimizing the total magnetic field present at the location of trapped atoms without actually measuring the net field. The quality of the stray fields cancellation is assessed based on the measurement of \({}^{39}\)K temperature reached after a period of gray molasses cooling on the D1-line as a function of the applied magnetic field vector \(\vec{B}\). Among alkali atoms, \({}^{67}\)Li and \({}^{39,41}\)K have such a small \(P_{3/2}\) state hyperfine splitting that sub-Doppler cooling on the D2-line is limited. Using the D1-line instead, which has a better resolved \(P_{1/2}\) state hyperfine levels, has proven to be an efficient method of reaching lower temperatures. This comes at a price of using an additional laser setup operating on the D1 line, but the gain in phase space density over a standard D2-line magneto-optical trap is crucial for many experiments requiring large samples of degenerate quantum gases [24; 25; 26]. The combination of Sisyphus cooling and velocity-selective coherent population trapping present in D1-line gray molasses makes it possible to cool atoms well below 1/10 of the Doppler limit. The molasses are composed of two frequencies, each blue-detuned from either the \({}^{39}\)K D1 cooling transition \(|F=2\rangle\rightarrow|F^{\prime}=2\rangle\) or the repumping transition \(|F=1\rangle\rightarrow|F^{\prime}=2\rangle\). When the detunings of the two lasers are such that their energy difference equals the energy difference between the ground state hyperfine levels \(|F=1\rangle\) and \(|F=2\rangle\), the Raman condition is fulfilled, and a set of long-lived dressed dark states (superposition of only the ground state hyperfine levels) is generated. They are accompanied by bright states that contain the \(P_{1/2}\) component. Both the dark and the bright states vary throughout real space due to the presence of polarization gradients created by laser beams. The atoms that are initially in bright states lose their kinetic energy by climbing the potential hill before being pumped back into dark states, whereas the atoms in dark states that are not sufficiently cold turn into bright states and re-enter the cooling cycle. This procedure terminates when atoms in dark states have a sufficiently long lifetime, leading to a narrow peak in the momentum distribution. The influence of stray magnetic fields on sub-Doppler cooling of alkali atoms with gray molasses on the D1 or the D2 line has never been thoroughly studied experimentally, only briefly discussed in several articles [17; 18; 19; 20; 21]. In these articles, similar conclusions have been reached--the lowest temperature can be achieved when the net magnetic field at the location of atoms is near 0 G. This helps to avoid mixing of the ground-state magnetic sub-levels, which can destroy the dark state responsible for cooling. Our method is based on the observation that to a certain degree, sub-Doppler cooling in gray molasses takes place even for typical values of laboratory stray fields, which are usually below 1 G and come primarily from the Earth's magnetic field. Thus, once the sub-Doppler cooling is observed, the temperature of the cloud (or its width after ballistic expansion) can be used to minimized stray fields. For all practical purposes, the \"zero field\" determined this way is sufficient to enable state-of-the-art sub-Doppler cooling: without any additional magnetic field calibration, we reach \({}^{39}\)K temperature of \(\sim\)8 \(\mu\)K, which compares well with 6 \(\mu\)K reached by [PERSON] et al. [19] and 12 \(\mu\)K by [PERSON] et al. [22]. We use three pairs of rectangular compensation coils in a near-Helmholtz configuration to generate a uniform magnetic field at the location of atoms.