diff --git a/Code/Mantid/Framework/SINQ/CMakeLists.txt b/Code/Mantid/Framework/SINQ/CMakeLists.txt index 8f90dae787f136c682f7a6019994f20543a985d2..33aa89f72493498a6a0da7312d52ab935dad94bf 100644 --- a/Code/Mantid/Framework/SINQ/CMakeLists.txt +++ b/Code/Mantid/Framework/SINQ/CMakeLists.txt @@ -4,8 +4,8 @@ set ( SRC_FILES src/MDHistoToWorkspace2D.cpp src/PoldiAnalyseResiduals.cpp src/PoldiAutoCorrelation5.cpp - src/PoldiCalculateSpectrum2D.cpp src/PoldiFitPeaks1D.cpp + src/PoldiFitPeaks2D.cpp src/PoldiLoadChopperSlits.cpp src/PoldiLoadIPP.cpp src/PoldiLoadLog.cpp @@ -48,8 +48,8 @@ set ( INC_FILES inc/MantidSINQ/MDHistoToWorkspace2D.h inc/MantidSINQ/PoldiAnalyseResiduals.h inc/MantidSINQ/PoldiAutoCorrelation5.h - inc/MantidSINQ/PoldiCalculateSpectrum2D.h inc/MantidSINQ/PoldiFitPeaks1D.h + inc/MantidSINQ/PoldiFitPeaks2D.h inc/MantidSINQ/PoldiLoadChopperSlits.h inc/MantidSINQ/PoldiLoadIPP.h inc/MantidSINQ/PoldiLoadLog.h @@ -100,7 +100,6 @@ set ( TEST_FILES PoldiAnalyseResidualsTest.h PoldiAutoCorrelationCoreTest.h PoldiBasicChopperTest.h - PoldiCalculateSpectrum2DTest.h PoldiChopperFactoryTest.h PoldiConversionsTest.h PoldiDeadWireDecoratorTest.h @@ -109,6 +108,7 @@ set ( TEST_FILES PoldiDetectorFactoryTest.h PoldiDetectorTest.h PoldiFitPeaks1DTest.h + PoldiFitPeaks2DTest.h PoldiInstrumentAdapterTest.h PoldiPeakCollectionTest.h PoldiPeakSearchTest.h diff --git a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiCalculateSpectrum2D.h b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h similarity index 90% rename from Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiCalculateSpectrum2D.h rename to Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h index 6847906982c2444fce077b5b6a2085a8bc1ab71a..3c36869b4a088c3894294378a2b4dc37b61ea0eb 100644 --- a/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiCalculateSpectrum2D.h +++ b/Code/Mantid/Framework/SINQ/inc/MantidSINQ/PoldiFitPeaks2D.h @@ -15,12 +15,15 @@ namespace Mantid namespace Poldi { -/** PoldiCalculateSpectrum2D +/** PoldiFitPeaks2D - An Algorithm to calculate a POLDI 2D-spectrum from a given table containing POLDI + An Algorithm to fit a POLDI 2D-spectrum from a given table containing POLDI peak data. A MatrixWorkspace containing a proper POLDI instrument definition is required to determine output workspace dimensions etc. + In order to use the algorithm for calculating a theoretical spectrum, + the MaximumIterations property can be set to 0. + @author Michael Wedel, Paul Scherrer Institut - SINQ @date 16/05/2014 @@ -45,11 +48,11 @@ namespace Poldi Code Documentation is available at: <http://doxygen.mantidproject.org> */ -class MANTID_SINQ_DLL PoldiCalculateSpectrum2D : public API::Algorithm +class MANTID_SINQ_DLL PoldiFitPeaks2D : public API::Algorithm { public: - PoldiCalculateSpectrum2D(); - virtual ~PoldiCalculateSpectrum2D(); + PoldiFitPeaks2D(); + virtual ~PoldiFitPeaks2D(); virtual const std::string name() const; virtual int version() const; diff --git a/Code/Mantid/Framework/SINQ/src/PoldiCalculateSpectrum2D.cpp b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp similarity index 88% rename from Code/Mantid/Framework/SINQ/src/PoldiCalculateSpectrum2D.cpp rename to Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp index fb8248dd9633aca43705718453b98df4a9d8fe41..49f29b35dd64da0a77382f4a6c674272c47a6057 100644 --- a/Code/Mantid/Framework/SINQ/src/PoldiCalculateSpectrum2D.cpp +++ b/Code/Mantid/Framework/SINQ/src/PoldiFitPeaks2D.cpp @@ -2,7 +2,7 @@ TODO: Enter a full wiki-markup description of your algorithm here. You can then use the Build/wiki_maker.py script to generate your full wiki page. *WIKI*/ -#include "MantidSINQ/PoldiCalculateSpectrum2D.h" +#include "MantidSINQ/PoldiFitPeaks2D.h" #include "MantidDataObjects/Workspace2D.h" #include "MantidDataObjects/TableWorkspace.h" @@ -25,7 +25,7 @@ namespace Mantid namespace Poldi { // Register the algorithm into the AlgorithmFactory - DECLARE_ALGORITHM(PoldiCalculateSpectrum2D) + DECLARE_ALGORITHM(PoldiFitPeaks2D) using namespace API; using namespace Kernel; @@ -33,7 +33,7 @@ namespace Poldi /** Constructor */ - PoldiCalculateSpectrum2D::PoldiCalculateSpectrum2D(): + PoldiFitPeaks2D::PoldiFitPeaks2D(): Algorithm(), m_timeTransformer(), m_deltaT(0.0) @@ -42,27 +42,27 @@ namespace Poldi /** Destructor */ - PoldiCalculateSpectrum2D::~PoldiCalculateSpectrum2D() + PoldiFitPeaks2D::~PoldiFitPeaks2D() { } /// Algorithm's name for identification. @see Algorithm::name - const std::string PoldiCalculateSpectrum2D::name() const { return "PoldiCalculateSpectrum2D";} + const std::string PoldiFitPeaks2D::name() const { return "PoldiFitPeaks2D";} /// Algorithm's version for identification. @see Algorithm::version - int PoldiCalculateSpectrum2D::version() const { return 1;} + int PoldiFitPeaks2D::version() const { return 1;} /// Algorithm's category for identification. @see Algorithm::category - const std::string PoldiCalculateSpectrum2D::category() const { return "SINQ\\Poldi\\PoldiSet";} + const std::string PoldiFitPeaks2D::category() const { return "SINQ\\Poldi\\PoldiSet";} /// Very short algorithm summary. @see Algorith::summary - const std::string PoldiCalculateSpectrum2D::summary() const + const std::string PoldiFitPeaks2D::summary() const { return "Calculates a POLDI 2D-spectrum."; } /// Initialization of algorithm properties. - void PoldiCalculateSpectrum2D::init() + void PoldiFitPeaks2D::init() { declareProperty(new WorkspaceProperty<MatrixWorkspace>("InputWorkspace","",Direction::Input), "Measured POLDI 2D-spectrum."); declareProperty(new WorkspaceProperty<TableWorkspace>("PoldiPeakWorkspace", "", Direction::Input), "Table workspace with peak information."); @@ -90,7 +90,7 @@ namespace Poldi * @param Poldi2DFunction with one PoldiSpectrumDomainFunction per peak * @return PoldiPeakCollection containing peaks with normalized intensities */ - PoldiPeakCollection_sptr PoldiCalculateSpectrum2D::getPeakCollectionFromFunction(const IFunction_sptr &fitFunction) const + PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollectionFromFunction(const IFunction_sptr &fitFunction) const { boost::shared_ptr<Poldi2DFunction> poldi2DFunction = boost::dynamic_pointer_cast<Poldi2DFunction>(fitFunction); @@ -132,7 +132,7 @@ namespace Poldi * @param peakCollection :: PoldiPeakCollection containing peaks with integral intensities * @return Poldi2DFunction with one PoldiSpectrumDomainFunction per peak */ - boost::shared_ptr<Poldi2DFunction> PoldiCalculateSpectrum2D::getFunctionFromPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const + boost::shared_ptr<Poldi2DFunction> PoldiFitPeaks2D::getFunctionFromPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const { boost::shared_ptr<Poldi2DFunction> mdFunction(new Poldi2DFunction); @@ -151,7 +151,7 @@ namespace Poldi } /// Executes the algorithm - void PoldiCalculateSpectrum2D::exec() + void PoldiFitPeaks2D::exec() { TableWorkspace_sptr peakTable = getProperty("PoldiPeakWorkspace"); if(!peakTable) { @@ -189,7 +189,7 @@ namespace Poldi * * @param poldi2DFunction :: Poldi2DFunction to which the background is added. */ - void PoldiCalculateSpectrum2D::addBackgroundTerms(boost::shared_ptr<Poldi2DFunction> poldi2DFunction) const + void PoldiFitPeaks2D::addBackgroundTerms(boost::shared_ptr<Poldi2DFunction> poldi2DFunction) const { bool addConstantBackground = getProperty("FitConstantBackground"); if(addConstantBackground) { @@ -217,7 +217,7 @@ namespace Poldi * @param matrixWorkspace :: MatrixWorkspace with POLDI instrument and correct dimensions * @return Instance of Fit-algorithm, after execution */ - IAlgorithm_sptr PoldiCalculateSpectrum2D::calculateSpectrum(const PoldiPeakCollection_sptr &peakCollection, const MatrixWorkspace_sptr &matrixWorkspace) + IAlgorithm_sptr PoldiFitPeaks2D::calculateSpectrum(const PoldiPeakCollection_sptr &peakCollection, const MatrixWorkspace_sptr &matrixWorkspace) { PoldiPeakCollection_sptr integratedPeaks = getIntegratedPeakCollection(peakCollection); PoldiPeakCollection_sptr normalizedPeakCollection = getNormalizedPeakCollection(integratedPeaks); @@ -247,7 +247,7 @@ namespace Poldi } /// Returns the output workspace stored in the Fit algorithm. - MatrixWorkspace_sptr PoldiCalculateSpectrum2D::getWorkspace(const IAlgorithm_sptr &fitAlgorithm) const + MatrixWorkspace_sptr PoldiFitPeaks2D::getWorkspace(const IAlgorithm_sptr &fitAlgorithm) const { if(!fitAlgorithm) { throw std::invalid_argument("Cannot extract workspace from null-algorithm."); @@ -257,7 +257,7 @@ namespace Poldi return outputWorkspace; } - IFunction_sptr PoldiCalculateSpectrum2D::getFunction(const IAlgorithm_sptr &fitAlgorithm) const + IFunction_sptr PoldiFitPeaks2D::getFunction(const IAlgorithm_sptr &fitAlgorithm) const { if(!fitAlgorithm) { throw std::invalid_argument("Cannot extract function from null-algorithm."); @@ -272,7 +272,7 @@ namespace Poldi * * @param poldiInstrument :: PoldiInstrumentAdapter with valid components */ - void PoldiCalculateSpectrum2D::setTimeTransformerFromInstrument(const PoldiInstrumentAdapter_sptr &poldiInstrument) + void PoldiFitPeaks2D::setTimeTransformerFromInstrument(const PoldiInstrumentAdapter_sptr &poldiInstrument) { setTimeTransformer(boost::make_shared<PoldiTimeTransformer>(poldiInstrument)); } @@ -282,7 +282,7 @@ namespace Poldi * * @param poldiTimeTransformer */ - void PoldiCalculateSpectrum2D::setTimeTransformer(const PoldiTimeTransformer_sptr &poldiTimeTransformer) + void PoldiFitPeaks2D::setTimeTransformer(const PoldiTimeTransformer_sptr &poldiTimeTransformer) { m_timeTransformer = poldiTimeTransformer; } @@ -296,7 +296,7 @@ namespace Poldi * * @param matrixWorkspace :: MatrixWorkspace with at least one spectrum with at least two x-values. */ - void PoldiCalculateSpectrum2D::setDeltaTFromWorkspace(const MatrixWorkspace_sptr &matrixWorkspace) + void PoldiFitPeaks2D::setDeltaTFromWorkspace(const MatrixWorkspace_sptr &matrixWorkspace) { if(matrixWorkspace->getNumberHistograms() < 1) { throw std::invalid_argument("MatrixWorkspace does not contain any data."); @@ -317,7 +317,7 @@ namespace Poldi * * @param newDeltaT :: Value to be used as delta t for calculations. */ - void PoldiCalculateSpectrum2D::setDeltaT(double newDeltaT) + void PoldiFitPeaks2D::setDeltaT(double newDeltaT) { if(!isValidDeltaT(newDeltaT)) { throw std::invalid_argument("Time bin size must be larger than 0."); @@ -332,7 +332,7 @@ namespace Poldi * @param deltaT :: Value to be checked for validity as a time difference. * @return True if delta t is larger than 0, otherwise false. */ - bool PoldiCalculateSpectrum2D::isValidDeltaT(double deltaT) const + bool PoldiFitPeaks2D::isValidDeltaT(double deltaT) const { return deltaT > 0.0; } @@ -343,7 +343,7 @@ namespace Poldi * @param peakTable :: TableWorkspace with POLDI peak data. * @return PoldiPeakCollection with the data from the table workspace. */ - PoldiPeakCollection_sptr PoldiCalculateSpectrum2D::getPeakCollection(const TableWorkspace_sptr &peakTable) const + PoldiPeakCollection_sptr PoldiFitPeaks2D::getPeakCollection(const TableWorkspace_sptr &peakTable) const { try { return boost::make_shared<PoldiPeakCollection>(peakTable); @@ -366,7 +366,7 @@ namespace Poldi * @param rawPeakCollection :: PoldiPeakCollection * @return PoldiPeakCollection with integrated intensities */ - PoldiPeakCollection_sptr PoldiCalculateSpectrum2D::getIntegratedPeakCollection(const PoldiPeakCollection_sptr &rawPeakCollection) const + PoldiPeakCollection_sptr PoldiFitPeaks2D::getIntegratedPeakCollection(const PoldiPeakCollection_sptr &rawPeakCollection) const { if(!rawPeakCollection) { throw std::invalid_argument("Cannot proceed with invalid PoldiPeakCollection."); @@ -445,7 +445,7 @@ namespace Poldi * @param peakCollection :: PoldiPeakCollection with integrated intensities * @return PoldiPeakCollection with normalized intensities */ - PoldiPeakCollection_sptr PoldiCalculateSpectrum2D::getNormalizedPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const + PoldiPeakCollection_sptr PoldiFitPeaks2D::getNormalizedPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const { if(!peakCollection) { throw std::invalid_argument("Cannot proceed with invalid PoldiPeakCollection."); @@ -480,7 +480,7 @@ namespace Poldi * @param peakCollection :: PoldiPeakCollection with normalized intensities * @return PoldiPeakCollection with integral intensities */ - PoldiPeakCollection_sptr PoldiCalculateSpectrum2D::getCountPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const + PoldiPeakCollection_sptr PoldiFitPeaks2D::getCountPeakCollection(const PoldiPeakCollection_sptr &peakCollection) const { if(!peakCollection) { throw std::invalid_argument("Cannot proceed with invalid PoldiPeakCollection."); diff --git a/Code/Mantid/Framework/SINQ/test/PoldiCalculateSpectrum2DTest.h b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks2DTest.h similarity index 89% rename from Code/Mantid/Framework/SINQ/test/PoldiCalculateSpectrum2DTest.h rename to Code/Mantid/Framework/SINQ/test/PoldiFitPeaks2DTest.h index 8137f6211bf292e2c418f40136cd0cfa136ce327..6a815399e443f28787ce76340f35011ef615e1f3 100644 --- a/Code/Mantid/Framework/SINQ/test/PoldiCalculateSpectrum2DTest.h +++ b/Code/Mantid/Framework/SINQ/test/PoldiFitPeaks2DTest.h @@ -6,7 +6,7 @@ #include "MantidAPI/FrameworkManager.h" #include "MantidAPI/AlgorithmManager.h" -#include "MantidSINQ/PoldiCalculateSpectrum2D.h" +#include "MantidSINQ/PoldiFitPeaks2D.h" #include "MantidSINQ/PoldiUtilities/PoldiMockInstrumentHelpers.h" #include "MantidTestHelpers/WorkspaceCreationHelper.h" @@ -14,15 +14,15 @@ using namespace Mantid::Poldi; using namespace Mantid::API; using namespace Mantid::DataObjects; -class PoldiCalculateSpectrum2DTest : public CxxTest::TestSuite +class PoldiFitPeaks2DTest : public CxxTest::TestSuite { public: // This pair of boilerplate methods prevent the suite being created statically // This means the constructor isn't called when running other tests - static PoldiCalculateSpectrum2DTest *createSuite() { return new PoldiCalculateSpectrum2DTest(); } - static void destroySuite( PoldiCalculateSpectrum2DTest *suite ) { delete suite; } + static PoldiFitPeaks2DTest *createSuite() { return new PoldiFitPeaks2DTest(); } + static void destroySuite( PoldiFitPeaks2DTest *suite ) { delete suite; } - PoldiCalculateSpectrum2DTest() + PoldiFitPeaks2DTest() { FrameworkManager::Instance(); @@ -32,7 +32,7 @@ public: void testSetTimeTransformer() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; spectrumCalculator.setTimeTransformer(m_timeTransformer); TS_ASSERT_EQUALS(spectrumCalculator.m_timeTransformer, m_timeTransformer); @@ -40,7 +40,7 @@ public: void testSetTimeTransformerFromInstrument() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; spectrumCalculator.setTimeTransformerFromInstrument(m_instrument); TS_ASSERT(spectrumCalculator.m_timeTransformer); @@ -48,7 +48,7 @@ public: void testSetDeltaT() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; TS_ASSERT_THROWS_NOTHING(spectrumCalculator.setDeltaT(2.0)); TS_ASSERT_EQUALS(spectrumCalculator.m_deltaT, 2.0); @@ -63,7 +63,7 @@ public: ws->dataX(0)[i] = static_cast<double>(i); } - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; spectrumCalculator.setDeltaTFromWorkspace(ws); TS_ASSERT_EQUALS(spectrumCalculator.m_deltaT, 1.0); @@ -73,7 +73,7 @@ public: void testIsValidDeltaT() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; TS_ASSERT_EQUALS(spectrumCalculator.isValidDeltaT(1.0), true); TS_ASSERT_EQUALS(spectrumCalculator.isValidDeltaT(0.0), false); TS_ASSERT_EQUALS(spectrumCalculator.isValidDeltaT(-1.0), false); @@ -81,7 +81,7 @@ public: void testGetPeakCollection() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; TableWorkspace_sptr peakTable = PoldiPeakCollectionHelpers::createPoldiPeakTableWorkspace(); TS_ASSERT_THROWS_NOTHING(spectrumCalculator.getPeakCollection(peakTable)); @@ -94,7 +94,7 @@ public: { PoldiPeakCollection_sptr testPeaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionMaximum(); - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; // deltaT is not set, so this must fail TS_ASSERT_THROWS(spectrumCalculator.getIntegratedPeakCollection(testPeaks), std::invalid_argument); spectrumCalculator.setDeltaT(3.0); @@ -138,7 +138,7 @@ public: void testGetNormalizedPeakCollection() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; // first, test the failing cases PoldiPeakCollection_sptr invalidPeakCollection; @@ -162,7 +162,7 @@ public: void testGetCountPeakCollection() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; // first, test the failing cases PoldiPeakCollection_sptr invalidPeakCollection; @@ -187,7 +187,7 @@ public: void testGetFunctionFromPeakCollection() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; PoldiPeakCollection_sptr peaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionNormalized(); boost::shared_ptr<Poldi2DFunction> poldi2DFunction = spectrumCalculator.getFunctionFromPeakCollection(peaks); @@ -204,7 +204,7 @@ public: void testGetPeakCollectionFromFunction() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; PoldiPeakCollection_sptr peaks = PoldiPeakCollectionHelpers::createPoldiPeakCollectionNormalized(); IFunction_sptr poldi2DFunction = spectrumCalculator.getFunctionFromPeakCollection(peaks); @@ -224,7 +224,7 @@ public: void testAddBackgroundFunctions() { - TestablePoldiCalculateSpectrum2D spectrumCalculator; + TestablePoldiFitPeaks2D spectrumCalculator; spectrumCalculator.initialize(); boost::shared_ptr<Poldi2DFunction> funDefault(new Poldi2DFunction); @@ -274,12 +274,12 @@ private: } } - class TestablePoldiCalculateSpectrum2D : public PoldiCalculateSpectrum2D + class TestablePoldiFitPeaks2D : public PoldiFitPeaks2D { - friend class PoldiCalculateSpectrum2DTest; + friend class PoldiFitPeaks2DTest; public: - TestablePoldiCalculateSpectrum2D() : PoldiCalculateSpectrum2D() { } - ~TestablePoldiCalculateSpectrum2D() { } + TestablePoldiFitPeaks2D() : PoldiFitPeaks2D() { } + ~TestablePoldiFitPeaks2D() { } }; }; diff --git a/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst similarity index 80% rename from Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst rename to Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst index 87a2cb348b96b7d6ef0b2d5ee9a2d6d1f9ef4491..b5fd5fbb2f32d58efa2f6189c5cbefe6f2691885 100644 --- a/Code/Mantid/docs/source/algorithms/PoldiCalculateSpectrum2D-v1.rst +++ b/Code/Mantid/docs/source/algorithms/PoldiFitPeaks2D-v1.rst @@ -9,18 +9,20 @@ Description ----------- -PoldiCalculateSpectrum2D is a preliminary algorithm that can be used to calculate 2D POLDI-data from a set of peaks. These must come in a table of special format, which may be generated for example by :ref:`algm-PoldiFitPeaks1D`. Furthermore, the algorithm needs a MatrixWorkspace containing raw POLDI data with correct dimensions and a proper instrument definition. +PoldiFitPeaks2D is an algorithm that can be used to fit a set of individual peaks to 2D POLDI-data. These must come in a table of special format, which may be generated for example by :ref:`algm-PoldiFitPeaks1D`. Furthermore, the algorithm needs a MatrixWorkspace containing raw POLDI data with correct dimensions and a proper instrument definition. The 1D-peak intensities need to be integral intensities, so the peaks are integrated if necessary. If there is no profile information supplied in the peak table (:ref:`algm-PoldiFitPeaks1D` adds this automatically), it's possible to supply a profile function as parameter to this algorithm. If a profile function name is present in the peak table, the one supplied in the parameters has priority. -At the moment all profiles are calculated independently, using Gaussian functions. In future versions of the algorithm this will be much more flexible, including background functions. +At the moment all profiles are calculated independently, using Gaussian functions. In future versions of the algorithm this will be much more flexible. + +PoldiFitPeaks2D can also be used to calculate a theoretical 2D pattern from a set of peaks by limiting the iterations to 0. Usage ----- .. include:: ../usagedata-note.txt -PoldiAutoCorrelation operates on a MatrixWorkspace with a valid POLDI instrument definition. The following short example demonstrates how to use the algorithm, processing data obtained from recording the spectrum of a Silicon standard material (powder). +PoldiFitPeaks2D operates on a MatrixWorkspace with a valid POLDI instrument definition. The following short example demonstrates how to use the algorithm, processing data obtained from recording the spectrum of a Silicon standard material (powder) and calculating a theoretical 2D-spectrum. .. testcode:: ExSilicon2D @@ -42,7 +44,7 @@ PoldiAutoCorrelation operates on a MatrixWorkspace with a valid POLDI instrument FitPlotsWorkspace = "fit_plots_6904") # Calculate a 2D spectrum using the refined peaks - PoldiCalculateSpectrum2D(InputWorkspace=truncated_6904, + PoldiFitPeaks2D(InputWorkspace=truncated_6904, PoldiPeakWorkspace="peaks_refined_6904", OutputWorkspace="simulated_6904") @@ -77,7 +79,7 @@ In general, there is a background in POLDI data that depends on :math:`2\theta`. FitPlotsWorkspace = "fit_plots_6904") # Calculate a 2D spectrum using the refined peaks - with background linear in 2theta - PoldiCalculateSpectrum2D(InputWorkspace=truncated_6904, + PoldiFitPeaks2D(InputWorkspace=truncated_6904, PoldiPeakWorkspace="peaks_refined_6904", OutputWorkspace="simulated_6904", LinearBackgroundParameter=0.01)