  Optically detected magnetic resonance (ODMR) has become a well-established
and powerful technique for measuring the spin state of solid-state quantum
emitters, at room temperature. Relying on spin-dependent recombination
processes involving the emitters ground, excited and metastable states, ODMR is
enabling spin-based quantum sensing of nanoscale electric and magnetic fields,
temperature, strain and pressure, as well as imaging of individual electron and
nuclear spins. Central to many of these sensing applications is the ability to
reliably analyze ODMR data, as the resonance frequencies in these spectra map
directly onto target physical quantities acting on the spin sensor. However,
this can be onerous, as relatively long integration times -- from milliseconds
up to tens of seconds -- are often needed to reach a signal-to-noise level
suitable to determine said resonances using traditional fitting methods. Here,
we present an algorithm based on data clustering that overcome this limitation
and allows determining the resonance frequencies of ODMR spectra with better
accuracy (~1.3x factor), higher resolution (~4.7x factor) and/or overall fewer
data points (~5x factor) than standard approaches based on statistical
inference. The proposed clustering algorithm (CA) is thus a powerful tool for
many ODMR-based quantum sensing applications, especially when dealing with
noisy and scarce data sets.
