A Two-stage Optimization Method for Wide-range Single-electron Quantum Magnetic Sensing