diff --git a/Framework/Crystal/src/LoadHKL.cpp b/Framework/Crystal/src/LoadHKL.cpp index 2111cecc41ce5243eedbf50c34debace0153bcd5..07a9ba69940a1007e9303ab8f24bbe4b25d567ed 100644 --- a/Framework/Crystal/src/LoadHKL.cpp +++ b/Framework/Crystal/src/LoadHKL.cpp @@ -27,7 +27,7 @@ void LoadHKL::init() { FileProperty::Load, ".hkl"), "Path to an hkl file to save."); - declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>( + declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace> >( "OutputWorkspace", "", Direction::Output), "Name of the output workspace."); } @@ -84,17 +84,19 @@ void LoadHKL::exec() { double SigI = std::stod(line.substr(20, 8)); double wl = std::stod(line.substr(32, 8)); double tbar, trans, scattering; - int run, bank; + int run, bank, seqNum; if (cosines) { tbar = std::stod(line.substr(40, 8)); // tbar run = std::stoi(line.substr(102, 6)); trans = std::stod(line.substr(114, 7)); // transmission + seqNum = std::stoi(line.substr(109, 7)); bank = std::stoi(line.substr(121, 4)); scattering = std::stod(line.substr(125, 9)); } else { tbar = std::stod(line.substr(40, 7)); // tbar run = std::stoi(line.substr(47, 7)); trans = std::stod(line.substr(61, 7)); // transmission + seqNum = std::stoi(line.substr(54, 7)); bank = std::stoi(line.substr(68, 4)); scattering = std::stod(line.substr(72, 9)); } @@ -115,6 +117,7 @@ void LoadHKL::exec() { peak.setIntensity(Inti); peak.setSigmaIntensity(SigI); peak.setRunNumber(run); + peak.setPeakNumber(seqNum); std::ostringstream oss; oss << "bank" << bank; std::string bankName = oss.str(); @@ -155,9 +158,8 @@ void LoadHKL::exec() { radius1 = x1; else if (x2 > 0) radius1 = x2; - double frac = - theta - - static_cast<double>(static_cast<int>(theta / 5.)) * 5.; // theta%5. + double frac = theta - static_cast<double>(static_cast<int>(theta / 5.)) * + 5.; // theta%5. frac = frac / 5.; radius = radius * (1 - frac) + radius1 * frac; radius /= mu1; diff --git a/Framework/Crystal/src/SortHKL.cpp b/Framework/Crystal/src/SortHKL.cpp index 9acce25892ac0921173f20b7074f0f1cedea8f41..7fe77bd1ecf69b283ad1bd45d65a60ddc32e7368 100644 --- a/Framework/Crystal/src/SortHKL.cpp +++ b/Framework/Crystal/src/SortHKL.cpp @@ -38,7 +38,7 @@ SortHKL::SortHKL() { SortHKL::~SortHKL() = default; void SortHKL::init() { - declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>( + declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace> >( "InputWorkspace", "", Direction::Input), "An input PeaksWorkspace with an instrument."); @@ -60,31 +60,31 @@ void SortHKL::init() { boost::make_shared<StringListValidator>(centeringOptions), "Appropriate lattice centering for the peaks."); - declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace>>( + declareProperty(make_unique<WorkspaceProperty<PeaksWorkspace> >( "OutputWorkspace", "", Direction::Output), "Output PeaksWorkspace"); declareProperty("OutputChi2", 0.0, "Chi-square is available as output", Direction::Output); - declareProperty(make_unique<WorkspaceProperty<ITableWorkspace>>( + declareProperty(make_unique<WorkspaceProperty<ITableWorkspace> >( "StatisticsTable", "StatisticsTable", Direction::Output), "An output table workspace for the statistics of the peaks."); - declareProperty(make_unique<PropertyWithValue<std::string>>( + declareProperty(make_unique<PropertyWithValue<std::string> >( "RowName", "Overall", Direction::Input), "name of row"); declareProperty("Append", false, "Append to output table workspace if true.\n" "If false, new output table workspace (default)."); - std::vector<std::string> equivTypes{"Mean", "Median"}; + std::vector<std::string> equivTypes{ "Mean", "Median" }; declareProperty("EquivalentIntensities", equivTypes[0], boost::make_shared<StringListValidator>(equivTypes), "Replace intensities by mean(default), " "or median."); - declareProperty(Kernel::make_unique<PropertyWithValue<double>>( + declareProperty(Kernel::make_unique<PropertyWithValue<double> >( "SigmaCritical", 3.0, Direction::Input), "Removes peaks whose intensity deviates more than " "SigmaCritical from the mean (or median)."); declareProperty( - make_unique<WorkspaceProperty<MatrixWorkspace>>( + make_unique<WorkspaceProperty<MatrixWorkspace> >( "EquivalentsWorkspace", "EquivalentIntensities", Direction::Output), "Output Equivalent Intensities"); } @@ -128,11 +128,11 @@ void SortHKL::exec() { auto wavelengths = unique.second.getWavelengths(); auto intensities = unique.second.getIntensities(); auto sigmas = unique.second.getSigmas(); - // std::cout << "HKL " << unique.second.getHKL() << "\n"; - // std::cout << "Intensities "; - // for (const auto &e : intensities) - // std::cout << e << " "; - // std::cout << "\n"; + g_log.debug() << "HKL " << unique.second.getHKL() << "\n"; + g_log.debug() << "Intensities "; + for (const auto &e : intensities) + g_log.debug() << e << " "; + g_log.debug() << "\n"; auto zScores = Kernel::getWeightedZscore(intensities, sigmas); if (zScores.size() > maxPeaks) maxPeaks = zScores.size(); @@ -143,8 +143,8 @@ void SortHKL::exec() { Kernel::getStatistics(outliersRemoved.getIntensities(), StatOptions::Mean | StatOptions::Median); - // std::cout << "Mean = " << intensityStatistics.mean - //<< " Median = " << intensityStatistics.median << "\n"; + g_log.debug() << "Mean = " << intensityStatistics.mean + << " Median = " << intensityStatistics.median << "\n"; // sort wavelengths & intensities for (size_t i = 0; i < wavelengths.size(); i++) { size_t i0 = i; @@ -161,7 +161,7 @@ void SortHKL::exec() { intensities[i0] = intensities[i]; intensities[i] = temp; } - // std::cout << "Zscores "; + g_log.debug() << "Zscores "; for (size_t i = 0; i < std::min(zScores.size(), static_cast<size_t>(20)); ++i) { UniqX[i] = wavelengths[i]; @@ -172,14 +172,14 @@ void SortHKL::exec() { UniqE[i] = intensityStatistics.mean - intensities[i]; else UniqE[i] = intensityStatistics.median - intensities[i]; - // std::cout << zScores[i] << " "; + g_log.debug() << zScores[i] << " "; } for (size_t i = zScores.size(); i < 20; ++i) { UniqX[i] = wavelengths[zScores.size() - 1]; UniqY[i] = intensities[zScores.size() - 1]; UniqE[i] = 0.0; } - // std::cout << "\n"; + g_log.debug() << "\n"; } } @@ -229,10 +229,9 @@ SortHKL::getNonZeroPeaks(const std::vector<Peak> &inputPeaks) const { std::remove_copy_if(inputPeaks.begin(), inputPeaks.end(), std::back_inserter(peaks), [](const Peak &peak) { - return peak.getIntensity() <= 0.0 || - peak.getSigmaIntensity() <= 0.0 || - peak.getHKL() == V3D(0, 0, 0); - }); + return peak.getIntensity() <= 0.0 || peak.getSigmaIntensity() <= 0.0 || + peak.getHKL() == V3D(0, 0, 0); + }); return peaks; } @@ -331,9 +330,9 @@ SortHKL::getStatisticsTable(const std::string &name) const { /// Inserts statistics the supplied PeaksStatistics-objects into the supplied /// TableWorkspace. -void SortHKL::insertStatisticsIntoTable( - const ITableWorkspace_sptr &table, - const PeaksStatistics &statistics) const { +void +SortHKL::insertStatisticsIntoTable(const ITableWorkspace_sptr &table, + const PeaksStatistics &statistics) const { if (!table) { throw std::runtime_error("Can't store statistics into Null-table."); } @@ -367,8 +366,9 @@ PeaksWorkspace_sptr SortHKL::getOutputPeaksWorkspace( /// Sorts the peaks in the workspace by H, K and L. void SortHKL::sortOutputPeaksByHKL(IPeaksWorkspace_sptr outputPeaksWorkspace) { // Sort by HKL - std::vector<std::pair<std::string, bool>> criteria{ - {"H", true}, {"K", true}, {"L", true}}; + std::vector<std::pair<std::string, bool> > criteria{ { "H", true }, + { "K", true }, + { "L", true } }; outputPeaksWorkspace->sort(criteria); } diff --git a/Framework/DataObjects/src/Peak.cpp b/Framework/DataObjects/src/Peak.cpp index 1e2780ee819d69d61813bd8801d3048e55e5a05b..c73d1b0ae3206a6250e7915f33333daa4233a591 100644 --- a/Framework/DataObjects/src/Peak.cpp +++ b/Framework/DataObjects/src/Peak.cpp @@ -893,6 +893,7 @@ void Peak::setCol(int m_col) { this->m_col = m_col; } * @param m_peakNumber :: unique peak number value */ void Peak::setPeakNumber(int m_peakNumber) { this->m_peakNumber = m_peakNumber; + std::cout << this->m_peakNumber << " " << m_peakNumber << "\n"; } // ------------------------------------------------------------------------------------- diff --git a/Framework/DataObjects/src/PeakColumn.cpp b/Framework/DataObjects/src/PeakColumn.cpp index fdee8ab4ea91f2ca52c37206d79674c3cf89a59e..b80c9a8bc5ac61bb699b9f75020365ed1f97c483 100644 --- a/Framework/DataObjects/src/PeakColumn.cpp +++ b/Framework/DataObjects/src/PeakColumn.cpp @@ -293,6 +293,8 @@ const void *PeakColumn::void_pointer(size_t index) const { &value); // Given a pointer it will return a pointer } else if (m_name == "RunNumber") { value = peak.getRunNumber(); + } else if (m_name == "PeakNumber") { + value = peak.getPeakNumber(); return boost::get<int>(&value); } else if (m_name == "DetID") { value = peak.getDetectorID();