Skip to content

Commit

Permalink
Documentation and test. Refs #10698
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Dec 11, 2014
1 parent 9e8bb4d commit 9520934
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 40 deletions.
40 changes: 1 addition & 39 deletions Code/Mantid/Framework/MDAlgorithms/test/MDNormDirectSCTest.h
Expand Up @@ -32,19 +32,13 @@ class MDNormDirectSCTest : public CxxTest::TestSuite
{
std::string mdWsName = "__temp_InputMDWorkspaceName";
createMDWorkspace(mdWsName);
std::string fluxGoodWsName = "__temp_InputGoodFluxWorkspaceName";
createGoodFluxWorkspace(fluxGoodWsName);
std::string fluxBadWsName = "__temp_InputBadFluxWorkspaceName";
createBadFluxWorkspace(fluxBadWsName);
std::string saWsName = "__temp_InputSAWorkspaceName";
createBadFluxWorkspace(saWsName);
createSolidAngleWorkspace(saWsName);

MDNormDirectSC alg;
TS_ASSERT_THROWS_NOTHING( alg.initialize() )
TS_ASSERT( alg.isInitialized() )
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("InputWorkspace", mdWsName) );
TS_ASSERT_THROWS_NOTHING( alg.setProperty("FluxWorkspace", fluxGoodWsName) );
TS_ASSERT_THROWS_NOTHING( alg.setProperty("FluxWorkspace", fluxBadWsName) ); // it isn't bad any more
TS_ASSERT_THROWS_NOTHING( alg.setProperty("SolidAngleWorkspace", saWsName) );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputWorkspace", "OutWSName") );
TS_ASSERT_THROWS_NOTHING( alg.setPropertyValue("OutputNormalizationWorkspace", "OutNormWSName") );
Expand Down Expand Up @@ -75,38 +69,6 @@ class MDNormDirectSCTest : public CxxTest::TestSuite

}

void createGoodFluxWorkspace(const std::string& wsName)
{
auto flux = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument( 2, 10 );
auto &x = flux->dataX(0);
auto &y1 = flux->dataY(1);

for(size_t i = 0; i < y1.size(); ++i)
{
y1[i] = 2 * x[i];
}
flux->setX(1,x);
flux->getAxis(0)->setUnit("Momentum");

AnalysisDataService::Instance().addOrReplace( wsName, flux );
}

void createBadFluxWorkspace(const std::string& wsName)
{
auto flux = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument( 2, 10 );
auto &x = flux->dataX(0);
auto &y1 = flux->dataY(1);

for(size_t i = 0; i < y1.size(); ++i)
{
y1[i] = -2 * x[i];
}
flux->setX(1,x);
flux->getAxis(0)->setUnit("Momentum");

AnalysisDataService::Instance().addOrReplace( wsName, flux );
}

void createSolidAngleWorkspace(const std::string& wsName)
{
auto sa = WorkspaceCreationHelper::create2DWorkspaceWithFullInstrument( 2, 10 );
Expand Down
37 changes: 37 additions & 0 deletions Code/Mantid/docs/source/algorithms/MDNormDirectSC-v1.rst
@@ -0,0 +1,37 @@

.. algorithm::

.. summary::

.. alias::

.. properties::

Description
-----------

The algorithm calculates a normalization MD workspace for single crystal direct geometry inelastic experiments.
Trajectories of each detector in reciprocal space are calculated, and the flux is integrated between intersections with each
MDBox.


Usage
-----
.. Try not to use files in your examples,
but if you cannot avoid it then the (small) files must be added to
autotestdata\UsageData and the following tag unindented
.. include:: ../usagedata-note.txt
**Example - MDNormDirectSC**

.. testcode:: MDNormDirectSCExample



.. testoutput:: MDNormDirectSCExample




.. categories::

2 changes: 1 addition & 1 deletion Code/Mantid/docs/source/algorithms/MDNormSCD-v1.rst
Expand Up @@ -81,7 +81,7 @@ Usage
except:
pass

.. testoutput:: SCDMDNormExample
.. testoutput:: MDNormSCDExample



Expand Down

0 comments on commit 9520934

Please sign in to comment.