Commit 890e26ea authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov
Browse files

bug fix

parent 0cea2cab
......@@ -85,6 +85,8 @@ void PinkIndexer::indexPattern(Lattice& indexedLattice, Eigen::RowVectorXf& inte
void PinkIndexer::raducePeakCount(Matrix3Xf& ucsDirections, Array2Xf& ucsBorderNorms, RowVectorXf& intensities, const Eigen::Matrix2Xf& detectorPeaks_m)
{
Matrix2Xf detectorPeaks_m_copy = detectorPeaks_m;
//first clear all above resolution limit
int peaksKept_res = 0;
for (int i = 0; i < intensities.size(); i++)
......@@ -94,12 +96,14 @@ void PinkIndexer::raducePeakCount(Matrix3Xf& ucsDirections, Array2Xf& ucsBorderN
ucsDirections.col(peaksKept_res) = ucsDirections.col(i);
ucsBorderNorms.col(peaksKept_res) = ucsBorderNorms.col(i);
intensities[peaksKept_res] = intensities[i];
detectorPeaks_m_copy.col(peaksKept_res) = detectorPeaks_m_copy.col(i);
peaksKept_res++;
}
}
ucsDirections.conservativeResize(3, peaksKept_res);
ucsBorderNorms.conservativeResize(2, peaksKept_res);
ucsDirections.conservativeResize(NoChange, peaksKept_res);
ucsBorderNorms.conservativeResize(NoChange, peaksKept_res);
intensities.conservativeResize(peaksKept_res);
detectorPeaks_m_copy.conservativeResize(NoChange, peaksKept_res);
//then clear some at high and some at low resolution
int consideredPeaksCount = getConsideredPeaksCount();
......@@ -112,7 +116,7 @@ void PinkIndexer::raducePeakCount(Matrix3Xf& ucsDirections, Array2Xf& ucsBorderN
int peaksToRemoveByNormMax = 0.75 * peaksToRemoveCount;
int peaksToRemoveByIntensity = peaksToRemoveCount - peaksToRemoveByNormMin - peaksToRemoveByNormMax;
RowVectorXf norms = detectorPeaks_m.colwise().norm();
RowVectorXf norms = detectorPeaks_m_copy.colwise().norm();
RowVectorXf norms_sorted = norms;
sort((float*)norms_sorted.data(), (float*)norms_sorted.data() + norms_sorted.size());
float minNorm = norms_sorted[peaksToRemoveByNormMin];
......@@ -147,9 +151,9 @@ void PinkIndexer::raducePeakCount(Matrix3Xf& ucsDirections, Array2Xf& ucsBorderN
}
}
ucsDirections.conservativeResize(3, consideredPeaksCount);
ucsBorderNorms.conservativeResize(2, consideredPeaksCount);
intensities.conservativeResize(consideredPeaksCount);
ucsDirections.conservativeResize(NoChange, peaksKept_normsIntensities);
ucsBorderNorms.conservativeResize(NoChange, peaksKept_normsIntensities);
intensities.conservativeResize(peaksKept_normsIntensities);
}
float PinkIndexer::getAngleResolution()
......
......@@ -49,7 +49,7 @@ void testPinkIndexer()
PinkIndexer::ConsideredPeaksCount consideredPeaksCount = PinkIndexer::ConsideredPeaksCount::standard;
PinkIndexer::AngleResolution angleResolution = PinkIndexer::AngleResolution::standard;
PinkIndexer::RefinementType refinementType = PinkIndexer::RefinementType::firstFixedThenVariableLatticeParameters;
float maxResolutionForIndexing_1_per_A = numeric_limits<float>::max();
float maxResolutionForIndexing_1_per_A = 0.2;//numeric_limits<float>::max();
Lattice indexedLattice;
PinkIndexer pinkIndexer(experimentSettings, consideredPeaksCount, angleResolution, refinementType, maxResolutionForIndexing_1_per_A);
......
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