Commit 39d20e9c authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov
Browse files

itroduce multi tolerance refinement

parent 8cf2f7bf
......@@ -64,4 +64,5 @@ class PinkIndexer
AngleResolution angleResolution;
RefinementType refinementType;
float maxResolutionForIndexing_1_per_A;
float finalRefinementTolerance;
};
\ No newline at end of file
......@@ -13,7 +13,16 @@ class Refinement
void refineFixedLattice(Lattice& lattice, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Matrix2Xf& ucsBorderNorms);
void refineVariableLattice(Lattice& lattice, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Matrix2Xf& ucsBorderNorms);
int getFittedPeaksCount(Lattice& lattice, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Matrix2Xf& ucsBorderNorms);
int getFittedPeaksCount(Lattice& lattice, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Matrix2Xf& ucsBorderNorms);
void setTolerance(float tolerance)
{
this->tolerance = tolerance;
}
float getTolerance()
{
return tolerance;
}
private:
void getDefects(Eigen::ArrayXf& defects, const Eigen::Matrix3f& basis, const Eigen::Matrix3Xf& ucsDirections, const Eigen::Matrix2Xf& ucsBorderNorms);
......
......@@ -18,6 +18,7 @@ PinkIndexer::PinkIndexer(const ExperimentSettings& experimentSettings, Considere
, angleResolution(angleResolution)
, refinementType(refinementType)
, maxResolutionForIndexing_1_per_A(maxResolutionForIndexing_1_per_A)
, finalRefinementTolerance(experimentSettings.getTolerance())
{
sampleLattice = experimentSettings.getSampleReciprocalLattice_1A();
......@@ -68,27 +69,37 @@ int PinkIndexer::indexPattern(Lattice& indexedLattice, Eigen::RowVectorXf& inten
case RefinementType::none:
break;
case RefinementType::fixedLatticeParameters:
refinement.setTolerance(0.1);
refinement.refineFixedLattice(indexedLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(finalRefinementTolerance);
refinement.refineFixedLattice(indexedLattice, ucsDirections, ucsBorderNorms);
break;
case RefinementType::variableLatticeParameters:
refinement.setTolerance(0.1);
refinement.refineVariableLattice(indexedLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(finalRefinementTolerance);
refinement.refineVariableLattice(indexedLattice, ucsDirections, ucsBorderNorms);
break;
case RefinementType::firstFixedThenVariableLatticeParameters:
refinement.setTolerance(0.1);
refinement.refineFixedLattice(indexedLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(0.05);
refinement.refineFixedLattice(indexedLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(finalRefinementTolerance);
refinement.refineVariableLattice(indexedLattice, ucsDirections, ucsBorderNorms);
break;
default:
break;
}
return refinement.getFittedPeaksCount(indexedLattice, ucsDirections, ucsBorderNorms);
return refinement.getFittedPeaksCount(indexedLattice, ucsDirections, ucsBorderNorms);
//int fittedPeaksCount = refinement.getFittedPeaksCount(indexedLattice, ucsDirections, ucsBorderNorms);
//if ((fittedPeaksCount >= 20 && fittedPeaksCount >= detectorPeaks_m.cols() * 0.3) || fittedPeaksCount >= detectorPeaks_m.cols() * 0.5)
// int fittedPeaksCount = refinement.getFittedPeaksCount(indexedLattice, ucsDirections, ucsBorderNorms);
// if ((fittedPeaksCount >= 20 && fittedPeaksCount >= detectorPeaks_m.cols() * 0.3) || fittedPeaksCount >= detectorPeaks_m.cols() * 0.5)
//{
// return true;
//}
//else
// else
//{
// return false;
//}
......
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