neutronpy.functions.resolution

neutronpy.functions.resolution(p, q, mode='gaussian')[source]

Returns a gaussian profile using a resolution matrix generated for a Triple Axis Spectrometer.

Parameters:
p : ndarray

Parameters for the resolution function, in the following format:

p[0] Constant background
p[1] Linear background slope
p[2] Volume under the first peak
p[3] X position of the first peak
p[4] Y position of the first peak
p[5] R0
p[6] RMxx
p[7] RMyy
p[8] RMxy
p[9] Area under the second peak
p[…] etc.
q : tuple of ndarray

Two input arrays of equivalent size and shape.

Returns:
out : ndarray

Two dimensional resolution profile with shape of input arrays.

Notes

A resolution profile is defined as a two dimensional gaussian that is comprised of elements of a resolution matrix for a triple axis spectrometer, as produced by Instrument.calc_resolution

\[f(q) = R_0 e^{-\frac{1}{2}(RM_{xx}^2 (x-x_0)^2 + RM_{yy}^2 (y-y_0)^2 + 2RM_{xy}(x-x_0)(y-y_0))},\]

where RM is the resolution matrix.