Trapezoid Integration
Trapezoid Integration#
mrfmsim_marohn.formula.field.xtrapz_field_gradient()
For each x-data point in the sample, calculate the resonance offset over the expanded grid. The points to the left and right of each grid point give the resonance offset as the cantilever moves. Find the minimum resonance offset over the range of array values corresponding to the cantilever motion, and compute the saturation polarization using that minimum offset and the given B_1.
To calculate the spin polarization profile resulting from the cantilever moving while spin-saturating irradiation is applied we use the following algorithm:
If the resonance offset changed sign during the sweep, then the spin must have experienced a zero resonance offset during the sweep, so set the resonance offset to zero manually.
This procedure mitigates the problem of previous algorithms not finding the true minimum resonance offset (and polarization) due to the finite grid size. While this new procedure will still not capture the shape of the polarization at the edge of the sensitive slice, it should produce a polarization which is properly saturated inside the sensitive slice.
This is used for calculating \(\delta F\) of the experiment calculate the corresponding gradient based on the grid array points and tip-sample separation (equation 3 in “Overview”). The integral is approximated with Trapezoid summation over \(2 \pi\) with n points. The summation is over pi to increase the performance since it is symmetry in [-pi, 0] to [0, pi] for the summation.