|
Definitions
Corrected count rates per bin are {$g_i = g_{ri} -B_g$} where {$g_{ri}$} are unbinned raw counts in bin {$i$} summed over forward {$g=f$} or backward {$g=b$} groups of detectors. The background count rates {$B_g=\sum_j^M g_{rj}/M$} are their average raw counts per bin in a suitable range before the prompt.
Due to Poisson statistics and uncorrelated errorpropagation {$\sigma^2_{Bg}= B_g$}, {$\sigma^2_{gri} = g_{ri}$}, hence {$\sigma^{2}_{gi} = g_{ri} + B_g = g_i + 2B_g$}.
Thus mujpy stores corrected counts {$g_i$} and their standard deviations {$\sigma_{gi}$} for all groups. Musrfit calculates the same values.
The unbinned asymmetry and its standard deviation by error propagation, are taken to be
{$$
\begin{equation}
A_i(\alpha) = \frac {f_i -\alpha b_i}{f_i +\alpha b_i} \qquad \sigma_{Ai} = \frac 2 {(f_i+\alpha b_i)^2} \sqrt{\sigma^2_{bi}f_i^2 + \sigma^2_{fi}b_i^2}
\tag{0}
\end{equation}
$$}
In its {$\beta=1$} standard version musrfit does the same with uncorrected experimental asymmetries {$A_i(1)$}.
Rebinning data
One way of rebinning data by a packing factor {$M$} (followed by musrfit) is to calculate the average of the asymmetry over the packed bins, i.e.
- first calculate Eq. 0
- then rebin it (divide by {$M$} the sum over {$M$} adjacent bins) and calculate the corresponding error
{$$
\begin{equation}
A_k(\alpha) = \frac 1 M \sum_{i=kM}^{k(M+1)-1}\frac{f_i -\alpha b_i}{f_i +\alpha b_i} \qquad \sigma_{Ak} = \frac 1 M \sqrt{\sum_{i=kM}^{k(M+1)-1}\sigma^2_{Ai}}
\tag{1}
\end{equation}
$$}
In short, by error propagation, take the average asymmetry and its average variance. This corresponds to mujpy rebin when applied to asymmetry and its standard deviation
What about the other alternatives, (2) calculate asymmetry from average counts, or calculate asymmetry from packed counts, not average, as from a lower resolution experiment
which are shown to be the same (since asymmetry is a ratio, the division by {$M$} simplifies out as shown in Mujpy.MujpyVsMusrfitChiSquare#errors).
Average counts and their variances are
{$$
\begin{equation}
\overline g_k = \frac 1 M \sum_{i=kM}^{k(M+1)-1} g_i = \frac {g_k} M \qquad \overline \sigma^2_{gk} = \frac 1 {M^2} \sum_{i=kM}^{k(M+1)-1} \sigma^2_{gi} = \frac {\sigma^2_{gk}}M
\tag{2.0}
\end{equation}
$$}
Then Eq. 0 leads to
{$$
\begin{align}
A_k(\alpha) &= \frac {\sum_{i=kM}^{k(M+1)-1} f_i -\alpha \sum_{i=kM}^{k(M+1)-1}b_i}{\sum_{i=kM}^{k(M+1)-1}f_i +\alpha \sum_{i=kM}^{k(M+1)-1}b_i} \cr
\sigma_{Ak} &= \frac {2M^2} {(\sum_{i=kM}^{k(M+1)-1}f_i+\alpha\sum_{i=kM}^{k(M+1)-1} b_i)^2} \sqrt{\frac 1 {M^2} \sum_{i=kM}^{k(M+1)-1} \sigma^2_{bi}\frac 1 {M^2} (\sum_{i=kM}^{k(M+1)-1}f_i)^2 + \frac 1 {M^2} \sum_{i=kM}^{k(M+1)-1}\sigma^2_{fi}\frac 1 {M^2} (\sum_{i=kM}^{k(M+1)-1}b_i)^2}
\tag{2.1}
\end{align}
$$}
which simplifies to
{$$
\begin{align}
A_k(\alpha) &= \frac {f_k -\alpha b_k}{f_k +\alpha b_k} \cr
\sigma_{Ak} &= \frac 2 {(f_k+\alpha b_k)^2} \sqrt{\sigma^2_{bk} (f_k)^2 + \sigma^2_{fk} (b_k)^2}
\tag{2.2}
\end{align}
$$}
which is the same as Eq. 0, indifferently with averages or plain sums and their variances.
Tentative conclusions
Eq. 1 and Eq. 2.1-2 are clearly different. Is one definition better than the other? Difficult to say, since that of Eq. 2.2 corresponds exactly to that of Eq. 0. If Eq. 1 is better then Eq. 0 itself is somehow an approximation (it surely is) but also Eq. 1 is based on Eq. 0. The (unavoidable) approximation is taking integral counts over a finite interval as count rates.
TF EMU experimental data (no background subtraction, A~0.23), shows a coherently oscillating difference between the two for binning=10, with the same TF frequency, with amplitude 0.002 of the maximum asymmetry peaking at the TF oscillation zero crossings. The two standard deviations are also clearly not equal, but very much less so. Their maximum difference is 2 part per million of the asymmetry. Both have to do with different average induced shifts.
Also mujpy does it the musrfit way
Previous way, rebin after asymmetry. The definition was implemented in mumudel._rebin_ (for mufit) and mumodel._rebin_plot_ (for mufitplot). As of version v3.1.2-30-g3a3f7e8 calib mode used tools.rebin on counts, then calculates asymmetry, e.g. Eq. 2.2, whereas non calib uses tools.rebin on asymmetry e.g. Eq. 1.
Mujpy must have the same definition for calib and non calib fits.
From the 3.1.2-31 rebin always takes place on asymmetry. And unbinned errors are {$\sqrt{g_{ri} + B_g}$} as per the definitions above Eq. 0.
mufit performed
mumodel._load_
mumodel._rebin_
- Must be converted into
mumodel._load_ does all, needs also args tup, alpha.
mufit
- methods in
suite
- gets
yf, yb, eyf, eyb, string = suite.single_for_back_counts(kr,kg) (also subtracts background-> written in string)
yf,yb,eyf,eyb, string = suite.slice_for_back_counts(kr,kg,tup) with kr,kg shorthand (kr,kg = value or -1 for whole span) and start, stop, pack = tools.derange(tup) rebins and slices according to
x, yf, eyf = tools.rebin(_t_,yf,[start,stop],pack,e=eyf) idem for yb, eyb for each single and then vstacks the result to producuce the rebinned slice
- methods in
mumodel
- for calib
_load_() stores yf,yb,eyf,eyb, string = suite.slice_for_back_counts(kr,kg,tup) as self._*_
_add_calib_(x,*argv), updates self._alpha_ if it is changed, calculates _asymmetry_(), which stores _x_, _a_, _ea_ and wraps _add_(x,*argv) to compute theory
- for non calib
_load_ stores also self._alpha_ from suite.groups, calculates _asymmetry_() which stores _x_, _a_, _ea_ once
_add_(x,*argv) computes theory
mufitplot
- methods in @mumodel
where fit.model has already loaded the fit (does not need to update self._alpha_ for calib but needs a method to change several values of tup in chi@@)
_rebin_plot_(tup,lastfits) calls * = suite.slice_for_back_counts(-1,-1,tup) (which already rebins, stores asymmetry_error_factor and tools.rshp(*)) and stores x, a, ea = _asymmetry_plot_(lastfits), using self._alpha_plot_(lastfit)
_add_plot_ vstacks theory
If this works the following methods survive, with changes: in suite
single_for_back_counts(krun,kgroup), slice_for_back_counts(krun,kgroup,tup)
and the following remain but are no more used in the mudashed protocol
asymmetry_single, asymmetry_slice
In mumodel, the following survive with changes
_load_, _add_, _add_calib_, _asymmetry_, _rebin_plot_, asymmetry_plot_, _alpha_plot_
and the folloiing are deprecated
_set_alpha_, _rebin_, _slice_runs_groups_ (?) _radd_plain_
Implemented. Difference between mujpy and musrfit data, AND errorbars.
Background adding 6 runs differ by 2-10 permil.
Redone on 1 run: mujpy firstbin lastbin yield same background. Forcing same t0 fit parameters are the same, within errorbars. Forcing the same NDOF musrfit has larger fcn by 4%.
Difference in {$\alpha$} definition
The two parameters in musrfit and mujpy are one the inverse of the other, {$\alpha_\mathrm{musrfit} = 1/\alpha_\mathrm{mujpy} $}. This means that musrfit renormalizes the forward counts to the backward ones, whereas mujpy renormalizes backward to forward. This leaves the experimental asymmetry the same:
{$${\mathcal A}_i = \frac {f_i - \alpha b_i}{f_i+\alpha b_i} = \frac { \alpha[ 1/\alpha f_i - b_i]}{\alpha[1/\alpha f_i + b_i]} $$}
|