From 1960362c95202c9f1aaad99750343d78569b7632 Mon Sep 17 00:00:00 2001 From: Owen Arnold <owen.arnold@stfc.ac.uk> Date: Thu, 19 Jun 2014 17:36:47 +0100 Subject: [PATCH] refs #9661. Fixes made. --- .../test/ConnectedComponentLabelingTest.h | 8 +- .../algorithms/IntegratePeaksHybrid-v1.rst | 75 +++++++++++++++++++ 2 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 Code/Mantid/docs/source/algorithms/IntegratePeaksHybrid-v1.rst diff --git a/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h b/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h index 186c93f7d29..ab76f5fd018 100644 --- a/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h +++ b/Code/Mantid/Framework/Crystal/test/ConnectedComponentLabelingTest.h @@ -148,12 +148,10 @@ public: MockBackgroundStrategy mockStrategy; EXPECT_CALL(mockStrategy, configureIterator(_)).Times(1); /* - <<<<<<< Updated upstream - * We use the is background strategy to set up two disconected blocks for us. - ======= * We use the is background strategy to set up two disconnected blocks for us. - >>>>>>> Stashed changes - * */EXPECT_CALL(mockStrategy, isBackground(_)).WillOnce(Return(false)).WillOnce(Return(false)).WillOnce( + * + */ + EXPECT_CALL(mockStrategy, isBackground(_)).WillOnce(Return(false)).WillOnce(Return(false)).WillOnce( Return(true)) // is background .WillOnce(Return(false)).WillOnce(Return(false)).WillOnce(Return(false)) // And because we are calling it twice. Repeat pattern diff --git a/Code/Mantid/docs/source/algorithms/IntegratePeaksHybrid-v1.rst b/Code/Mantid/docs/source/algorithms/IntegratePeaksHybrid-v1.rst new file mode 100644 index 00000000000..cc16432a589 --- /dev/null +++ b/Code/Mantid/docs/source/algorithms/IntegratePeaksHybrid-v1.rst @@ -0,0 +1,75 @@ +.. algorithm:: + +.. summary:: + +.. alias:: + +.. properties:: + +Description +----------- + +This is a hybrid between :ref:`algm-IntegratePeaksMD` and :ref:`algm-IntegratePeaksUsingClusters`. Each peak region is treated as a separate image and rebinned accordingly. The background threshold is automatically determined around each peak, by averaging over all pixels in that region. +The NumberOfBins and BackgroundOuterRadius are global to all Peaks. The actual background threshold is calculated independently for each peak based on NumberOfBins, BackgroundOuterRadius and the signal values in that region. This algorithm is in general faster than :ref:`algm-IntegratePeaksUsingClusters` and has a better ability to distinguish peaks from the background because each peak is treated independently. + +Integrates arbitary shaped single crystal peaks defined on an +`MDHistoWorkspace <MDHistoWorkspace>`__ using connected component +analysis to determine regions of interest around each peak of the +`PeaksWorkspace <PeaksWorkspace>`__. The output is an integrated +`PeaksWorkspace <PeaksWorkspace>`__ as well as a group of images `WorkspaceGroup <WorkspaceGroup>`__ of `MDWorkspaces <MDWorkspace>`__ containing the +labels assigned to each cluster for diagnostic and visualisation +purposes. + +**The algorithm makes no assmptions about Peak shape or size** and can +therfore be used where integration over defined shapes +:ref:`algm-IntegratePeaksMD` and +:ref:`algm-IntegrateEllipsoids`, for example, will not +work. + +.. figure:: /images/ClusterImage.png + :alt: ClusterImage.png + + Cluster Label region displayed in the SliceViewer. Peak centre is marked with an X. The green circle illustrates the integration region used by :ref:`algm-IntegratePeaksMD` + +Warnings and Logging +-------------------- + +The algorithm will generate warning. There are three main warning to +know about. + +Off the Image Edge +################## + +The algorithm will warn about unreachable peaks (off the image). This +may be because the peaks detected were off the edge of the detector, or +because the image was cropped in BinMD in such a way that that part of +the detector/TOF space is no longer accessible. + +No Cluster Corresponding to Peak +################################ + +This is because the input `PeaksWorkspace <PeaksWorkspace>`__ has peaks +that do not align with peaks in the image. The error could either be on +the side of the input PeaksWorkspace (spurious peaks), or of the +`MDHistoWorkspace <MDHistoWorkspace>`__ generated as part of processing. +One thing to verify is that the combination of Threshold and +Normalization input parameters are not so low that they are treating +genuine peaks in the image as background. + +Usage +----- + +**Example - Simple Integration of TOPAZ data** + +.. testcode:: IntegratePeaksUsingClustersExample + + # Load an MDEventWorkspace (QLab) containing some SC diffration peaks + mdew = Load("TOPAZ_3680_5_sec_MDEW.nxs") + # The following algorithms need to know that frame to use, this is an older file. Newer files will automaticall have this. + SetSpecialCoordinates(InputWorkspace=mdew, SpecialCoordinates='Q (lab frame)') + # Find the 5 most intense peaks + peaks = FindPeaksMD(InputWorkspace=mdew, MaxPeaks=5) + # Perform the integration + integrated_peaks, cluster_images = IntegratePeaksHybrid(InputWorkspace=mdew, PeaksWorkspace=peaks, BackgroundOuterRadius=0.4) + +.. categories:: -- GitLab