exa.core.util.phase_helper.get_phase_fitter#
- get_phase_fitter(n_phases)#
Generates a fitter function for cosine oscillation with frequency 1, used to determine the phase of the data.
The fitter uses
numpy.linalg.lstsq()to calculate the phase of the cosine oscillation. Its behaviour depends on the number of phases in the phase sweep. With 2 phases, the fitter will calculate the amplitude and phase corresponding to the model: \(y(x) = A * \cos(x+phi) + 0.5\) where \(A>0\) is amplitude, \(phi>0\) is phase. Thus, this should only be used if excited state probability is calibrated correctly, and thus the model’s assumption is satisfied. With 3 phases or more, the fitter will do a least-squares fit to the model \(y(x) = A * \cos(x+phi) + B\), where \(B\) is offset. This three-parameter model cannot be used if there are only 2 phases, and if there are exactly 3, it is fully determined, so the resulting fit will be equal to the provided data.