Digging Into MUD With Python: mudpy, bdata, and bfit
aa r X i v : . [ phy s i c s . d a t a - a n ] A p r Digging Into MUD With Python:mudpy, bdata, and bfit
Derek Fujimoto
1, 2, ∗ Stewart Blusson Quantum Matter Institute, University of British Columbia, Vancouver, BC V6T 1Z4, Canada Department of Physics and Astronomy, University of British Columbia, Vancouver, BC V6T 1Z1, Canada (Dated: April 23, 2020)Used to store the results of muon spin rotation ( µ SR) measurements at TRIUMF, the Muon Data(MUD) file format serves as a useful and flexible scheme that is both lightweight and self-describing.The application programming interface (API) for these files is written in C and FORTRAN, lan-guages not known for their ease of use. In contrast, Python is a language which emphasizes rapidprototyping and readability. This work describes three Python 3 packages to interface with MUDfiles and analyze their contents: mudpy, bdata, and bfit. The first enables easy access to the contentsof any MUD file. The latter two are implemented specifically for the implanted-ion β -detected NMR( β -NMR) experiment at TRIUMF. These tools provide both an API and graphical user interface(GUI) to help users extract and fit β -NMR data. I. MOTIVATION
The first muon spin rotation ( µ SR) measurements wererecorded in 1957, at the Nevis cyclotron in the UnitedStates of America.
While the field has thrived over itslong history, the technique remains restricted to largenationally-supported facilities. Today, there are onlya handful of locations capable of producing the parti-cle beam needed to conduct µ SR, including: TRIUMF,Canada; ISIS, located in the United Kingdom; PSI inSwitzerland; and the Japanese facility J-PARC. TheMuon Data (MUD) file format is used to store µ SR datataken at TRIUMF. This is a self-describing binary for-mat (i.e. not ASCII), containing the measurement data,device settings, experimental conditions such as the tem-perature or the magnetic field, and some metadata.As with many older science applications, the MUD fileapplication programming interface (API) is written in Cand FORTRAN. These statically-typed and compiled lan-guages are known for their computational efficiency, butcan be difficult to work with. This is perhaps one of thereasons why scientific computing has, in many communi-ties, shifted to more modern languages such as Python: adynamically-typed and interpreted language. As a result,Python has amassed a massive library of data analysistools.
The primary advantage of Python is the shortdevelopment time of programs written in the language.This is particularly important in the context of scientificanalysis, which are typically run only a few times by se-lect individuals. As a result, the time taken to write theanalysis code is a large part of the program’s effectiverun time. The aim of this work is to bring this rapidprototyping style of analysis to the µ SR and β -detectedNMR ( β -NMR) communities.It should be acknowledged that a large body of anal-ysis software exists to support µ SR workers. Exam-ples include WIMDA, an older Windows application;MANTID, developed by and for ISIS; and Musrfit, maintained by the workers at PSI. Data stored in theMUD format are compatible with Musrfit. These pro- grams are quite powerful, but can be cumbersomeoutside of their intended scope (e.g. when developingnew methods ). The packages introduced here are verylightweight, providing a simple interface to any otherPython package, allowing for a great deal of flexibilityand sophistication. Like many Python packages, thosedescribed in this work are freely distributed through thePython Package Index (PyPI) and GitHub. This trivi-alizes installation and maintenance by installing missingdependencies, updating packages, and providing a consis-tent method of version tracking. This is in stark contrastto another popularly used framework, ROOT, whichserves as the basis for Musrfit, and whose set up processcan be quite involved.A closely related technique to µ SR, β -NMR relies onthe same physics principles but uses a radioactive iso-tope, rather than a muon. At present, the only activeand permanent implanted-ion β -NMR spectrometer is atTRIUMF. Unlike µ SR, β -NMR does not have anextensive suite of analysis programs well-suited to thespecifics of the technique, however it still uses the MUDformat as the basis of its data acquisition (DAQ) sys-tem. While there have been some recent improvementsto this situation, the analysis required for any non-trivial β -NMR experiment necessitates the developmentof new code to meet the individual requirements of eachexperiment. The packages described in this work im-mensely expedite this process.
II. SOFTWARE DESCRIPTION
This work describes three Python 3 packages: mudpy,bdata, and bfit. The former is a general-purpose MUDfile reader, whereas the latter two are specific to the β -NMR experiment at TRIUMF. Both mudpy andbdata serve to contribute an object layer between the fileand analysis code, whereas bfit implements fitting func-tionality.The mudpy package provides a wrapper for each of theC functions in the mud_friendly API using Cython, and a Python class, mdata , which automates file access,saving the contents as object attributes. MUD files storedata of five different types: description, histogram, inde-pendent variable, scaler, and comment. The descriptiontype contains the file metadata and is saved directly as mdata attributes. The remainders are saved as containersorganized into specialized dictionaries, as demonstratedin the example section. The histograms contain the pri-mary data: counts from the various detectors needed tomeasure the nuclear spin polarization. The independentvariables may contain experiment settings or measure-ments such as the temperature. The scalers contain infor-mation from secondary readouts of the detectors: totalnumber of counts and the most recent reading. Com-ments are additional notes from the experimenters.The bdata object inherits from mdata , providing ad-ditional functionality for variable lookup, calculation ofthe beta-decay asymmetry, and remote fetching of datafrom the archive. The bdata package also provides theclasses bjoined and bmerged for concatenating and merg-ing bdata objects, respectively.The bfit package provides a suite of analysis tools for β -NMR experiments, accessible through both the PythonAPI and a graphical user interface (GUI). The primarygoal of the GUI is to enable inexperienced programmersand external users to do β -NMR, however, it also makessimple analyses very fast and convenient, useful evenfor experienced users. The GUI supports a number offeatures, such as: shared parameter fitting, interactiveand graphical selection of initial fit parameters, assigningfunctional constraints to fit parameters (e.g. if a variableis a function of temperature, as is the case for Korringarelaxation ), periodic fetching and redrawing of data,and displaying the file contents in a format easily compat-ible with the MIDAS DAQ system. bfit also supportsthe dynamic importing of user-defined χ minimizers, al-lowing for the use of other codes, such as ROOT, in fittingdata. The default χ minimizer in bfit is a Levenberg-Marquardt algorithm when no bounds are set, or if theparameter space is bounded, then a Trust Region Re-flective algorithm is used. Both are implemented usingthe scipy.optimize.curve_fit function. The graphi-cal interface for bfit is provided by TkInter, and plottingfunctionality is implemented using Matplotlib. Numeri-cal calculations employ the use of SciPy, NumPy, andPandas. These packages run C or FORTRAN code un-der the hood, providing a huge reduction in computationtime.Given that mudpy exists only to read, write, and storethe contents of files, the remainder of this work will fo-cus on the β -NMR-specific implementations. Of criticalimportance is the calculation of the asymmetry of theaverage beta-decay direction. This discussion relates themeasured asymmetry to the underlying polarization andshows how the fit functions are constructed in the caseof pulsed beam measurements. Next, an overview of theglobal fitting method is presented. Lastly, a few illustra- tive examples using the three packages will be given. III. β -NMR POLARIZATION ANDASYMMETRY Similar to µ SR, implanted-ion β -NMR measures thenuclear spin polarization of an implanted ensemble of ra-dioactive particles through their anisotropic beta decay. A major distinction, however, is that the lifetime ( τ ) ofthe isotopes used in β -NMR are much longer than that ofthe muon. For example, Li, the typical β -NMR probe atTRIUMF, has τ = 1 .
21 s , as compared to τ = 2 . µ s forthe muon. The coarser time resolution of β -NMR resultsin a very different analysis, despite the similarities in thephysical principles.The probability that an e − is emitted at angle θ , rela-tive to the spin of the probe nucleus, is W ( θ ) = 1 + vc P A cos( θ ) , (1)where P is the polarization of the nuclear ensemble, v isthe speed of the emitted e − , c is the speed of light, and | A | < is an asymmetry parameter. For Li, A = − and the in-flight nuclear spin polarization alongthe beam axis at TRIUMF is approximately
70 % . Theions are implanted at an approximately constant rate, R , which is switched on at t = 0 . Let N ( t, t ′ ) dt ′ be thenumber of nuclei which arrived in the interval ( t ′ , t ′ + dt ′ ),and survive until time t : N ( t, t ′ ) dt ′ = R exp[ − ( t − t ′ ) /τ ] dt ′ , (2)where τ is the nuclear lifetime. The total number ofnuclei in the sample at time t > t ′ is then N ( t ) = Z t N ( t, t ′ ) dt ′ = R τ [1 − exp( − t/τ )] . (3)Let p ( t, t ′ ) be the average polarization of an ensemble ofprobes implanted at t ′ , at the moment of decay at time t > t ′ . The simplest case is when p ( t, t ′ ) is exponential, exp[( t − t ′ ) /T ] , however in general it may be any functionof t and t ′ . Accounting for all arrival times, the averagepolarization at time t > t ′ is P ( t ) = 1 N ( t ) Z t N ( t, t ′ ) p ( t, t ′ ) dt ′ = R t exp[ − ( t − t ′ ) /τ ] p ( t, t ′ ) dt ′ τ [1 − exp( − t/τ )] . (4)The polarization of the implanted ensemble is measuredby counting the emitted betas in the forward ( F ) andbackward ( B ) directions, relative to the beam direction.If f ( t, t ′ ) dt ′ is the number of betas detected in detector F during the time interval ( t , t + dt ), then f ( t, t ′ ) dt ′ = N ( t, t ′ )[1 + ap ( t, t ′ )] dt ′ , (5)where a is a constant of proportionality. The averagenumber of betas arriving in detector F is then: F ( t ) = Z t f ( t, t ′ ) dt ′ = R τ [1 − exp( − t/τ )](1 + a P ( t )) , (6)and similarly for B ( t ) , where a → − a . In principle, dif-ferences in the detectors may lead to unique values of R and | a | for each. However, if they are the same, then theasymmetry is proportional to the polarization: A ( t ) ≡ F ( t ) − B ( t ) F ( t ) + B ( t ) = a P ( t ) . (7)If the rates, R , are not the same for each detector, then A ( t ) = δ + a P ( t )1 + δa P ( t ) , (8)where α ≡ R F R B and δ = α − α +1 . The effects producedby the non-ideal case of α = 1 are typically reduced bycombining the asymmetry with that of the inverted spinpolarization state (denoted by ± ): ∆ A ( t ) = A + ( t ) − A − ( t )2 = a P ( t )(1 − δ )1 − [ δa P ( t )] . (9)Since polarization inversion is equivalent to P + = −P − ,and in the absence of spectrometer-related distortions a F = − a B , then F ± = B ∓ . Physically, if the spins arepointed at detector F in the ( + ) state, then in the ( − )state they are pointed at detector B , so the signal is in-variant if both polarization and detectors are exchanged.Therefore, one can take the geometric means of thesepairings to form a 4-counter asymmetry: A ( t ) = √F + B − − √F − B + √F + B − + √F − B + . (10)The advantage of this formulation is that the terms √F ± B ∓ share the coefficient √ R F R B , which cancels andeliminates any dependence on the rate. The 4-counterasymmetry is proportional to the polarization with thesame scaling factor as Equation (7), regardless of α .We now consider the case where the scaling factors ofthe two detectors also differ: β ≡ a F a B = 1 . In this case, ∆ A ( t ) = δ + a B P ( t ) 1 − δ − δ + (cid:16) α − α +1 (cid:17) − (cid:16) δ − a B P ( t ) (cid:17) (11)where δ ± ≡ αβ ± α +1 . In the limit where α → and β → , ∆ A ( t ) ≈ h ( β + 1) − ( α − i a B P ( t )+12 h ( β −
1) + ( α − i (cid:16) a B P ( t ) (cid:17) . (12) In contrast, if this generalization of β = 1 is accountedfor in Equation (10), we find that the dependence on α again is exactly cancelled, however the dependence on β remains. To first order this is A ( t ) ≈ (cid:18) β + 12 (cid:19) a B P ( t ) , (13)which is the same as the first term of Equation (12) if α = 1 . Differences in rate and scaling are also commonsources of systematic error in µ SR experiments.
The implementation of these calculations can be foundin both bdata and bfit. In bdata, the asymmetry ofeach of the individual polarization states is calculatedusing Equation (7), whereas the combined asymmetryis calculated with Equation (10). The exponential andmulti-exponential spin-lattice relaxation (SLR) fittingfunctions used in bfit are calculable analytically usingEquation (4), whereas the stretched exponential relax-ation fit function is computed numerically using a double-exponential integration scheme, important for its speedand stability at t = 0 . Note that in order to measurethe SLR, a pulsed beam is used; thus, when the beamis turned off at time ∆ , the integration limit of Equa-tions (3) and (4) is set to ∆ when t > ∆ . IV. GLOBAL FITTING
Global fitting refers to the procedure by which the pa-rameters of best fit are found for a set of data, in the casewhere one or more of these parameters are shared acrossthe data set. For example: the data set may consist ofmany Gaussian distributions which are known to be col-lectively described by a single mean, but have differentstandard deviations. The global fitting class defined in bfit.fitting.global_fitter takes as input the data,the fitting function, and a list of boolean values spec-ifying which parameters are to be shared. The global χ , resulting from a simultaneous fit to all the distribu-tions, is then minimized. The global fitting object alsoallows for the initial parameter values and bounds to beset intelligently, inferring from context whether the inputrefers to the parameter for a given data set, or should beapplied to all data sets.Continuing with this example, if there are N dat pointsin each distribution, and N set distributions in the dataset, then the data inputs to the constructor will each be2D array-like objects with the shape N set × N dat . Theinput for the function may be a single function handle ora list of handles of length N set , with the restriction thatall functions must take the same inputs in the same or-der. The length of the list of booleans indicating sharingdefines the number of parameters to be minimized. Theremaining function inputs should be passed as constantvalues through the metadata parameter. The construc-tor may also take a 2D list of booleans indicating whichparameters for which distribution are to be fixed to theirinitial value. These latter two inputs are optional.Like all the minimization in bfit, the global fittingutilizes the scipy.optimize.curve_fit function, whichhas the basic prototype curve_fit(f, xdata, ydata) . f is the fitting function of the type f(x,...) . The strat-egy is to define f such that it has access to the datathrough the object attributes, and inflate the 1D arrayof input parameters from curve_fit to match. The callto curve_fit is applied to the concatenation of the dataarrays. This is described in detail by Algorithms 1 and2. A similar flattening procedure is applied to the ini-tial parameters and fitting bounds, such that they canbe passed to curve_fit , and the inverse procedure isapplied to inflate the results back to the original inputshape. Algorithm 1:
Get a matrix of indices mapping the1D input to curve_fit to a 2D arrangement
Data:
Which indices are fixed and which are shared,The number of data sets, N set ,The number of fit parameters, N par Input :
None
Output :
Matrix L of indices, mapping a 1Darrangement to 2D Function get_map( void ) : L = N set × N par matrix u = empty vector for i ∈ { , , ..., N set − } do for j ∈ { , , ..., N par − } do if parameter j is shared then L ij = j end else if parameter j is fixed then L ij = − − j − ( i · N par ) end else L ij = j + ( i · N par ) end if L ij ≥ and L ij / ∈ u then append L ij to u end end end /* Remap indices to those from curve_fit */ L ij = k if L ij = u k ∀ i, j, k L ij = N set · N par − L ij if L ij < ∀ i, j return L end V. EXAMPLESA. mudpy Our first example uses mudpy.mdata to read a MUDfile called , located in the current working
Algorithm 2:
Master function for global fitting
Data: X : N set × N dat matrix, independent variable M : N set × N meta matrix, additional inputs P : N set × N par matrix, initial parameters f ( x , p , p , ..., p ( N par + N meta ) ) : fitting function Input :
From curve_fit , vectors of values for theindependent variable x (unused), andparameters p (length N par ). Output :
An array of values corresponding to theconcatenated y values Function f( x , p ) : L = get_map()/* Add initial parameters to input array */ for i ∈ { N set − , N set − , ..., } do for j ∈ { N par − , N par − , ..., } do append P ij to p end end /* Get data for output */ Let Y ′ be a N set × N dat matrix for i ∈ { , , ..., N set − } do for j ∈ { , , ..., N dat − } do Y ′ ij = f ( X ij ,p L ( i, , p L ( i, , ..., p L ( i,N par) ,M ( i, , M ( i, , ..., M ( i,N meta ) ) end end /* Concatenate the output */ y = ( Y , ... Y ,N dat Y , ... Y ,N dat ... Y N set ,N dat ) return y end directory, and corresponding to an SLR run taken on the β -NMR spectrometer in 2019. In [1]: import mudpy as mpIn [2]: data = mp.mdata('041200. msr')In [3]: dataOut[3]:apparatus: 'BNMR 'area: 'BNMR 'das: 'MIDAS 'description: 16908289duration : 622end_date : 'Mon Oct 28 01:45:13 2019'end_time : 1572252313exp: 1424experimenter: 'df , ms'field: '65500.8(0.0)G'hist: mdict: {'B+', 'F+', 'B-', 'F-', ... }ivar: mdict: {'BNMR:HVBIAS :POS:RDVOL ', 'BNMR ← ֓ :HVBIAS : NEG:RDVOL ', ...}lab: 'TRIUMF 'method : 'TD - BNMR'mode: '20'orientation: ''run: 41200sample : 'EMIM -Ac (LiCl)'sclr: mdict: {'Back% BSegments', 'Front % ← ֓ FSegments', ...}start_date: 'Mon Oct 28 01:34:51 2019'start_time: 1572251691temperature: '243.9(4.1)K'title: 'EMIM -Ac (LiCl) , B =65500.8(0.0)G, HV ← ֓ =0 kV , T =200.0(0.7)K (warming ), SLR' year: 2019 As shown, the output is nicely formatted, noting that thefull output of the mdict s have been truncated to conserveon space in this publication. The object mdict belongsto the mudpy.containers module and inherits from thestandard Python dictionary class. mdict allows for dic-tionary elements to be accessed as attributes. Therefore, data.ivar.var_name is equivalent to data.ivar[' ← ֓ var_name'] , subject to restrictions on allowed attributenames (e.g. data.hist.F+ is not an allowed syntax; forthis special case data.hist.Fp can be used, or for theother helicity state: data.hist.Fn ). mudpy.containers also defines the mcontainer base class which is the parentfor containers specific to the histogram, variable, scaler,and comment data types. mcontainer has numerous con-venience functions such as nice printing: In [4]: data.ivar['/Sample /read_A ']Out[4]:description: 'SampleA temperature'high: 250.383id_number: 23low: 236.001mean: 243.9106082123654skew: -831.177521713147std: 4.067047463404781title : '/Sample /read_A 'units : 'K' as well as redefined mathematical operators that act onthe mean or data attribute, as appropriate: In [5]: data.ivar['/Sample /read_A ']+10Out[5]: 253.9106082123654
The other object of interest defined in mudpy.containers is mlist . This object allowsfor attribute access to its contents as demonstrated inthe following example: In [1]: from mudpy.containers import mlistIn [2]: class example ( object ): def __init__ (self , x):self.x = xIn [3]: m = mlist ([ example (i) for i in range (5)])In [4]: m.xOut[4]: array ([0, 1, 2, 3, 4]) If the output is a list of numbers, then it is convertedto a numpy.ndarray , otherwise it returns another mlist object.
B. bdata
The bdata package defines three objects: bdata , bjoined , and bmerged . The first inherits from mudpy.mdata with additional formatting and sorting forvariables. Additionally, differing variable names are allmapped to a consistent naming scheme. In the follow-ing example, we draw the combined asymmetry (calcu-lated with Equation (10)) for the run we fetched with mdata . One major difference between the two is that mdata requires the full file path to be specified, whereas bdata uses the environment variables BNMR_ARCHIVE and
BNQR_ARCHIVE to locate the data on the local machine. Ifthe data is not found, then the data is fetched from thearchive. If the environment variables are not defined,the default location for the data is $HOME/.bdata . Thefollowing short example demonstrates how easily one isable to draw the asymmetry of a β -NMR run: import bdata as bd import matplotlib.pyplot as pltdata = bd.bdata(run = 41200 , year = 2019)plt.errorbar (* data.asym('c')) The reader is encouraged to read the docstring of bdata.bdata.asym for the many options which vary ac-cording to type of data collected.The bjoined and bmerged objects both take as inputlists of bdata objects and combine them. After construc-tion, bmerged behaves exactly like a bdata object, com-bining both the data and the other variables, allowingfor seamless replacement in code written for bdata . Thisresults in a loss of information, namely the individual de-tails of each of the runs. The object bjoined solves thisissue, taking advantage of mudpy.containers.mlist tostore the information of each run. In this way data froma set of runs is easily combined, however the operation of bjoined is slightly different from bdata , returning lists ofthe data containers rather than single merged containers.
C. bfit
We now show an example of using the fit functionsdefined in bfit to fit some pulsed beam SLR data: import bdata as bd from scipy. optimize import curve_fit from bfit. fitting .functions import pulsed_strexpdata = bd.bdata(run = 41200 , year = 2019)
As a simple, if contrived, example of using the globalfitter, consider the following: import numpy as np from numpy. random import randint , random from bfit. fitting .global_fitter import global_fitterfn = lambda x, a, b : a * x + b x = [np. arange (randint (low = 3, high = 10)) for i in ← ֓ range (5)] len (x))*5y = [fn(xval , 2, i) for xval , i in zip (x, itrcpt )] len (xval)) for xval in x] VI. SUMMARY
The packages mudpy, bdata, and bfit bring the rapiddevelopment style of Python 3 to µ SR and β -NMR anal-ysis, complementing established µ SR software such asMusrfit. The first package provides an easy interface toMUD files though the mdata class. The second does thesame for β -NMR data through the bdata class, but withadditional analysis and convenience tools. The third pro-vides both a GUI and an API for β -NMR fitting functionsand tools such as the global fitter. All three packages arefreely available on PyPI and GitHub. ACKNOWLEDGMENTS
The author would like to thank R. M. L. McFaddenfor sharing many of his codes, on which much of the β -NMR implementation is based, as well as for many usefuland interesting discussions. Additionally, the membersof the TRIUMF β -NMR group have been instrumentalin testing, providing feedback, and suggesting improve-ments. This work was supported by the QuEST fellow-ship program. ∗ [email protected] Richard L. Garwin, Leon M. Lederman, and Mar-cel Weinrich, “Observations of the Failure of Conser-vation of Parity and Charge Conjugation in MesonDecays: the Magnetic Moment of the Free Muon,”Phys. Rev. , 1415–1417 (1957). Richard L. Garwin, “The first muon spin rotation experi-ment,” Phys. B Condens. Matter , 1–10 (2003). Jess H. Brewer, “Problems and Opportunities: The EarlyHistory of µ SR,” Phys. Procedia , 2–6 (2012). Ted Whidden, Donald Arseneau, and Suzannah Daviel,“MUon Data access,” (1994). Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, MattHaberland, Tyler Reddy, David Cournapeau, EvgeniBurovski, Pearu Peterson, Warren Weckesser, JonathanBright, Stefan J. Stéfan J. van der Walt, Matthew Brett,Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, An-drew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson,C. J. Carey, Ilhan Äřlhan Polat, Yu Feng, Eric W. Moore,Jake VanderPlas, Denis Laxalde, Josef Perktold, RobertCimrman, Ian Henriksen, E. A. Quintero, Charles R. Har-ris, Anne M. Archibald, Antônio H. Antonio H. Ribeiro,Fabian Pedregosa, and Paul van Mulbregt, “SciPy 1.0: fun-damental algorithms for scientific computing in Python,”Nat. Methods , 261–272 (2020). Wes McKinney, “Data Structures for Statistical Comput-ing in Python,” in
Proc. 9th Python Sci. Conf. (2010) pp.51–56. F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel,B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer,R. Weiss, V. Dubourg, J. Vanderplas, A. Passos,D. Cournapeau, M. Brucher, M. Perrot, and E. Duch-esnay, “Scikit-learn: Machine Learning in Python,” J. Mach. Learn. Res. , 2825–2830 (2011). F. L. Pratt, “WIMDA: a muon dataanalysis program for the Windows PC,”Phys. B Condens. Matter , 710–714 (2000). O. Arnold, J. C. Bilheux, J. M. Borreguero, A. Buts,S. I. Campbell, L. Chapon, M. Doucet, N. Draper,R. Ferraz Leal, M. A. Gigg, V. E. Lynch, A. Mark-vardsen, D. J. Mikkelson, R. L. Mikkelson, R. Miller,K. Palmen, P. Parker, G. Passos, T. G. Perring, P. F.Peterson, S. Ren, M. A. Reuter, A. T. Savici, J. W.Taylor, R. J. Taylor, R. Tolchenov, W. Zhou, andJ. Zikovsky, “Mantid–Data analysis and visualizationpackage for neutron scattering and µ SR experiments,”Nucl. Instrum. Methods Phys. Res. Sect. A , 156–166 (2014). A. Suter and B.M. Wojek, “Musrfit: A Free Platform-Independent Framework for µ SR Data Analysis,”Phys. Procedia , 69–73 (2012). Uldis Locans and Andreas Suter, “Musrfit–Real Time Pa-rameter Fitting Using GPUs,” in
JPS Conf. Proc. (Journalof the Physical Society of Japan, 2018). A. F. A. Simões, H. V. Alberto, R. C. Vilão, J. M.Gil, J. M. V. Cunha, M. A. Curado, P. M. P. Salomé,T. Prokscha, A. Suter, and Z. Salman, “Muon implanta-tion experiments in films: Obtaining depth-resolved infor-mation,” Rev. Sci. Instrum. , 023906 (2020). The packages are listed on PyPI ( https://pypi.org/ ) as mud-py , bdata , and bfit . Rene Brun and Fons Rademakers, “ROOT –An object oriented data analysis framework,”Nucl. Instrum. Methods Phys. Res. Sect. A , 81–86 (1997). Gerald D. Morris, “ β -NMR,”Hyperfine Interact. , 173–182 (2014). W.A. MacFarlane, “Implanted-ion β NMR: A new probe for nanoscience,”Solid State Nucl. Magn. Reson. , 1–12 (2015). Robert F. Kiefl, “Developments in µ SR and β NMR: Be-yond a Muon Lifetime,” in
JPS Conf. Proc. (Journal of thePhysical Society of Japan, 2018). Hassan Saadaoui, “BnmrOffice: A Free Software for β -nmrData Analysis,” in JPS Conf. Proc. (Journal of the Physi-cal Society of Japan, 2018). Daniel Szunyogh, Ryan M. L. McFadden, Victoria L.Karner, Aris Chatzichristos, Thomas Day Goodacre, Mar-tin H. Dehn, Lia Formenti, Derek Fujimoto, AlexanderGottberg, Evan Kallenberg, Ildikó Kálomista, Robert F.Kiefl, Flemming H. Larsen, Jens Lassen, C. D. PhilipLevy, Ruohong Li, W. Andrew MacFarlane, Iain McKen-zie, Gerald D. Morris, Stavroula Pallada, Matthew R.Pearson, Stephan P. A. Sauer, Paul Schaffer, Pe-ter W. Thulstrup, Lars Hemmingsen, and MonikaStachura, “Direct observation of Mg complexes inionic liquid solutions by Mg β -NMR spectroscopy,”Dalton Trans. , 14431–14435 (2018). Derek Fujimoto, Ryan M. L. McFadden, Martin H.Dehn, Yael Petel, Aris Chatzichristos, Lars Hemmingsen,Victoria L. Karner, Robert F. Kiefl, C. D. PhilipLevy, Iain McKenzie, Carl A. Michal, Gerald D. Mor-ris, Matthew R. Pearson, Daniel Szunyogh, John O.Ticknor, Monika Stachura, and W. Andrew MacFar-lane, “Dynamics of Liquid 1-Ethyl-3-MethylimidazoliumAcetate Measured with Implanted-Ion Li β -NMR,”Chem. Mater. , 9346–9353 (2019). Ryan M. L. McFadden, Terry J. Buck, Aris Chatzichris-tos, Chia-Chin Chen, Kim H. Chow, David L. Cor-tie, Martin H. Dehn, Victoria L. Karner, DimitriosKoumoulis, C. D. Philip Levy, Chilin Li, Iain Mcken-zie, Rotraut Merkle, Gerald D. Morris, Matthew R.Pearson, Zaher Salman, Dominik Samuelis, MonikaStachura, Jiyu Xiao, Joachim Maier, Robert F. Kiefl,and W. Andrew Macfarlane, “Microscopic Dynamics ofLi + in Rutile TiO Revealed by Li β -detected NMR,”Chem. Mater. , 10187–10197 (2017). Victoria L Karner, Aris Chatzichristos, David L Cor-tie, Martin H Dehn, Oleksandr Foyevtsov, KaterynaFoyevtsova, Derek Fujimoto, Robert F Kiefl, C D PhilipLevy, Ruohong Li, Ryan M. L. McFadden, Gerald D Mor-ris, Matthew R Pearson, Monika Stachura, John O Tic-knor, Georg Cristiani, Gennady Logvenov, Friedrike Wro-bel, Bernhard Keimer, Junjie Zhang, John F Mitchell, andW. Andrew MacFarlane, “Local metallic and structuralproperties of the strongly correlated metal LaNiO using Li β -NMR,” Phys. Rev. B , 165109 (2019). Stefan Behnel, Robert Bradshaw, Craig Citro,Lisandro Dalcin, Dag Sverre Seljebotn, and Kurt Smith, “Cython: The Best of Both Worlds,”Comput. Sci. Eng. , 31–39 (2011). All non-commercial data taken at TRIUMF can be foundat http://cmms.triumf.ca/ . J. Korringa, “Nuclear magnetic relaxation and resonnanceline shift in metals,” Physica , 601–610 (1950). Stefan Ritt, “Maximum Integrated Data Acquisition System (MIDAS),”(1993). Jorge J. Moré, “The Levenberg-Marquardt algorithm:Implementation and theory,” in
Numer. Anal. , LectureNotes in Mathematics, Vol. 630, edited by G. A. Watson(Springer Verlag, 1978) pp. 105–116. Mary Ann Branch, Thomas F. Coleman, and Yuying Li,“A Subspace, Interior, and Conjugate Gradient Method forLarge-Scale Bound-Constrained Minimization Problems,”SIAM J. Sci. Comput. , 1–23 (1999). John D. Hunter, “Matplotlib: A 2D Graphics Environ-ment,” Comput. Sci. Eng. , 90–95 (2007). Stéfan van der Walt, S. Chris Colbert, andGaël Varoquaux, “The NumPy Array: A Struc-ture for Efficient Numerical Computation,”Comput. Sci. Eng. , 22–30 (2011). J. D. Jackson, S. B. Treiman, and H. W. Wyld, “Pos-sible tests of time reversal invariance in beta decay,”Phys. Rev. , 517–521 (1957). F. D. Correll, L. Madansky, R. A. Hardekopf,and J. W. Sunier, “Nuclear moments of Li,”Phys. Rev. C , 862–874 (1983). E. Arnold, J. Bonn, W. Neu, R. Neugart, andE. W. Orten, “Quadrupole interaction of Li and Li in LiNbO and the quadrupole moment of Li,”Zeitschrift fur Phys. A At. Nucl. , 295–298 (1988). C. D. P. Levy, R. Baartman, K. Jayamanna, R. Kiefl,T. Kuo, M. Olivo, G. W. Wight, D. Yuan, andA. N. Zelenski, “A polarized beams project at ISAC,”Nucl. Phys. A , 253–258 (2002). Robert F. Kiefl, “Updated Notes on Pulsed β -NMR,” Per-sonal Communication (2007). W. Widdra, M. Detje, H.-D. Ebinger, H. J. Jänsch,W. Preyss, H. Reich, R. Veith, D. Fick, M. Röckelein, andH.-G. Völk, “ β -NMR on single-crystal surfaces: Method,”Rev. Sci. Instrum. , 2465–2475 (1995). Tanya M. Riseman, Jess H. Brewer, and Don-ald J. Arseneau, “Corrected asymmetry plots,”Hyperfine Interact. , 1135–1140 (1994). D. R. Noakes, J. H. Brewer, D. R. Harshman, E. J.Ansaldo, and C. Y. Huang, “Electron, muon, andnuclear spin dynamics in SmRh B and ErRh B ,”Phys. Rev. B , 6597–6607 (1987). John D. Cook, “Fast numerical integration,” (2015). Masatake Mori and Masaaki Sugihara, “The double-exponential transformation in numerical analysis,”J. Comput. Appl. Math.127