Unverified Commit 9f5b5791 authored by Whitfield, Ross's avatar Whitfield, Ross Committed by GitHub
Browse files

Merge pull request #31829 from mantidproject/pd275_add_peak_shape

Add IkedaCarpenterPV peak shape for PDCalibration
parents a49e771b 16aeaccc
......@@ -201,7 +201,8 @@ void PDCalibration::init() {
"Previous calibration table. This overrides results from previous file.");
// properties about peak positions to fit
std::vector<std::string> peaktypes{"BackToBackExponential", "Gaussian", "Lorentzian", "PseudoVoigt"};
std::vector<std::string> peaktypes{"BackToBackExponential", "Gaussian", "Lorentzian", "PseudoVoigt",
"IkedaCarpenterPV"};
declareProperty("PeakFunction", "Gaussian", std::make_shared<StringListValidator>(peaktypes));
vector<std::string> bkgdtypes{"Flat", "Linear", "Quadratic"};
declareProperty("BackgroundType", "Linear", std::make_shared<StringListValidator>(bkgdtypes), "Type of Background.");
......
......@@ -475,6 +475,67 @@ public:
TS_ASSERT_DELTA(calTable->cell<double>(index + 2, 1), calTable->cell<double>(index, 1), 1E-5); // det 102
TS_ASSERT_DELTA(calTable->cell<double>(index + 3, 1), calTable->cell<double>(index, 1), 1E-5); // det 103
}
void test_exec_ikeda_carpenter() {
// test the algorithm using the IkedaCarpenterPV peak function
const double ref_difc = 2208.287616521762;
const std::vector<double> dValues{.8920, 1.0758, 1.2615, 2.0599};
std::stringstream function;
for (const auto &val : dValues) {
function << "name=IkedaCarpenterPV, X0=" << ref_difc * val << ", I=50;";
}
CreateSampleWorkspace wsalg;
TS_ASSERT_THROWS_NOTHING(wsalg.initialize());
TS_ASSERT(wsalg.isInitialized());
TS_ASSERT_THROWS_NOTHING(wsalg.setPropertyValue("OutputWorkspace", "ws"));
TS_ASSERT_THROWS_NOTHING(wsalg.setPropertyValue("WorkspaceType", "Event"));
TS_ASSERT_THROWS_NOTHING(wsalg.setPropertyValue("Function", "User Defined"));
TS_ASSERT_THROWS_NOTHING(wsalg.setPropertyValue("UserDefinedFunction", function.str()));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("XMin", 1.0));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("XMax", 16666.7));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("BinWidth", 1.0));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("NumEvents", 100000));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("BankPixelWidth", 1));
TS_ASSERT_THROWS_NOTHING(wsalg.setProperty("NumBanks", 1));
TS_ASSERT_THROWS_NOTHING(wsalg.execute());
TS_ASSERT(wsalg.isExecuted());
MatrixWorkspace_const_sptr ws = AnalysisDataService::Instance().retrieveWS<MatrixWorkspace>("ws");
TS_ASSERT(ws);
MoveInstrumentComponent movealg;
TS_ASSERT_THROWS_NOTHING(movealg.initialize());
TS_ASSERT(movealg.isInitialized());
TS_ASSERT_THROWS_NOTHING(movealg.setProperty("Workspace", "ws"));
TS_ASSERT_THROWS_NOTHING(movealg.setPropertyValue("ComponentName", "bank1"));
TS_ASSERT_THROWS_NOTHING(movealg.setProperty("X", 1.01));
TS_ASSERT_THROWS_NOTHING(movealg.setProperty("Y", 0.0));
TS_ASSERT_THROWS_NOTHING(movealg.setProperty("Z", 1.01));
TS_ASSERT_THROWS_NOTHING(movealg.setProperty("RelativePosition", false));
TS_ASSERT_THROWS_NOTHING(movealg.execute());
TS_ASSERT(movealg.isExecuted());
PDCalibration alg;
TS_ASSERT_THROWS_NOTHING(alg.initialize())
TS_ASSERT(alg.isInitialized())
TS_ASSERT_THROWS_NOTHING(alg.setProperty("InputWorkspace", "ws"));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("TofBinning", std::vector<double>{1, 1, 16666}));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("PeakFunction", "IkedaCarpenterPV"));
TS_ASSERT_THROWS_NOTHING(alg.setProperty("PeakPositions", dValues));
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("OutputCalibrationTable", "ikeda_cal"));
TS_ASSERT_THROWS_NOTHING(alg.setPropertyValue("DiagnosticWorkspaces", "ikeda_diag"));
TS_ASSERT_THROWS_NOTHING(alg.execute());
TS_ASSERT(alg.isExecuted());
ITableWorkspace_sptr calTable = AnalysisDataService::Instance().retrieveWS<ITableWorkspace>("ikeda_cal");
TS_ASSERT(calTable);
Mantid::DataObjects::TableColumn_ptr<int> col0 = calTable->getColumn(0);
std::vector<int> detIDs = col0->data();
TS_ASSERT_DELTA(calTable->cell<double>(0, 1), ref_difc, 1E-2 * ref_difc);
}
};
class PDCalibrationTestPerformance : public CxxTest::TestSuite { // TODO
......
......@@ -19,6 +19,7 @@ Improvements
- :ref:`ConvertDiffCal <algm-ConvertDiffCal-v1>` now optionally updates a previous calibration when converting offsets.
- :ref:`SCDCalibratePanels <algm-SCDCalibratePanels-v2>` major interface update along with enabling the calibration of T0 and sample position.
- :ref:`SCDCalibratePanels <algm-SCDCalibratePanels-v2>` minor interface update that allows fine control of bank rotation calibration.
- :ref:`PDCalibration <algm-PDCalibration-v1>` has a new option to use the :ref:`IkedaCarpenterPV <func-IkedaCarpenterPV>` peak function.
- :ref:`SNAPReduce <algm-SNAPReduce-v1>` permits saving selected property names and values to file, to aid autoreduction.
Bugfixes
......
<?xml version="1.0" encoding="UTF-8" ?>
<parameter-file instrument = "NOMAD" valid-from = "2011-08-13T00:00:00">
<component-link name = "NOMAD">
<component-link name = "NOMAD">
<parameter name="TS_mapping_file" type="string">
<value val="NOM_TS_2010_12_01.dat"/>
</parameter>
<parameter name="TS_mapping_file" type="string">
<value val="NOM_TS_2010_12_01.dat"/>
</parameter>
<parameter name="IkedaCarpenterPV:Kappa" type="fitting">
<formula eq="0.1" result-unit="TOF"/>
<fixed />
</parameter>
</component-link>
</component-link>
</parameter-file>
<component-link name="Group1" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="3.938" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="16.031" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="0.050" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="18789.007*centre^2+1617.648*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="3.026*centre" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
<component-link name="Group2" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="0.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="2.349" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="1.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="411306.734*centre^2+1328.602*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="8.210+1.611*centre^2" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
<component-link name="Group3" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="0.00691" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="0.00182" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="5.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="152826.265*centre^2+14989.105*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="0.144+14.470*centre" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
<component-link name="Group4" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="0.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="0.107" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="0.05" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="54125.092*centre^2+13234.202*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="2.206+9.482*centre+7.138*centre^2" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
<component-link name="Group5" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="0.15" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="0.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="0.05" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="2139.988*centre^2+5.946*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="9.534*centre" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
<component-link name="Group6" >
<parameter name="IkedaCarpenterPV:Alpha0" type="fitting">
<formula eq="0.65" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Alpha1" type="fitting">
<formula eq="0.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:Beta0" type="fitting">
<formula eq="1500.0" result-unit="TOF"/>
</parameter>
<parameter name="IkedaCarpenterPV:SigmaSquared" type="fitting">
<formula eq="103645.364*centre^2+977.813*centre^4" unit="dSpacing" result-unit="TOF^2"/>
</parameter>
<parameter name="IkedaCarpenterPV:Gamma" type="fitting">
<formula eq="9.564*centre" unit="dSpacing" result-unit="TOF"/>
</parameter>
</component-link>
</parameter-file>
Markdown is supported
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