Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | A 2D workspace with X values of d-spacing |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The name of the output workspace |
ReferenceSpectra | Input | number | 0 | The Workspace Index of the spectra to correlate all other spectra against. |
WorkspaceIndexMin | Input | number | 0 | The workspace index of the first member of the range of spectra to cross-correlate against. |
WorkspaceIndexMax | Input | number | 0 | The workspace index of the last member of the range of spectra to cross-correlate against. |
XMin | Input | number | 0 | The starting point of the region to be cross correlated. |
XMax | Input | number | 0 | The ending point of the region to be cross correlated. |
Compute the cross correlation function for a range of spectra with respect to a reference spectrum.
This is use in powder diffraction experiments when trying to estimate the offset of one spectra with respect to another one. The spectra are converted in d-spacing and then interpolate on the X-axis of the reference. The cross correlation function is computed in the range [-N/2,N/2] where N is the number of points.
More details can be found here.
Example - Crosscorrelate 2 spectra
#Create a workspace with 2 spectra with five bins of width 0.5
ws = CreateSampleWorkspace(BankPixelWidth=1, XUnit='dSpacing', XMax=5, BinWidth=0.5)
ws = ScaleX(InputWorkspace='ws', Factor=0.5, Operation='Add', IndexMin=1, IndexMax=1)
# Run algorithm CrossCorrelate
OutputWorkspace = CrossCorrelate(InputWorkspace='ws', WorkspaceIndexMax=1, XMin=2, XMax=4)
# Show workspaces
print "AutoCorrelation",OutputWorkspace.readY(0)
print "CrossCorrelation",OutputWorkspace.readY(1)
AutoCorrelation [-0.01890212 1. -0.01890212]
CrossCorrelation [-0.68136257 0.16838401 0.45685055]
Categories: Algorithms | Utility | Arithmetic