{'fraction_non_alphanumeric': 0.03672967573382511, 'fraction_numerical': 0.012524973105885968, 'mean_word_length': 4.339282051282051, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Nanoscale magnetometry using a single spin system in diamond

We propose a protocol to estimate magnetic fields using a single nitrogen-vacancy (N-V) center in diamond, where the estimate precision scales inversely with time, ~1/T$, rather than the square-root of time. The method is based on converting the task of magnetometry into phase estimation, performing quantum phase estimation on a single N-V nuclear spin using either adaptive or nonadaptive feedback control, and the recently demonstrated capability to perform single-shot readout within the N-V [P. Neumann et. al., Science 329, 542 (2010)]. We present numerical simulations to show that our method provides an estimate whose precision scales close to ~1/T (T is the total estimation time), and moreover will give an unambiguous estimate of the static magnetic field experienced by the N-V. By combining this protocol with recent proposals for scanning magnetometry using an N-V, our protocol will provide a significant decrease in signal acquisition time while providing an unambiguous spatial map of the magnetic field.


I. INTRODUCTION
A highly sensitive magnetic field sensor, that can operate at room temperature and has atomic spatial resolution may revolutionize many nanotechnologies, for instance in medical and biological technologies, advanced material sciences, spintronics, and quantum computing. Toward the practical realization of such a device, nanoscale magnetometry experiments in solids have been realized using single nitrogen-vacancy (N-V) centers in diamond. 1,2 These experiments detect very weak magnetic fields, ∼ 3 nT at kilohertz frequencies, and can locate a nearby electronic spin with a spatial resolution of ∼ 5 nm by utilizing electron spin dynamics of a defect center in a diamond nano-crystal, as illustrated in Fig.  1. This defect center possesses remarkable properties for magnetic sensing: It can be individually addressed and optically polarized and measured, and it maintains spin coherence at room temperature for considerable periods of time. 3,4 However, the current magnetometry precision is limited by standard statistical fluctuations, namely the shot-noise limit. 5 In this limit the precision of the magnetic field estimate scales as δB ∼ 1/ √ T , where T is the total time needed to acquire the estimate.
This scaling is because T /τ independent measurements are made over a short time τ . This yields an uncertainty in the magnetic field of 5 δB ≈ ( /gµ B )(1/ √ τ T ). In principle, if one were to use a measurement over the entire time interval T , then one would have a measurement with uncertainty scaling as δB ∼ 1/T . This is the best precision possible for a measurement over this time interval, and is equivalent to the Heisenberg limit for phase measurement. 6 There are two problems preventing measurements with precision scaling as 1/T . The first is spin-spin relaxation; performing a single measurement beyond the dephasing time T 2 does not yield an increase in precision. The second is that performing a measurement over a longer time may result in ambiguities. That is, the magnetic field causes the spin to rotate more than once, and the number of rotations cannot be determined from the measurement. Experimental advances have increased T 2 , and there are proposals to extend T 2 to the order of a second. 7 In this work, we address the second problem, and present a method to achieve Heisenberg-like scaling of the precision for measurement times smaller than T 2 while eliminating any ambiguities in the estimation. This will allow faster acquisition of a magnetic field map for a preset precision. In summary, we adapt a more generalized quantum phase estimation algorithm (gQPEA), 8 to instead estimate the phase generated by an unknown Z−rotation of the Bloch sphere of a qubit (atomic two level system), via Ramsey interferometry. The gQPEA phase estimation algorithm was initially developed using the framework of optical interferometry to estimate an unknown phase acquired when a photon passes through a static phase shifter, and it has been experimentally demonstrated using linear optical methods. 8,9 The protocol can make use of either adaptive 8,10 or nonadaptive 6,9 controls to yield unambiguous estimates of the phase with a precision which scales inversely with the overall measurement time, i.e., Heisenberg-like scaling. Our protocol makes use of single-shot measurements (SSM) of the spin of the atomic system, and we generalize to the case when the visibility of such measurements may be significantly below 100%.
We numerically simulate our magnetometry protocols under both ideal and realistic measurement conditions, taking into account atomic decay and dephasing. In the ideal case, when we have perfect SSM visibility, we predict that the precision of the magnetic field estimate has better scaling than the shot-noise limit; i.e., the precision scales as δB ∼ 1/T β , 1/2 < β < 1. We describe this type of scaling as sub-shot-noise scaling. Furthermore, we analyze the performance of these protocols when the SSM visibility can be quite low, and surprisingly find that sub-shot-noise scaling in the estimate precision is still possible.
We begin by reviewing Ramsey interferometry in a two-level system to estimate an unknown phase rotation. Section III adapts the gQPEA to atomic systems to operate within the Ramsey interferometry cycle. Section IV presents the results of numerical simulations for the adaptive and nonadaptive protocols with varying singleshot measurement visibilities.
We surprisingly discover that, for reduced SSM visibility, the nonadaptive method performs better than the adaptive method. Furthermore, we find that the nonadaptive method can achieve a scaling close to δB ∼ 1/T even when the SMM visibility is substantially reduced. Hence, we focus our attention on optimizing the nonadaptive protocol to work as efficiently as possible in experimentally realistic conditions where one may not have perfect single-shot measurement capability. We finally discuss our conclusions and possible future directions.

II. SPIN INTERFEROMETRY
Before reviewing Ramsey spin interferometry, we clarify some important definitions used throughout our paper. The resource required to obtain an estimate of the magnetic field to a preset precision is essentially the total interaction time between the atomic probe and the unknown magnetic field. We denote this total interaction time by T . For shot-noise scaling the uncertainty of the estimate scales as ∼ 1/ √ T , sub-shot-noise scaling is ∼ 1/T β for 1/2 < β < 1, and Heisenberg-like scaling is 1/T .
We now consider a two-level spin system which experiences a static unknown magnetic field B z . Through a pulse sequence, which is analogous to Ramsey atomic interferometry, we can convert the problem of estimating this unknown magnetic field strength into the problem of estimating the unknown phase φ ∝ λ g B z t acquired by the spin during a time t, where λ g is the gyromagnetic ratio of the spin, and t is predetermined accruing time between the spin and the magnetic field. Our protocol will estimate the value of the accrued phase φ.
We will choose the two interferometric basis states {|0 , |1 }, whose superpositions will precess in the magnetic field, to be the two nuclear hyperfine states |m s = 0, m I = ±1/2 , as shown by the green transition in Fig.  1(e). We choose these for two reasons: First, as recently demonstrated, 13 one can perform single-shot measurements of the nuclear spin state associated with these basis states, and second, these nuclear spin states possess very long coherence times. The hyperfine splitting between the two states |m s = 0, m I = ±1/2 , arises from the coupling between the electron spin of the 15 N-V center (S = 1) in its ground state, and the 15 N nuclear spin (I = 1/2). However, another choice might be to choose the shorter lived electronic spin states {|m s = 0 , |m s = ±1 } of the N-V center, 14 as depicted by the blue transitions in Fig. 1(c).
Our protocol requires one to perform many single-shot Structure of the center, consisting of a substitutional nitrogen impurity N (blue point) adjacent to a carbon vacancy V (white point), tetrahedrally coordinated to each other and three nearby carbon atoms C (red points). 11 The impurity can be a 14 N(I = 1) or 15 N(I = 1/2) atom. (c) Electron spin levels of the center. The ground state 3 A is a triplet (S = 1) with a 2.88 GHz zero-field splitting between ms = 0 and ms = ±1. Standard Ramsey interferometry performed in the electron spin is the basis for the operation of many magnetometry protocols. 1,2,5 (d) Hyperfine level splitting due to a coupling to the 15 N nuclear spin 12 in the absence of nuclear Zeeman effect. (e) Degeneracy (ms = 0, mI = ±1/2) can be lifted to allow optically detected nuclear spin resonance. Red, blue, and green arrows represent optical, microwave, and radio-frequency transitions, respectively. The qubit proposed to probe the weak magnetic field is the 'green' transition.
Ramsey measurements using a range of time durations. We summarize each sequence as follows: The spin is initialized to a state |0 ≡ |m s = 0, m I = −1/2 , which can be pictured as a vector along the +Z direction in the Bloch sphere. This initialization can be carried out in the N-V system by optical cycling, near resonance on the optical transition 3 A − 3 E. We then apply a π/2pulse on resonance with the |0 − |1 transition, and this produces a pure superposition state, written in density matrix form as That is, the initial vector is rotated to the equator of the Bloch sphere, and that rotation is assumed to be implemented in a very short time. This rotation can be realized by applying a radio-frequency field if we use the nuclear spin to encode the interferometric basis states, or by using a microwave field in the case of electronic spin states. The spin system then undergoes free precession due to the effect of the unknown external static magnetic field B z . For some predetermined period of time t, the spin system accrues a relative dynamical phase φ, proportional to the magnetic field strength, and rotates the Bloch vector around the Z axis in the X − Y plane. During this precession we have the Hamiltonian H f = λ g B zσz , and including decay and dephasing, we can describe the evolution via a master equation in the Lindblad form 15 , asρ where We denote the decay time as T 1 . Setting ρ(t = 0) = ρ 0 , and = 1 for simplicity, we obtain a solution to (2) as where Λ = 2iλ g B z − 1/T 2 . We then apply another π/2pulse (π/2 rotation around the X axis), mapping the phase information into population information. We then perform a single-shot measurement of the population to get a single detection result. For clarity we call such a single-shot measurement a 'click', in contrast to the overall measurement of magnetic field, which includes many of these individual 'clicks'. The probability of measuring the system in the state |0 or |1 (+1 or -1 click along the Z axis), conditioned on the unknown field B z , is For a small predetermined accruing time t = τ , where τ ≪ T 2 , and repeating the standard prepare-evolvemeasure procedure M times, the total amount of time resource expended is T = M τ . This naive procedure provides a standard deviation of the estimate that scales as 5 δB z ∼ 1/ √ T . This is the shot-noise limit for measurement precision. In what follows, we will show that by adapting the gQPEA protocol, 8,9 which involves acquisition of 'clicks' over varying time durations, we can obtain an unambiguous magnetic field estimate with precision that scales better than the shot-noise limit.

III. ESTIMATION METHOD
To provide clear insight into the estimation method, we recast (4) into where the system phase φ = 2λ g B z t, is the unknown and constant real quantity we would like to estimate. The obtained estimate itself, after the estimation procedures, is denoted byφ to differentiate it from the actual underlying system phase. Following Ref. 6 , we expand the probability distribution for the system phase after the m-th single-shot measurement as and can compute the expectation value for exp(iφ) after the m-th click as e iφ m = P m (φ)e iφ dφ.
If there is no initial knowledge about the phase, the initial probability distribution P m=0 (φ) is flat. After the first detection, m = 1, we have one bit of information about the system phase that can be used to calculate the three nonzero coefficients b j={0,±1},m=1 . After m detections are made, a vector of detection results u m = {u 1 , u 2 , . . . , u m } is obtained, where each u i (i = 1, . . . , m) = ±1. Using Bayes' rule, the conditional probability distribution for the system phase given the next detection result is with P (φ| u m ) ≡ P m (φ). It gives an update formula for the unnormalized coefficients of the probability distribu- where the normalized coefficient is b j,m+1 = b j,m+1 /2πb 0,m .
The estimate of the system phaseφ after a total of m = M detections is then obtained by taking the argument of the expectation value of e iφ , φ = arg e iφ M = arg P (φ| u m=M ) e iφ dφ = arg (b −1,M ) .
Averaging over a number of trials (or samples) S, we obtain an estimate of the Holevo variance V H 16 , corresponding to the square of the uncertainty in the phase estimate, as The case when δB ∼ 1/ √ T , (usual shot-noise limit) can be recast as V H T ∼ C (a constant), while the limit where δB ∼ 1/T can be recast as V H T ∼ 1/T . Below we will identify sub-shot-noise scaling where V H T ∼ 1/T β , 1 > β > 0.
Rather than using standard Ramsey interferometry for phase estimation we make use of another protocol, originally devised in an optical setting, which uses multiple accumulations of the unknown phase to achieve near Heisenberg scaling of the uncertainty in the phase estimate. 6,8,9 The multiple accumulations correspond to a prolonged accruing time, which provides more information about the phase.
Applying this multi-accumulation concept to our problem, we modify the expression of (4) by replacing t = τ with t = τ k ≡ 2 k τ : where now φ = 2λ g B z τ . Prolonging the accruing time increases the rotations of the state vector in the X−Y plane and consequently introduces a modulo 2π ambiguity into the estimate. We eliminate this ambiguity through adjustment of the parameter k, and the application of an additional effective phase shift Φ to the system. This can be achieved via the active application of an external magnetic field or passively, through simply performing the second Ramsey π/2 rotation about a rotated axis on the X − Y plane of the Bloch sphere instead of the X−axis. This additional phase shift can be chosen adaptively (as feedback) or nonadaptively (as a predetermined phase increment), such that where V (τ k ) = exp −2 k τ /T 2 is the estimation visibility. Given a conditional detection probability we can determine the Fisher information, 17 where ξ is a click measurement result. The Fisher information F φ essentially represents the amount of information about φ contained in the measurement results ξ. Maximal information about the system phase can be extracted when we choose values of k that maximize (13), for a fixed ratio of τ /T 2 . Further investigation of (13) allows one to show that no useful information regarding the system phase can be inferred when T = 2 k τ ≫ T 2 . This is numerically confirmed by our simulations as presented below. The overall measurement time can be greater than T 2 , but the uncertainty scales as 1/ √ T for T > T 2 . Beyond T 2 we can only hope to achieve an uncertainty which scales, at best, like the shot-noise limit.
In the following, we first describe a protocol for subshot-noise magnetometry which uses adaptive feedback, where the value of the control phase Φ in (12) is determined based on previous detection results. Following this we describe a method which is perhaps more suitable for experiments, where the control phase Φ is regularly incremented without any dependence on the previous detection results.

A. Adaptive scheme
For the adaptive control scheme, the control phase Φ in (12) is updated after each detection based on the previous detection results. Ideally, this control phase is altered in such a way so as to minimize the variance of the final phase estimate. However, there is no known method to determine such a phase analytically, and numerical methods are computationally intensive. Instead, we use an adaptive update scheme 18 to minimize the variance of the phase estimate after the next detection, based on the information obtained from the previous detections.
In order to minimize the variance after the next detection, one must maximize the quantity M 18 , The adaptive control phase that maximizes M is one of 18 where and a, b, and c are functions of the b j,m−1 expansion coefficients for the probability distribution, . Finally, we arrive at the update formula for b j,m → b j,m+1 , based on the acquisition of the (m + 1)-th click measurement u m+1 , and using (12) and the control phase Φ 0,± that maximizes M, to obtaiñ For clarity, we enumerate the individual steps in the estimation procedure using the adaptive control phase as follows: 1. All parameters are set: the fundamental accruing time τ , the maximum number of multiaccumulations 2 K , the maximum number of detections M , the number of trials S, and the dephasing time T 2 .
2. For the s-th trial, the protocol starts using the initial k = K and the initial additional phase Φ.
3. The spin state is initialized to |0 .
4. The π/2-rotation around the X-axis is applied by the external pulse (on-resonance with the |0 − |1 transition) to create the coherent superposition state.
5. The Bloch vector undergoes free evolution in the X − Y plane for τ k = 2 k τ , due to the non-varying unknown magnetic field and the additional phase Φ.
6. Another π/2-rotation around the X-axis is applied to transform the phase information into the spin population. Instead of the active application of the phase shift Φ in step 5, one can simply rotate the axis of this second Ramsey rotation.

7.
A single-shot measurement is performed to provide the result ξ = ±1.
8. The phase estimateφ is inferred and the additional phase Φ is updated based on the measurement result u m . To complete a single trial (steps 1-9), the protocol requires a total time resource T af = M × (2 K+1 − 1)τ . Below we will use T 2 /τ = 10 3 , and taking 2 T 2 ∼ 2 ms, we have a fundamental accruing time of τ = 2 µs. For simplicity, we will from now on make reference to dimensionless time quantities, which have been rescaled by the fundamental accruing time asT ≡ T /τ , such that

B. Non-adaptive scheme
Updating the control phase Φ without any dependence on the previous detection results requires that number of detections vary as a function of k. 9 From Ref. 9 , we choose a simple linear function for the number of detections, where M K is an initial number of detections at k = K, and F is a positive integer. The number of detections increases as k is decreased. Hence, the total time resource required to complete the protocol with the nonadaptive scheme is We determine the control phase Φ at the m-th click measurement as and use the same updating formula for the b's as (17). Furthermore, the individual steps of this scheme are similar to those of the adaptive one, except for the following steps: 2. For the s-th trial, the protocol starts using the initial values of k = K, M K , and Φ.
8. The phase estimateφ is inferred and the control phase Φ is updated following (21).

Steps 3-8 are repeated for
In contrast to the adaptive scheme, where one has to run the protocol from the maximum k = K to the lowest k = 0, the nonadaptive scheme can be operated without adhering to the order. This flexibility could possibly simplify an experimental realization.

IV. SIMULATION
We numerically simulated the above protocol for the adaptive scheme, in the case of perfect SSM visibility, by setting the number of trials S = 1000 and the number of single-shot measurements M = 6. The simulations were performed for values of K from 1 to 20. Meanwhile, the ratio of dephasing time to τ is chosen to be T 2 /τ = 10 3 . A random phase guess is used as a prior estimate to initiate the protocol. The simulation result is presented in Fig. 2, where we plot the simulated quantity V HTaf againstT af on logarithmic scales. As can be seen from Fig. 2, the precision of the simulated phase estimate has Heisenberg-like scaling forT af ≤ 10 3 . If one proceeds with the estimation protocol forT af ≥ 10 3 , the precision will be worse than the shot-noise scaling (not shown in the figure). Therefore, to maintain the shot-noise scaling forT af ≥ 10 3 , one needs to stop the protocol at a certain value of K that gives T ≈ T 2 , and subsequently increase M only. It is important to note that for these measurements, no prior knowledge of the actual phase is needed.
To consider a more realistic condition where a perfect single-shot measurement is unattainable, we quantify the imperfection both by a detection contrast and a detection visibility. The detection contrast of SSM is quantified by two parameters: a maximum and a minimum of the detection probability to find the spin state in an eigenstate of the detection basis. Here, we denote such maximum and minimum probability to get the +1 click by f a and f i . Using these parameters, we straightforwardly generalize (12) into where Y = V (τ k ) cos(2 k φ − Φ), giving the updating formula for the probability distribution coefficients as For the more symmetric case where f a + f i = 1, we set f a − f i = f d , and simplify (22) such that giving the updating formulã The detection visibility is included in our simulations to compare the robustness of both adaptive and nonadaptive schemes against the SSM imperfection. We first choose parameters to optimize the nonadaptive protocol for a given detection visibility (i.e. the symmetric case where f a + f i = 1). In the next subsection, we optimize the nonadaptive protocol to improve its robustness for imperfect detection contrast (the nonsymmetric case).
Using (24) and (25), simulations were performed for a range of nonunit detection visibilities. As shown in   3, it was found that the nonadaptive scheme is more robust against imperfect detection visibility. The results for the nonadaptive method with a range of visibilities are presented in Fig. 4, indicating that a detection visibility of at least 90% is required by the nonadaptive scheme to obtain Heisenberg-like scaling. While performing the simulations to obtain both Figs. 3 and 4, we did not limit the value of K, in order to show that the variance has worse scaling than the shot-noise limit forT af,na >T 2 .
Optimized protocol with nonadaptive scheme The nonadaptive protocol can be optimized to work with nonideal detection contrast. We optimize the protocol by numerical simulations based on (22) and (23) to find realizable combinations of the number of detections M , and the multiplier F to maintain the sub-shot-noise scaling. This is useful to provide some optimized param-eters for a possible experiment where the measurement efficiency is often not symmetric, as quantified by the detection contrast {f a , f i }.
We present the simulation results in Fig. 5, where the protocol is optimized for some values of M K = {8, 12, 16} and F = {8, 12}, at a range of visibility parameters f a = {0.55, 0.65, 0.75, 0.85}, where f i = 0.05 is fixed.
From the figure, the overall results show the very surprising ability of the nonadaptive protocol to demonstrate near Heisenberg-like scaling (δB ∼ 1/T ), even at low detection contrasts (f a = 0.55). For low values of (M K , F ), the method exhibits a scaling which is worse than or comparable to the shot-noise limit. However, as these parameters are increased (M K , F = 8 → 12), the method exhibits a significant improvement and moves toward ∼ 1/T scaling. In addition, this behavior occurs for a very large range of detection contrasts (f a > 0.55), and thus could be of great use to many other physical models besides the case of magnetometry here, where one does not have perfect single-shot readout.

V. CONCLUSION
We have shown that unambiguous magnetic field strength estimation with sub-shot-noise scaling can be achieved by performing a time-varying sequence of measurements of the nuclear spin in a single N-V, using either adaptive or nonadaptive phase shifting of the system phase throughout the sequence. By numerically simulating the protocol for both ideal and imperfect single-shot measurement conditions, we found the surprising result that the nonadaptive protocol, which is assumed to be far easier to realize experimentally, provides an estimate whose precision scales better than the adaptive protocol. Another remarkable feature of our proposed method is that by sampling the phase accumulation at varying times the protocol yields an unambiguous estimate of the magnetic field. This means that one can determine an absolute estimate of the local magnetic field strength, even though the field may cause many Larmor rotations of the spin. The sub-shot-noise scaling of the estimate precision is only bounded below by the Heisenberg scaling (δB ∼ 1/T ), and the unavoidable dephasing of the spin.
Recent experimental progress on coherent manipulations of the nuclear spin in the nitrogen-vacancy system in diamond allows one to perform SSM on the nuclear spin, 13 and this may soon lead to experimental demonstrations of our protocol with subsequent benefits for large scale nanomagnetic imaging. For the same total imaging time, the precision of our proposed estimation technique scales better than that of the standard estimation method. Moreover, our proposal is applicable to any other atomic-like physical systems, such as an electron spin in silicon (SSM in that system has recently been reported 19 ), atomic vapors, or Bose-Einstein condensates.