Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | An input MatrixWorkspace with time-of-flight units along X-axis and defined instrument with defined sample |
PeaksWorkspace | InOut | PeaksWorkspace | Mandatory | Workspace with Peaks to be integrated. NOTE: The peaks MUST be indexed with integer HKL values. |
RegionRadius | Input | number | 0.35 | Only events at most this distance from a peak will be considered when integrating |
SpecifySize | Input | boolean | False | If true, use the following for the major axis sizes, else use 3-sigma |
PeakSize | Input | number | 0.18 | Half-length of major axis for peak ellipsoid |
BackgroundInnerSize | Input | number | 0.18 | Half-length of major axis for inner ellipsoidal surface of background region |
BackgroundOuterSize | Input | number | 0.23 | Half-length of major axis for outer ellipsoidal surface of background region |
OutputWorkspace | Output | PeaksWorkspace | The output PeaksWorkspace will be a copy of the input PeaksWorkspace with the peaks’ integrated intensities. | |
CutoffIsigI | Input | number | Optional | Cuttoff for I/sig(i) when finding mean of half-length of major radius in first pass when SpecifySize is false.Default is no second pass. |
NumSigmas | Input | number | 3 | Number of sigmas to add to mean of half-length of major radius for second pass when SpecifySize is false. |
IntegrateInHKL | Input | boolean | False | If true, integrate in HKL space not Q space. |
IntegrateIfOnEdge | Input | boolean | True | Set to false to not integrate if peak radius is off edge of detector.Background will be scaled if background radius is off edge. |
AdaptiveQBackground | Input | boolean | False | Default is false. If true, BackgroundOuterRadius + AdaptiveQMultiplier * |Q| and BackgroundInnerRadius + AdaptiveQMultiplier * |Q| |
AdaptiveQMultiplier | Input | number | 0 | PeakRadius + AdaptiveQMultiplier * |Q| so each peak has a different integration radius. Q includes the 2*pi factor. |
UseOnePercentBackgroundCorrection | Input | boolean | True | If this options is enabled, then the the top 1% of the background will be removedbefore the background subtraction. |
This algorithm will integrate disjoint single crystal Bragg peaks by summing the number of raw or weighted events in a 3D ellipsoidal peak region in reciprocal space (See IntegrateInHKL option for integrating in HKL) and subtracting an estimate of the background obtained from an ellipsoidal shell. In some ways it is similar to the IntegratePeaksMD v2 algorithm. In particular the size parameters to this algorithm are also specified in inverse Angstroms and the background subtraction is done in the same way for both the intensity and the estimated standard deviations. However, this algorithm differs from IntegratePeaksMD v2 in several critical ways.
The algorithm calculates the three principal axes of the events near a peak, and uses the standard deviations in the directions of the principal axes to determine the aspect ratio of ellipsoids used for the peak and background regions.
This algorithm will integrate a list of indexed single-crystal diffraction peaks from a PeaksWorkspace, using events from an ( EventWorkspace ). The indexed peaks are first used to determine a UB matrix. The inverse of that UB matrix is then used to form lists of events that are close to peaks in reciprocal space. An event will be added to the list of events for a peak provided that the fractional value of that event (obtained by applying UB-inverse to the -vector) is closer to the of that peak, than to the of any other peak AND the -vector for that event is within the specified radius of the -vector for that peak. This technique makes the algorithm suitable for nuclear peaks, but may not be suitable for magnetic peaks.
When the lists of events near the peaks have been built, the three principal axes of the set of events near each peak are found, and the standard deviations of the projections of the events on each of the three principal axes are calculated. The principal axes and standard deviations for the events around a peak in the directions of the principal axes are used to determine an ellipsoidal region for the peak and an ellipsoidal shell region for the background. The number of events in the peak ellipsoid and background ellipsoidal shell are counted and used to determine the net integrated intensity of the peak.
The ellipsoidal regions used for the peak and background can be obtained in two ways. First, the user may specify the size of the peak ellipsoid and the inner and outer size of the background ellipsoid. If these are specified, the values will be used for half the length of the major axis of an ellipsoid centered on the peak. The major axis is in the direction of the principal axis for which the standard deviation in that direction is largest. The other two axes for the ellipsoid are in the direction of the other two principal axes and are scaled relative to the major axes in proportion to their standard deviations. For example if the standard deviations in the direction of the other two principal axes are .8 and .7 times the standard deviation in the direction of the major axis, then the ellipse will extend only .8 and .7 times as far in the direction of those axes, as in the direction of the major axis. Overall, the user specified sizes for the PeakSize, BackgroundInnerSize and BackgroundOuterSize are similar to the PeakRadius, BackgroundInnerRadius and BackgrounOuterRadius for the IntegratePeaksMD v2 algorithm. The difference is that the regions used in this algorithm are not spherical, but are ellipsoidal with axis directions obtained from the principal axes of the events near a peak and the ellipsoid shape (relative axis lengths) is determined by the standard deviations in the directions of the principal axes.
Second, if the user does not specify the size of the peak and background ellipsoids, then the three axes of the peak ellipsoid are again set to the principal axes of the set of nearby events but in this case their axis lengths are set to cover a range of plus or minus three standard deviations in the axis directions. In this case, the background ellipsoidal shell is chosen to have the same volume as the peak ellipsoid and it’s inner surface is the outer surface of the peak ellipsoid. The outer surface of the background ellipsoidal shell is an ellipsoidal surface with the same relative axis lengths as the inner surface.
This algorithm uses principle component analysis to determine the principle axis for each peak. For the event list (QLab) associated with each peak, the algorithm determines a covariance matrix, and uses that to establish eigenvectors corresponding to the principle axis (all orthogonal). The sizes of each principle axis are used define the region of which events will be counted/integrated from those already associated with each peak.
Edges for each bank or pack of tubes of the instrument are defined by masking the edges in the PeaksWorkspace instrument. e.g. For CORELLI, tubes 1 and 16, and pixels 0 and 255. Q in the lab frame for every peak is calculated, call it C For every point on the edge, the trajectory in reciprocal space is a straight line, going through:
Calculate a point at a fixed momentum, say k=1. Q in the lab frame:
Normalize E to 1:
The distance from C to OE is given by:
If:
for the integration, one of the detector trajectories on the edge is too close to the peak This method is also applied to all masked pixels. If there are masked pixels trajectories inside an integration volume, the peak must be rejected. If there are masked pixel trajectories inside the background volume, the background events are scaled by estimating the volume of the ellipsoid on the detector.
The sigma from the background could be too small because the background contains events from other peaks. In an effort to reduce this, all the background events are sorted and the top 1% are removed. Note that this behaviour is optional and can be enabled if the property UseOnePercentBackgroundCorrection is enabled. It is enabled by default.
Example - IntegrateEllipsoids:
The code itself works but disabled from doc tests as takes too long to complete. User should provide its own event nexus file instead of TOPAZ_3132_event.nxs used within this example. The original TOPAZ_3132_event.nxs file is availible in Mantid system tests repository.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #.. testcode:: exIntegrateEllipsoids
def print_tableWS(pTWS,nRows):
''' Method to print part of the table workspace '''
tab_names=pTWS.keys();
for name in tab_names:
if len(name)>8:
name= name[0:8];
print "| {0:8} ".format(name),
print "|\n",
for i in xrange(0,nRows):
for name in tab_names:
col = pTWS.column(name);
data2pr=col[i]
if type(data2pr) is float:
print "| {0:8.3f} ".format(data2pr),
else:
print "| {0:8} ".format(data2pr),
print "|\n",
# load test workspace
Load(Filename=r'TOPAZ_3132_event.nxs',OutputWorkspace='TOPAZ_3132_event',LoadMonitors='1')
# build peak workspace necessary for IntegrateEllipsoids algorithm to work
ConvertToMD(InputWorkspace='TOPAZ_3132_event',QDimensions='Q3D',dEAnalysisMode='Elastic',Q3DFrames='Q_sample',LorentzCorrection='1',OutputWorkspace='TOPAZ_3132_md',\
MinValues='-25,-25,-25',MaxValues='25,25,25',SplitInto='2',SplitThreshold='50',MaxRecursionDepth='13',MinRecursionDepth='7')
FindPeaksMD(InputWorkspace='TOPAZ_3132_md',PeakDistanceThreshold='0.3768',MaxPeaks='50',DensityThresholdFactor='100',OutputWorkspace='TOPAZ_3132_peaks')
FindUBUsingFFT(PeaksWorkspace='TOPAZ_3132_peaks',MinD='3',MaxD='15',Tolerance='0.12')
IndexPeaks(PeaksWorkspace='TOPAZ_3132_peaks',Tolerance='0.12')
# integrate Ellipsoids
result=IntegrateEllipsoids(InputWorkspace='TOPAZ_3132_event',PeaksWorkspace='TOPAZ_3132_peaks',\
RegionRadius='0.25',PeakSize='0.2',BackgroundInnerSize='0.2',BackgroundOuterSize='0.25',OutputWorkspace='TOPAZ_3132_peaks')
# print 10 rows of resulting table workspace
print_tableWS(result,10)
|
Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 | #.. testoutput:: exIntegrateEllipsoids
| RunNumbe | DetID | h | k | l | Waveleng | Energy | TOF | DSpacing | Intens | SigInt | BinCount | BankName | Row | Col | QLab | QSample |
| 3132 | 1124984 | -2.000 | -1.000 | 2.000 | 3.104 | 8.491 | 14482.289 | 2.025 | 119890.000 | 372.000 | 1668.000 | bank17 | 120.000 | 42.000 | [1.57771,1.21779,2.37854] | [2.99396,0.815958,0.00317344] |
| 3132 | 1156753 | -3.000 | -2.000 | 3.000 | 2.085 | 18.822 | 9725.739 | 1.298 | 148721.000 | 391.069 | 1060.000 | bank17 | 145.000 | 166.000 | [2.48964,1.45725,3.88666] | [4.52618,1.71025,0.129461] |
| 3132 | 1141777 | -4.000 | -2.000 | 3.000 | 1.707 | 28.090 | 7963.171 | 1.050 | 8703.000 | 105.570 | 96.000 | bank17 | 17.000 | 108.000 | [2.60836,2.31423,4.86391] | [5.69122,1.79492,-0.452799] |
| 3132 | 1125241 | -4.000 | -2.000 | 4.000 | 1.554 | 33.860 | 7252.155 | 1.014 | 19715.000 | 145.805 | 83.000 | bank17 | 121.000 | 43.000 | [3.15504,2.42573,4.75121] | [5.97829,1.63473,0.0118744] |
| 3132 | 1170598 | -4.000 | -3.000 | 4.000 | 1.548 | 34.124 | 7224.587 | 0.950 | 15860.000 | 131.111 | 73.000 | bank17 | 166.000 | 220.000 | [3.43363,1.70178,5.39301] | [6.07726,2.59962,0.281759] |
| 3132 | 1214951 | -2.000 | -1.000 | 4.000 | 1.894 | 22.795 | 8839.546 | 1.677 | 121613.000 | 352.155 | 719.000 | bank18 | 231.000 | 137.000 | [2.73683,1.43808,2.11574] | [3.5786,0.470838,1.00329] |
| 3132 | 1207827 | -3.000 | -1.000 | 4.000 | 1.713 | 27.890 | 7991.697 | 1.319 | 64063.000 | 257.175 | 447.000 | bank18 | 19.000 | 110.000 | [2.80324,2.29519,3.09134] | [4.71517,0.554412,0.37714] |
| 3132 | 1232949 | -4.000 | -2.000 | 6.000 | 1.239 | 53.277 | 5782.138 | 0.934 | 18185.000 | 139.072 | 45.000 | bank18 | 53.000 | 208.000 | [4.29033,2.63319,4.46168] | [6.52658,1.27985,1.00646] |
| 3132 | 1189484 | -4.000 | -1.000 | 6.000 | 1.136 | 63.418 | 5299.275 | 0.964 | 13470.000 | 120.607 | 31.000 | bank18 | 108.000 | 38.000 | [4.02414,3.39659,3.83664] | [6.4679,0.298896,0.726133] |
| 3132 | 1218337 | -5.000 | -2.000 | 7.000 | 1.012 | 79.807 | 4724.051 | 0.773 | 7405.000 | 88.210 | 15.000 | bank18 | 33.000 | 151.000 | [4.96622,3.61607,5.32554] | [7.99244,1.19363,0.892655] |
|
Categories: Algorithms | Crystal\Integration