Commit 58bc9ed5 authored by Lynch, Vickie's avatar Lynch, Vickie
Browse files

Refs #22420 test range of predicted peaks

parent d9126791
...@@ -139,27 +139,25 @@ void PredictSatellitePeaks::exec() { ...@@ -139,27 +139,25 @@ void PredictSatellitePeaks::exec() {
IPeak &peak0 = Peaks->getPeak(0); IPeak &peak0 = Peaks->getPeak(0);
std::vector<V3D> possibleHKLs; std::vector<V3D> possibleHKLs;
if (includePeaksInRange) { const double dMin = getProperty("MinDSpacing");
const double dMin = getProperty("MinDSpacing"); const double dMax = getProperty("MaxDSpacing");
const double dMax = getProperty("MaxDSpacing"); Geometry::HKLGenerator gen(lattice, dMin);
Geometry::HKLGenerator gen(lattice, dMin); auto dSpacingFilter =
auto dSpacingFilter = boost::make_shared<HKLFilterDRange>(lattice, dMin, dMax);
boost::make_shared<HKLFilterDRange>(lattice, dMin, dMax);
V3D hkl = *(gen.begin());
V3D hkl = *(gen.begin()); g_log.information() << "HKL range for d_min of " << dMin << " to d_max of "
g_log.information() << "HKL range for d_min of " << dMin << " to d_max of " << dMax << " is from " << hkl << " to " << hkl * -1.0
<< dMax << " is from " << hkl << " to " << hkl * -1.0 << ", a total of " << gen.size() << " possible HKL's\n";
<< ", a total of " << gen.size() << " possible HKL's\n"; if (gen.size() > MAX_NUMBER_HKLS)
if (gen.size() > MAX_NUMBER_HKLS) throw std::invalid_argument("More than 10 billion HKLs to search. Is "
throw std::invalid_argument("More than 10 billion HKLs to search. Is " "your d_min value too small?");
"your d_min value too small?");
possibleHKLs.clear();
possibleHKLs.clear(); possibleHKLs.reserve(gen.size());
possibleHKLs.reserve(gen.size()); std::remove_copy_if(gen.begin(), gen.end(),
std::remove_copy_if(gen.begin(), gen.end(), std::back_inserter(possibleHKLs),
std::back_inserter(possibleHKLs), (~dSpacingFilter)->fn());
(~dSpacingFilter)->fn());
}
size_t N = possibleHKLs.size(); size_t N = possibleHKLs.size();
N = max<size_t>(100, N); N = max<size_t>(100, N);
...@@ -272,8 +270,8 @@ void PredictSatellitePeaks::predictOffsets( ...@@ -272,8 +270,8 @@ void PredictSatellitePeaks::predictOffsets(
Kernel::V3D Qs = goniometer * UB * satelliteHKL * 2.0 * M_PI; Kernel::V3D Qs = goniometer * UB * satelliteHKL * 2.0 * M_PI;
// Check if Q is non-physical // Check if Q is non-physical
if (Qs[2] <= 0) if (Qs[2] <= 0)
continue; continue;
auto peak(Peaks->createPeak(Qs, 1)); auto peak(Peaks->createPeak(Qs, 1));
......
...@@ -85,6 +85,7 @@ public: ...@@ -85,6 +85,7 @@ public:
TS_ASSERT(alg.isExecuted()); TS_ASSERT(alg.isExecuted());
alg.setPropertyValue("SatellitePeaks", "SatellitePeaks"); alg.setPropertyValue("SatellitePeaks", "SatellitePeaks");
PeaksWorkspace_sptr SatellitePeaks = alg.getProperty("SatellitePeaks"); PeaksWorkspace_sptr SatellitePeaks = alg.getProperty("SatellitePeaks");
TS_ASSERT(SatellitePeaks);
TS_ASSERT_EQUALS(SatellitePeaks->getNumberPeaks(), 5); TS_ASSERT_EQUALS(SatellitePeaks->getNumberPeaks(), 5);
...@@ -98,7 +99,7 @@ public: ...@@ -98,7 +99,7 @@ public:
TS_ASSERT_DELTA(peak3.getK(), 0.0, .0001); TS_ASSERT_DELTA(peak3.getK(), 0.0, .0001);
TS_ASSERT_DELTA(peak3.getL(), 0.2, .0001); TS_ASSERT_DELTA(peak3.getL(), 0.2, .0001);
/*PredictSatellitePeaks alg4; PredictSatellitePeaks alg4;
TS_ASSERT_THROWS_NOTHING(alg4.initialize()); TS_ASSERT_THROWS_NOTHING(alg4.initialize());
TS_ASSERT(alg4.isInitialized()); TS_ASSERT(alg4.isInitialized());
...@@ -114,9 +115,11 @@ public: ...@@ -114,9 +115,11 @@ public:
alg4.setProperty("WavelengthMax", "22"); alg4.setProperty("WavelengthMax", "22");
TS_ASSERT(alg4.execute()) TS_ASSERT(alg4.execute())
TS_ASSERT(alg4.isExecuted()); TS_ASSERT(alg4.isExecuted());
alg4.setPropertyValue("SatellitePeaks", "SatellitePeaks");
PeaksWorkspace_sptr SatellitePeaks2 = alg4.getProperty("SatellitePeaks"); PeaksWorkspace_sptr SatellitePeaks2 = alg4.getProperty("SatellitePeaks");
TS_ASSERT(SatellitePeaks2);
TS_ASSERT_EQUALS(SatellitePeaks2->getNumberPeaks(), 5);*/ TS_ASSERT_EQUALS(SatellitePeaks2->getNumberPeaks(), 467);
AnalysisDataService::Instance().remove(WSName); AnalysisDataService::Instance().remove(WSName);
} }
......
...@@ -39,8 +39,6 @@ public: ...@@ -39,8 +39,6 @@ public:
/// Prints /// Prints
void print(size_t index, std::ostream &s) const override; void print(size_t index, std::ostream &s) const override;
void eraseSubStr(std::string &str, const std::string &toErase);
void read(size_t index, const std::string &text) override; void read(size_t index, const std::string &text) override;
/// Sets item from a stream /// Sets item from a stream
......
...@@ -173,7 +173,6 @@ void PeakColumn::read(size_t index, const std::string &text) { ...@@ -173,7 +173,6 @@ void PeakColumn::read(size_t index, const std::string &text) {
// Convert to a double // Convert to a double
double val = 0; double val = 0;
int success = Strings::convert(text, val); int success = Strings::convert(text, val);
if (success == 0) { if (success == 0) {
......
...@@ -119,7 +119,7 @@ public: ...@@ -119,7 +119,7 @@ public:
void test_read_locale_awerness() { void test_read_locale_awerness() {
const std::vector<std::string> columnNames{"h", "k", "l", "RunNumber"}; const std::vector<std::string> columnNames{"h", "k", "l", "RunNumber"};
const std::vector<double> columnValues{-2.0, 5.0, 12.0, 143290.0}; const std::vector<double> columnValues{-2.0, 5.0, 12.0, 0.0};
TestingNumpunctFacet numpunct; TestingNumpunctFacet numpunct;
const std::locale testLocale(std::locale::classic(), &numpunct); const std::locale testLocale(std::locale::classic(), &numpunct);
for (size_t i = 0; i < columnNames.size(); ++i) { for (size_t i = 0; i < columnNames.size(); ++i) {
......
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