Commit c22fe6fb authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov
Browse files

added multiseed refinement

parent b83872ed
......@@ -38,7 +38,8 @@ class PinkIndexer
none,
fixedLatticeParameters,
variableLatticeParameters,
firstFixedThenVariableLatticeParameters
firstFixedThenVariableLatticeParameters,
firstFixedThenVariableLatticeParametersMultiSeed
};
PinkIndexer(const ExperimentSettings& experimentSettings, ConsideredPeaksCount consideredPeaksCount, AngleResolution angleResolution,
......
......@@ -34,6 +34,7 @@ typedef enum {
REFINEMENT_TYPE_fixedLatticeParameters = 1,
REFINEMENT_TYPE_variableLatticeParameters = 2,
REFINEMENT_TYPE_firstFixedThenVariableLatticeParameters = 3,
REFINEMENT_TYPE_firstFixedThenVariableLatticeParametersMultiSeed = 4,
REFINEMENT_TYPE_lastEnum
} refinementType_t;
......
......@@ -89,6 +89,35 @@ int PinkIndexer::indexPattern(Lattice& indexedLattice, Eigen::Array<bool, Eigen:
refinement.setTolerance(finalRefinementTolerance);
refinement.refineVariableLattice(indexedLattice, ucsDirections, ucsBorderNorms);
break;
case RefinementType::firstFixedThenVariableLatticeParametersMultiSeed:
{
Lattice bestLattice = indexedLattice;
int maxFittedNodesCount = refinement.getFittedPeaks(indexedLattice, fittedPeaks, ucsDirections, ucsBorderNorms);
float maxRelativeDeviation = 0.01;
Array<float, 1, 3> columnDeviationNorms = indexedLattice.getBasis().colwise().norm() * maxRelativeDeviation;
for (uint32_t i = 0; i < 16; ++i)
{
Matrix3f currentBasis = indexedLattice.getBasis() + (Array33f::Random().rowwise() * columnDeviationNorms ).matrix();
Lattice currentLattice(currentBasis);
refinement.setTolerance(min(finalRefinementTolerance * 2.5, 0.12));
refinement.refineFixedLattice(currentLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(min(finalRefinementTolerance * 1.8, 0.10));
refinement.refineVariableLattice(currentLattice, ucsDirections, ucsBorderNorms);
refinement.setTolerance(finalRefinementTolerance);
refinement.refineVariableLattice(currentLattice, ucsDirections, ucsBorderNorms);
int fittedNodesCount = refinement.getFittedPeaks(currentLattice, fittedPeaks, ucsDirections, ucsBorderNorms);
if (fittedNodesCount > maxFittedNodesCount)
{
maxFittedNodesCount = fittedNodesCount;
bestLattice = currentLattice;
}
}
indexedLattice = bestLattice;
}
break;
default:
break;
}
......
......@@ -70,6 +70,9 @@ extern "C" PinkIndexer* PinkIndexer_new(ExperimentSettings* experimentSettings,
case REFINEMENT_TYPE_firstFixedThenVariableLatticeParameters:
refinementType_enumClass = PinkIndexer::RefinementType::firstFixedThenVariableLatticeParameters;
break;
case REFINEMENT_TYPE_firstFixedThenVariableLatticeParametersMultiSeed:
refinementType_enumClass = PinkIndexer::RefinementType::firstFixedThenVariableLatticeParametersMultiSeed;
break;
default:
refinementType_enumClass = PinkIndexer::RefinementType::fixedLatticeParameters;
......
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