Commit 94239320 authored by Zhang, Chen's avatar Zhang, Chen
Browse files

address review feedback

parent 7b7a7d8e
......@@ -20,18 +20,16 @@ public:
CalculatePlaczekSelfScattering2() : API::Algorithm() {}
virtual const std::string name() const override { return "CalculatePlaczekSelfScattering"; }
virtual int version() const override { return (2); }
const std::vector<std::string> seeAlso() const override { return {"FitIncidentSpectrum"}; }
const std::vector<std::string> seeAlso() const override { return {"FitIncidentSpectrum", "CalculatePlaczek"}; }
const std::string category() const override { return "CorrectionFunctions"; };
const std::string summary() const override {
return "Calculates the Placzek self scattering correction of an incident "
"spectrum";
};
std::map<std::string, std::string> validateInputs() override;
private:
void init() override;
void exec() override;
double getPackingFraction(const API::MatrixWorkspace_const_sptr &ws);
};
} // namespace Algorithms
......
......@@ -9,14 +9,18 @@
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/Axis.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidAPI/InstrumentValidator.h"
#include "MantidAPI/Run.h"
#include "MantidAPI/Sample.h"
#include "MantidAPI/SampleValidator.h"
#include "MantidAPI/SpectrumInfo.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidAPI/WorkspaceUnitValidator.h"
#include "MantidDataObjects/Workspace2D.h"
#include "MantidDataObjects/WorkspaceCreation.h"
#include "MantidKernel/Atom.h"
#include "MantidKernel/BoundedValidator.h"
#include "MantidKernel/CompositeValidator.h"
#include "MantidKernel/Material.h"
#include "MantidKernel/PhysicalConstants.h"
#include "MantidKernel/Unit.h"
......@@ -28,6 +32,8 @@ namespace Algorithms {
using Mantid::API::WorkspaceProperty;
using Mantid::Kernel::Direction;
using PhysicalConstants::BoltzmannConstant;
using PhysicalConstants::E_mev_toNeutronWavenumberSq; // in [meV*Angstrom^2]
namespace { // anonymous namespace
......@@ -50,9 +56,6 @@ double calculateSummationTerm(const Kernel::Material &material) {
return neutronMass * unnormalizedTerm / (4. * M_PI * totalStoich);
}
const double k_B = PhysicalConstants::BoltzmannConstant; // in meV/K
const double E_mev_toNeutronWavenumberSq = PhysicalConstants::E_mev_toNeutronWavenumberSq; // in [meV*Angstrom^2]
} // anonymous namespace
// Register the algorithm into the AlgorithmFactory
......@@ -85,40 +88,50 @@ const std::vector<std::string> CalculatePlaczek::seeAlso() const {
*/
void CalculatePlaczek::init() {
// Mandatory properties
declareProperty(
std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("InputWorkspace", "", Kernel::Direction::Input),
"Raw diffraction data workspace for associated correction to be "
"calculated for. Workspace must have instrument and sample data.");
declareProperty(
std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("IncidentSpectra", "", Kernel::Direction::Input),
"Workspace of fitted incident spectrum with its derivatives (1st &| 2nd).");
// 1. Input workspace should have
// - a valid instrument
// - a sample with chemical formula
auto wsValidator = std::make_shared<Mantid::Kernel::CompositeValidator>();
wsValidator->add<Mantid::API::InstrumentValidator>();
wsValidator->add<Mantid::API::SampleValidator, unsigned int>(Mantid::API::SampleValidator::Material);
declareProperty(std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("InputWorkspace", "",
Kernel::Direction::Input, wsValidator),
"Raw diffraction data workspace for associated correction to be "
"calculated for. Workspace must have instrument and sample data.");
// 2. Incident spectra should have a unit of wavelength
auto inspValidator = std::make_shared<Mantid::Kernel::CompositeValidator>();
inspValidator->add<Mantid::API::WorkspaceUnitValidator>("Wavelength");
declareProperty(std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>(
"IncidentSpectra", "", Kernel::Direction::Input, inspValidator),
"Workspace of fitted incident spectrum with its derivatives (1st &| 2nd).");
// Optional properties
declareProperty(std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>(
"EfficiencySpectra", "", Kernel::Direction::Input, API::PropertyMode::Optional),
"Workspace of efficiency spectrum with its derivatives (1st &| 2nd)."
"Default to use the build-in efficiency profile for He3 tube if not provided.");
"Default (not specified) will use LambdaD to calculate the efficiency spectrum.");
auto lambdadValidator = std::make_shared<Kernel::BoundedValidator<double>>();
lambdadValidator->setExclusive(true);
lambdadValidator->setLower(0.0);
declareProperty("LambdaD", 1.44, lambdadValidator,
"Reference wavelength in Angstrom, related to detector efficient coefficient alpha."
"The coefficient used to generate a generic detector efficiency curve,"
"eps = 1 - exp(1 - alpha*lambda), where alpha is 1/LambdaD."
"Defult is set to 1.44 for 3He detectors and 1/0.83 for scintillator detectors.");
declareProperty(
"LambdaD", 1.44, lambdadValidator,
"Reference wavelength in Angstrom, related to detector efficient coefficient alpha."
"The coefficient used to generate a generic detector efficiency curve,"
"eps = 1 - exp(1 - alpha*lambda), where alpha is 1/LambdaD."
"Default is set to 1.44 for ISIS 3He detectors and 1/0.83 for ISIS:LAD circa 1990 scintillator detectors.");
declareProperty("CrystalDensity", EMPTY_DBL(), "The crystalographic density of the sample material.");
auto orderValidator = std::make_shared<Kernel::BoundedValidator<int>>(1, 2);
declareProperty("Order", 1, orderValidator, "Placzek correction order (1 or 2), default to 1 (self scattering).");
declareProperty("SampleTemperature", EMPTY_DBL(),
"Sample temperature in Kelvin."
"The input properties is prioritized over the temperature recorded in the sample log."
"The input property is prioritized over the temperature recorded in the sample log."
"The temperature is necessary for computing second order correction.");
declareProperty("ScaleByPackingFraction", true, "Scale the correction value by packing fraction.");
// Output property
declareProperty(
std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("OutputWorkspace", "", Kernel::Direction::Output),
"Workspace with the Self scattering correction");
"Workspace with the Placzek scattering correction factors.");
}
//----------------------------------------------------------------------------------------------
......@@ -138,13 +151,7 @@ std::map<std::string, std::string> CalculatePlaczek::validateInputs() {
issues["InputWorkspace"] = "Input workspace does not have detector information";
}
// Case1: missing sample
Kernel::Material::ChemicalFormula formula = inWS->sample().getMaterial().chemicalFormula();
if (formula.size() == 0) {
issues["InputWorkspace"] = "Input workspace does not have a valid sample.";
}
// Case2: cannot locate sample temperature
// Case1: cannot locate sample temperature
if (isDefault("SampleTemperature") && (order == 2)) {
const auto run = inWS->run();
const auto sampleTempLogORNL = run.getLogData("SampleTemp");
......@@ -154,12 +161,69 @@ std::map<std::string, std::string> CalculatePlaczek::validateInputs() {
}
}
// Case3: missing second order derivate of the flux spectrum (incident spectrum)
// Case2: check number of spectra in flux workspace match required order
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const int64_t numHist = incidentWS->spectrumInfo().size();
if (order == 2) {
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const MantidVec incidentPrime2 = incidentWS->readY(2);
if (incidentPrime2.empty()) {
issues["IncidentSpectra"] = "Input workspace does not have second order derivate of the incident spectrum";
// we need three spectra here
if (numHist < 3) {
issues["IncidentSpectra"] = "Need three spectra here for second order calculation.";
}
// make sure all are not empty
if (incidentWS->readY(0).empty()) {
issues["IncidentSpectra"] = "Flux is empty";
}
if (incidentWS->readY(1).empty()) {
issues["IncidentSpectra"] = "First order derivate of the incident spectrum is empty";
}
if (incidentWS->readY(2).empty()) {
issues["IncidentSpectra"] = "Second order derivate of the incident spectrum is empty";
}
} else {
// we are at first order here
if (numHist < 2) {
issues["IncidentSpectra"] = "Need two spectra here for first order calculation.";
}
// make sure all are not empty
if (incidentWS->readY(0).empty()) {
issues["IncidentSpectra"] = "Flux is empty";
}
if (incidentWS->readY(1).empty()) {
issues["IncidentSpectra"] = "First order derivate of the incident spectrum is empty";
}
}
// Case3: check number of spectra in efficiency workspace match required order IF provided
const API::MatrixWorkspace_sptr efficiencyWS = getProperty("EfficiencySpectra");
if (efficiencyWS) {
const int64_t numHistEff = efficiencyWS->spectrumInfo().size();
if (order == 2) {
// we need three spectra here
if (numHistEff < 3) {
issues["EfficiencySpectra"] = "Need three spectra here for second order calculation.";
}
// make sure all are not empty
if (efficiencyWS->readY(0).empty()) {
issues["EfficiencySpectra"] = "Detector efficiency is empty";
}
if (efficiencyWS->readY(1).empty()) {
issues["EfficiencySpectra"] = "First order derivate of the efficiency spectrum is empty";
}
if (efficiencyWS->readY(2).empty()) {
issues["EfficiencySpectra"] = "Second order derivate of the efficiency spectrum is empty";
}
} else {
// we are at first order here
if (numHistEff < 2) {
issues["EfficiencySpectra"] = "Need two spectra here for first order calculation.";
}
// make sure all are not empty
if (efficiencyWS->readY(0).empty()) {
issues["EfficiencySpectra"] = "Detector efficiency is empty";
}
if (efficiencyWS->readY(1).empty()) {
issues["EfficiencySpectra"] = "First order derivate of the efficiency spectrum is empty";
}
}
}
......@@ -227,8 +291,9 @@ void CalculatePlaczek::exec() {
// loop over all spectra
const API::SpectrumInfo specInfo = inWS->spectrumInfo();
const int64_t numHist = specInfo.size();
PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS))
for (size_t specIndex = 0; specIndex < specInfo.size(); specIndex++) {
for (int64_t specIndex = 0; specIndex < numHist; specIndex++) {
PARALLEL_START_INTERUPT_REGION
auto &y = outputWS->mutableY(specIndex); // x-axis is directly copied from incident flux
// only perform calculation for components that
......@@ -252,7 +317,7 @@ void CalculatePlaczek::exec() {
const double sinThetaBy2 = sin(twoTheta / 2.0);
const double f = l1 / (l1 + l2);
wavelength.initialize(specInfo.l1(), 0, pmap);
const double kBT = k_B * sampleTemperature; // k_B in meV / K, T in K -> kBT in meV
const double kBT = BoltzmannConstant * sampleTemperature; // BoltzmannConstant in meV / K, T in K -> kBT in meV
// - convenience variables
const double sinHalfAngleSq = sinThetaBy2 * sinThetaBy2;
// - loop over all lambda
......@@ -379,8 +444,8 @@ std::vector<double> CalculatePlaczek::getFluxCoefficient1() {
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const auto xLambda = incidentWS->getSpectrum(0).points();
const MantidVec incident = incidentWS->readY(0);
const MantidVec incidentPrime = incidentWS->readY(1);
const auto &incident = incidentWS->readY(0);
const auto &incidentPrime = incidentWS->readY(1);
// phi1 = lambda * phi'(lambda)/phi(lambda)
for (size_t i = 0; i < xLambda.size(); i++) {
phi1.emplace_back(xLambda[i] * incidentPrime[i] / incident[i]);
......@@ -399,8 +464,8 @@ std::vector<double> CalculatePlaczek::getFluxCoefficient2() {
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const auto xLambda = incidentWS->getSpectrum(0).points();
const MantidVec incident = incidentWS->readY(0);
const MantidVec incidentPrime2 = incidentWS->readY(2);
const auto &incident = incidentWS->readY(0);
const auto &incidentPrime2 = incidentWS->readY(2);
// phi2 = lambda^2 * phi''(lambda)/phi(lambda)
for (size_t i = 0; i < xLambda.size(); i++) {
phi2.emplace_back(xLambda[i] * xLambda[i] * incidentPrime2[i] / incident[i]);
......@@ -421,7 +486,6 @@ std::vector<double> CalculatePlaczek::getEfficiencyCoefficient1() {
// NOTE: we need the xlambda here to
// - compute the coefficient based on an assumed efficiency curve
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const MantidVec incident = incidentWS->readY(0);
const auto xLambda = incidentWS->getSpectrum(0).points();
const API::MatrixWorkspace_sptr efficiencyWS = getProperty("EfficiencySpectra");
if (efficiencyWS) {
......@@ -439,9 +503,9 @@ std::vector<double> CalculatePlaczek::getEfficiencyCoefficient1() {
} else {
// This is based on an assume efficiency curve from
const double LambdaD = getProperty("LambdaD");
for (size_t i = 0; i < xLambda.size(); i++) {
const auto xTerm = -xLambda[i] / LambdaD;
eps1.emplace_back(xTerm * exp(xTerm) / (1.0 - exp(xTerm)));
for (auto x : xLambda) {
x /= -LambdaD;
eps1.emplace_back(x * exp(x) / (1.0 - exp(-x)));
}
}
return eps1;
......@@ -459,7 +523,6 @@ std::vector<double> CalculatePlaczek::getEfficiencyCoefficient2() {
// NOTE: we need the xlambda here to
// - compute the coefficient based on an assumed efficiency curve
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpectra");
const MantidVec incident = incidentWS->readY(0);
const auto xLambda = incidentWS->getSpectrum(0).points();
const API::MatrixWorkspace_sptr efficiencyWS = getProperty("EfficiencySpectra");
......@@ -483,10 +546,10 @@ std::vector<double> CalculatePlaczek::getEfficiencyCoefficient2() {
// The detector efficiency coefficient is denoted with F1 and _2F in the paper instead of the eps1 and eps2
// used in the code.
const double LambdaD = getProperty("LambdaD");
for (size_t i = 0; i < xLambda.size(); i++) {
const auto xTerm = -xLambda[i] / LambdaD;
double eps1 = xTerm * exp(xTerm) / (1.0 - exp(xTerm));
eps2.emplace_back((-xTerm - 2) * eps1);
for (auto x : xLambda) {
x /= -LambdaD;
double eps1 = x * exp(x) / (1.0 - exp(-x));
eps2.emplace_back((-x - 2.0) * eps1);
}
}
return eps2;
......
......@@ -29,7 +29,7 @@ void CalculatePlaczekSelfScattering2::init() {
declareProperty(
std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("InputWorkspace", "", Kernel::Direction::Input),
"Raw diffraction data workspace for associated correction to be "
"calculated for. Workspace must have instument and sample data.");
"calculated for. Workspace must have instrument and sample data.");
declareProperty(
std::make_unique<API::WorkspaceProperty<API::MatrixWorkspace>>("IncidentSpecta", "", Kernel::Direction::Input),
"Workspace of fitted incident spectrum with it's first derivative.");
......@@ -38,40 +38,6 @@ void CalculatePlaczekSelfScattering2::init() {
"Workspace with the Self scattering correction");
declareProperty("CrystalDensity", EMPTY_DBL(), "The crystalographic density of the sample material.");
}
//----------------------------------------------------------------------------------------------
/** Validate inputs.
*/
std::map<std::string, std::string> CalculatePlaczekSelfScattering2::validateInputs() {
std::map<std::string, std::string> issues;
const API::MatrixWorkspace_sptr inWS = getProperty("InputWorkspace");
const API::SpectrumInfo specInfo = inWS->spectrumInfo();
if (specInfo.size() == 0) {
issues["InputWorkspace"] = "Input workspace does not have detector information";
}
Kernel::Material::ChemicalFormula formula = inWS->sample().getMaterial().chemicalFormula();
if (formula.size() == 0) {
issues["InputWorkspace"] = "Input workspace does not have a valid sample";
}
return issues;
}
//----------------------------------------------------------------------------------------------
double CalculatePlaczekSelfScattering2::getPackingFraction(const API::MatrixWorkspace_const_sptr &ws) {
// get a handle to the material
const auto &material = ws->sample().getMaterial();
// default value is packing fraction
double packingFraction = material.packingFraction();
// see if the user thinks the material wasn't setup right
const double crystalDensity = getProperty("CrystalDensity");
if (crystalDensity > 0.) {
// assume that the number density set in the Material is the effective number density
packingFraction = material.numberDensity() / crystalDensity;
}
return packingFraction;
}
//----------------------------------------------------------------------------------------------
/** Execute the algorithm.
......@@ -80,19 +46,27 @@ void CalculatePlaczekSelfScattering2::exec() {
const API::MatrixWorkspace_sptr inWS = getProperty("InputWorkspace");
const API::MatrixWorkspace_sptr incidentWS = getProperty("IncidentSpecta");
CalculatePlaczek alg;
alg.initialize();
if (alg.isInitialized()) {
alg.setProperty("IncidentSpectra", incidentWS);
alg.setProperty("InputWorkspace", inWS);
alg.setProperty("OutputWorkspace", "correction_ws");
alg.execute();
API::MatrixWorkspace_sptr outputWS = alg.getProperty("OutputWorkspace");
setProperty("OutputWorkspace", outputWS);
} else {
g_log.error() << "CalculatePlaczek failed to initialize, aborting CalculatePlaczekSelfScattering";
auto alg = createChildAlgorithm("CalculatePlaczek");
alg->setProperty("IncidentSpectra", incidentWS);
alg->setProperty("InputWorkspace", inWS);
alg->setProperty("Order", 1); // default order is one, just being explicit here
alg->execute();
API::MatrixWorkspace_sptr outputWS = alg->getProperty("OutputWorkspace");
if (!bool(outputWS)) {
throw std::runtime_error("Failed to get the outputworkspace");
}
// NOTE: the original version forces the output to be in TOF instead of matching the
// input. Therefore, we need to mimic that behaviour here by explicitly converting
// the unit of the output workspace to TOF.
auto cvtalg = createChildAlgorithm("ConvertUnits");
cvtalg->setProperty("InputWorkspace", outputWS);
cvtalg->setProperty("outputWorkspace", outputWS);
cvtalg->setProperty("Target", "TOF");
cvtalg->execute();
outputWS = cvtalg->getProperty("OutputWorkspace");
setProperty("OutputWorkspace", outputWS);
}
} // namespace Algorithms
......
......@@ -11,6 +11,7 @@
#include "MantidAPI/Algorithm.h"
#include "MantidAPI/AlgorithmManager.h"
#include "MantidAPI/AnalysisDataService.h"
#include "MantidAPI/Axis.h"
#include "MantidAPI/FrameworkManager.h"
#include "MantidAlgorithms/CalculatePlaczekSelfScattering2.h"
#include "MantidDataObjects/Workspace2D.h"
......@@ -85,6 +86,7 @@ public:
alg->setProperty("DataX", x);
alg->setProperty("DataY", y);
alg->setProperty("NSpec", 2);
alg->setProperty("UnitX", "Wavelength");
alg->execute();
// retreve output workspace from ADS
MatrixWorkspace_sptr outWs =
......@@ -93,10 +95,10 @@ public:
}
// Add sample to workspace
void addSampleMaterialToWorkspace() {
void addSampleMaterialToWorkspace(const std::string wsname) {
Algorithm_sptr alg = AlgorithmManager::Instance().createUnmanaged("SetSampleMaterial");
alg->initialize();
alg->setProperty("InputWorkspace", "InputWorkspace");
alg->setProperty("InputWorkspace", wsname);
alg->setProperty("ChemicalFormula", "Si");
alg->setProperty("SampleNumberDensity", 0.1);
alg->execute();
......@@ -118,41 +120,47 @@ public:
}
void testCalculatePlaczekSelfScatteringExecutes() {
const std::string wsname = "wstest1";
MatrixWorkspace_sptr IncidentSpecta = generateIncidentSpectrum();
auto alg = makeAlgorithm();
Mantid::DataObjects::Workspace2D_sptr InputWorkspace =
WorkspaceCreationHelper::create2DWorkspaceWithRectangularInstrument(5, 100, 380);
Mantid::API::AnalysisDataService::Instance().addOrReplace("InputWorkspace", InputWorkspace);
addSampleMaterialToWorkspace();
Mantid::API::AnalysisDataService::Instance().addOrReplace(wsname, InputWorkspace);
addSampleMaterialToWorkspace(wsname);
alg->setProperty("IncidentSpecta", IncidentSpecta);
alg->setProperty("InputWorkspace", "InputWorkspace");
alg->setPropertyValue("InputWorkspace", wsname);
alg->setProperty("OutputWorkspace", "correction_ws");
TS_ASSERT_THROWS_NOTHING(alg->execute());
}
void testCalculatePlaczekSelfScatteringDoesNotRunWithNoDetectors() {
MatrixWorkspace_sptr IncidentSpecta = generateIncidentSpectrum();
Mantid::DataObjects::Workspace2D_sptr InputWorkspace = WorkspaceCreationHelper::create2DWorkspace(30, 381);
Mantid::API::AnalysisDataService::Instance().addOrReplace("InputWorkspace2", InputWorkspace);
addSampleMaterialToWorkspace();
auto alg = makeAlgorithm();
alg->setProperty("IncidentSpecta", IncidentSpecta);
alg->setProperty("InputWorkspace", InputWorkspace);
alg->setProperty("OutputWorkspace", "correction_ws");
TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &)
}
// NOTE:
// The workspace validator goes off first, makes the following tests irrelevant
// void testCalculatePlaczekSelfScatteringDoesNotRunWithNoDetectors() {
// const std::string wsname = "wstest2";
void testCalculatePlaczekSelfScatteringDoesNotRunWithNoSample() {
MatrixWorkspace_sptr IncidentSpecta = generateIncidentSpectrum();
Mantid::DataObjects::Workspace2D_sptr InputWorkspace =
WorkspaceCreationHelper::create2DWorkspaceWithRectangularInstrument(5, 100, 380);
Mantid::API::AnalysisDataService::Instance().addOrReplace("InputWorkspace", InputWorkspace);
auto alg = makeAlgorithm();
alg->setProperty("IncidentSpecta", IncidentSpecta);
alg->setProperty("InputWorkspace", InputWorkspace);
alg->setProperty("OutputWorkspace", "correction_ws");
TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &)
}
// MatrixWorkspace_sptr IncidentSpecta = generateIncidentSpectrum();
// Mantid::DataObjects::Workspace2D_sptr InputWorkspace = WorkspaceCreationHelper::create2DWorkspace(30, 381);
// Mantid::API::AnalysisDataService::Instance().addOrReplace(wsname, InputWorkspace);
// addSampleMaterialToWorkspace(wsname);
// auto alg = makeAlgorithm();
// alg->setProperty("IncidentSpecta", IncidentSpecta);
// alg->setPropertyValue("InputWorkspace", wsname);
// alg->setProperty("OutputWorkspace", "correction_ws");
// TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &)
// }
// void testCalculatePlaczekSelfScatteringDoesNotRunWithNoSample() {
// MatrixWorkspace_sptr IncidentSpecta = generateIncidentSpectrum();
// Mantid::DataObjects::Workspace2D_sptr InputWorkspace =
// WorkspaceCreationHelper::create2DWorkspaceWithRectangularInstrument(5, 100, 380);
// Mantid::API::AnalysisDataService::Instance().addOrReplace("InputWorkspace", InputWorkspace);
// auto alg = makeAlgorithm();
// alg->setProperty("IncidentSpecta", IncidentSpecta);
// alg->setProperty("InputWorkspace", InputWorkspace);
// alg->setProperty("OutputWorkspace", "correction_ws");
// TS_ASSERT_THROWS(alg->execute(), const std::runtime_error &)
// }
private:
static std::shared_ptr<CalculatePlaczekSelfScattering2> makeAlgorithm() {
......
......@@ -176,6 +176,7 @@ private:
alg->setProperty("DataX", xVec);
alg->setProperty("DataY", yVec);
alg->setProperty("NSpec", 3);
alg->setProperty("UnitX", "Wavelength");
alg->execute();
}
......
......@@ -36,7 +36,7 @@ For this particular algorithm:
* When no ``LambdaD`` is provided, the default value 1.44 will be used, which is also the implicit value used in the original :ref:`CalculatePlaczekSelfScattering <algm-CalculatePlaczekSelfScattering-v1>`.
* Generally speaking it is better to measure the detector efficiency instead of relying on a theoretical one.
* The calculated Placzek correction factor will be scaled by the packing fraction if `ScaleByPackingFraction` is set to `True` (Default value).
* The calculated Placzek correction factor will be scaled by the packing fraction if ``ScaleByPackingFraction=True`` (default).
.. math::
:label: ScaleByPackingFraction
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment