\(\renewcommand\AA{\unicode{x212B}}\)

MuonMaxent v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

See Also

PhaseQuad, FFT

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

Workspace

Mandatory

Raw muon workspace to process

InputPhaseTable

Input

TableWorkspace

Phase table (initial guess)

InputDeadTimeTable

Input

TableWorkspace

Dead time table (initial)

GroupTable

Input

TableWorkspace

Group Table

GroupWorkspace

Input

Workspace

Group Workspace

FirstGoodTime

Input

number

0.1

First good data time

LastGoodTime

Input

number

33

Last good data time

Npts

Input

long

Mandatory

Number of frequency points to fit (should be power of 2). Allowed values: [‘256’, ‘512’, ‘1024’, ‘2048’, ‘4096’, ‘8192’, ‘16384’, ‘32768’, ‘65536’, ‘131072’, ‘262144’, ‘524288’, ‘1048576’]

MaxField

Input

number

1000

Maximum field for spectrum

FixPhases

Input

boolean

False

Fix phases to initial values

FitDeadTime

Input

boolean

True

Fit deadtimes

DoublePulse

Input

boolean

False

Double pulse data

OuterIterations

Input

long

10

Number of loops to optimise phase, amplitudes, backgrounds and dead times

InnerIterations

Input

long

10

Number of loops to optimise the spectrum

DefaultLevel

Input

number

0.1

Default Level

Factor

InOut

number

1.04

Used to control the value chi-squared converge to

OutputWorkspace

Output

Workspace

Mandatory

Output Spectrum (combined) versus field

OutputPhaseTable

Output

TableWorkspace

Output phase table (optional)

OutputDeadTimeTable

Output

TableWorkspace

Output dead time table (optional)

ReconstructedSpectra

Output

Workspace

Reconstructed time spectra (optional)

PhaseConvergenceTable

Output

Workspace

Convergence of phases (optional)

Description

This algorithm calculates a single frequency spectrum from the time domain spectra recorded by multiple groups/detectors.

If a group contains zero counts (i.e. the detectors are dead) then they are excluded from the frequency calculation. In the outputs these groups record the phase and asymmetry as zero and \(999\) respectively.

The time domain data \(D_k(t)\), where \(t\) is time and \(k\) is the spectrum number, has associated errors \(E_k(t)\). If the number of points chosen is greater than the number of time domain data points then extra points are added with infinite errors. The time domain data prior to FirstGoodTime also have their errors set to infinity. The algorithm will produce the frequency spectra \(f(\omega)\) and this is assumed to be real and positive. The upper limit of the frequency spectra is determined by MaxField. The maximum frequency, \(\omega_\mathrm{max}\) can be less than the Nyquist limit \(\frac{\pi}{\delta T}\) if the instrumental frequency response function for \(\omega>\omega_\mathrm{max}\) is approximatley zero. The initial estimate of the frequency spectrum is flat.

The algorithm calculates an estimate of each time domain spectra, \(g_k(t)\) by the equation

\[g_k(t)=(1+A_k \Re(\mathrm{IFFT}(f(\omega) R(\omega))\exp(-j\phi_k) ) ),\]

where \(\Re(z)\) is the real part of \(z\), \(\mathrm{IFFT}\) is the inverse fast Fourier transform (as defined by numpy), \(\phi_k\) is the phase and \(A_k\) is the asymmetry of the of the \(k^\mathrm{th}\) spectrum. The asymmetry is normalised such that \(\sum_k A_k = 1\). The instrumental frequency response function, \(R(\omega)\), is is in general complex (due to a non-symmetric pulse shape) and is the same for all spectra. The values of the phases and asymmetries are fitted in the outer loop of the algorithm.

The \(\chi^2\) value is calculated via the equation

\[\chi^2 = F\frac{\sum_{k,t} (D_k(t)-g_k(t))^2 }{E_k(t)^2},\]

where \(F\) is the Factor and is of order 1.0 (but can be adjusted by the user at the start of the algorithm for a better fit). The entropy is given by

\[S = - \sum_\omega f(\omega) \log\left(\frac{f(\omega)}{A}\right),\]

where \(A\) is the DefaultLevel; it is a parameter of the entropy function. It has a number of names in the literature, one of which is default-value since the maximum entropy solution with no data is \(f(\omega)=A\) for all \(\omega\). The algorithm maximises \(S-\chi^2\) and it is seen from the definition of Factor above that this algorithm property acts a Lagrange multiplier, i.e. controlling the value \(\chi^2\) converges to.

Usage

# load data
Load(Filename='MUSR00022725.nxs', OutputWorkspace='MUSR00022725')
# estimate phases
CalMuonDetectorPhases(InputWorkspace='MUSR00022725', FirstGoodData=0.10000000000000001, LastGoodData=16, DetectorTable='phases', DataFitted='fitted', ForwardSpectra='9-16,57-64', BackwardSpectra='25-32,41-48')
MuonMaxent(InputWorkspace='MUSR00022725', InputPhaseTable='phases', Npts='16384', OuterIterations='9', InnerIterations='12', DefaultLevel=0.11, Factor=1.03, OutputWorkspace='freq', OutputPhaseTable='phasesOut', ReconstructedSpectra='time')
# get data
freq = AnalysisDataService.retrieve("freq")
print('frequency values {:.3f} {:.3f} {:.3f} {:.3f} {:.3f}'.format(freq.readY(0)[5], freq.readY(0)[690],freq.readY(0)[700], freq.readY(0)[710],freq.readY(0)[900]))

Output

frequency values 0.110 0.789 0.871 0.821 0.105

Categories: AlgorithmIndex | Muon | Arithmetic\FFT

Source

Python: MuonMaxent.py