Commit ad0e55f5 authored by Yaroslav Gevorkov's avatar Yaroslav Gevorkov Committed by Thomas White
Browse files

add option -pinkIndexer-max-refinement-disbalance

parent 9560b439
......@@ -448,6 +448,7 @@ These set low-level parameters for the XGANDALF indexing algorithm.
.IP \fB--pinkIndexer-multi=\fIn\fR
.IP \fB--pinkIndexer-thread-count=\fIn\fR
.IP \fB--pinkIndexer-no-check-indexed=\fIn\fR
.IP \fB--pinkIndexer-max-refinement-disbalance=\fIn\fR
.IP \fB--pinkIndexer-override-bandwidth=\fIn\fR
.IP \fB--pinkIndexer-override-photon-energy=\fIn\fR
.IP \fB--pinkIndexer-override-visible-energy-range=\fImin-max\fR
......@@ -473,6 +474,8 @@ These set low-level parameters for the PinkIndexer indexing algorithm.
.IP
\fB--pinkIndexer-no-check-indexed\fR Leave the check whether a pattern is indexed completely to CrystFEL. Useful for monochromatic (since CrystFEL's prediction model is smarter than the one of pinkIndexer) or in combnation with --no-check-peaks for geometry optimization. This flag is meant to eventually disappear, when the full pink pipeline is implemented.
.IP
\fB--pinkIndexer-max-refinement-disbalance Indexing solutions are dismissed if the refinement refined very well to one side of the detector and very badly to the other side. Allowed values range from 0 (no disbalance) to 2 (extreme disbalance), default 0.4. Disbalance after refinement usually appears for bad geometries or bad prior unit cell parameters.
.IP
\fB--pinkIndexer-override-bandwidth=\fIn\fR Overrides the bandwidth in (delta energy)/(mean energy) to use for indexing (which usually is defined in the geometry file). Should be used together with \fB--pinkIndexer-override-photon-energy=\fIn\fR. Note: this option sets the borders for the spectrum, whereas the option in the geometry file sets the standard deviation for a Gaussian that fits the spectrum. Internally, the standard deviation is multiplied by 5 to compute the hard borders of the spectrum. I.e., photon_energy_bandwith = 0.005 in the geometry file equals --pinkIndexer-override-bandwidth=0.025. For monochromatic experiments usually --pinkIndexer-override-bandwidth=0.02 is sufficiently large. If in doubt, use --pinkIndexer-override-visible-energy-range.
.IP
\fB--pinkIndexer-override-photon-energy=\fIn\fR Overrides the mean energy in eV to use for indexing (which usually is defined in the geometry file). Should be used together with \fB--pinkIndexer-override-bandwidth=\fIn\fR
......
......@@ -55,6 +55,8 @@ struct pinkIndexer_private_data {
int no_check_indexed;
float maxRefinementDisbalance;
IntegerMatrix *centeringTransformation;
LatticeTransform_t latticeReductionTransform;
};
......@@ -95,15 +97,24 @@ int run_pinkIndexer(struct image *image, void *ipriv)
Lattice_t indexedLattice[MAX_MULTI_LATTICE_COUNT];
float center_shift[MAX_MULTI_LATTICE_COUNT][2];
float maxRefinementDisbalance = 0.4;
do {
int peakCount = reciprocalPeaks_1_per_A->peakCount;
int matchedPeaksCount = PinkIndexer_indexPattern(pinkIndexer_private_data->pinkIndexer,
&(indexedLattice[indexed]), center_shift[indexed], reciprocalPeaks_1_per_A, intensities,
maxRefinementDisbalance,
pinkIndexer_private_data->maxRefinementDisbalance,
pinkIndexer_private_data->threadCount);
if(matchedPeaksCount == -1){
STATUS("WARNING: Indexing solution was rejected due to too large disbalance of the refinement."
"If you see this message often, check the documentation for the parameter "
"--pinkIndexer-max-refinement-disbalance\n");
matchedPeaksCount = 0;
}
printf("matchedPeaksCount %d from %d\n",matchedPeaksCount,peakCount);
if ((matchedPeaksCount >= 25 && matchedPeaksCount >= peakCount * 0.30)
|| matchedPeaksCount >= peakCount * 0.4
|| matchedPeaksCount >= 70
......@@ -181,6 +192,7 @@ void *pinkIndexer_prepare(IndexingMethod *indm, UnitCell *cell,
pinkIndexer_private_data->multi = pinkIndexer_opts->multi;
pinkIndexer_private_data->min_peaks = pinkIndexer_opts->min_peaks;
pinkIndexer_private_data->no_check_indexed = pinkIndexer_opts->no_check_indexed;
pinkIndexer_private_data->maxRefinementDisbalance = pinkIndexer_opts->maxRefinementDisbalance;
UnitCell* primitiveCell = uncenter_cell(cell, &pinkIndexer_private_data->centeringTransformation, NULL);
......@@ -412,6 +424,9 @@ static void show_help()
" --pinkIndexer-no-check-indexed\n"
" Disable internal check for correct indexing\n"
" solutions\n"
" --pinkIndexer-max-refinement-disbalance=n\n"
" Maximum disbalance after refinement:\n"
" 0 (no disbalance) to 2 (extreme disbalance), default 0.4\n"
" --pinkIndexer-override-photon-energy=ev\n"
" Mean energy in eV to use for indexing.\n"
" --pinkIndexer-override-bandwidth=n\n"
......@@ -447,6 +462,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
(*opts_ptr)->reflectionRadius = -1;
(*opts_ptr)->customPhotonEnergy = -1;
(*opts_ptr)->customBandwidth = -1;
(*opts_ptr)->maxRefinementDisbalance = 0.4;
break;
case 1 :
......@@ -548,6 +564,12 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
(*opts_ptr)->customBandwidth *= -1;
}
break;
case 14 :
if (sscanf(arg, "%f", &(*opts_ptr)->maxRefinementDisbalance) != 1)
{
ERROR("Invalid value for --pinkIndexer-max-refinement-disbalance\n");
return EINVAL;
}
}
return 0;
......@@ -589,6 +611,8 @@ static struct argp_option options[] = {
{"pinkIndexer-override-visible-energy-range", 13, "overridenVisibleEnergyRange", OPTION_HIDDEN, NULL},
{"pinkIndexer-max-refinement-disbalance", 14, "maxDisbalance", OPTION_HIDDEN, NULL},
{0}
};
......
......@@ -49,6 +49,7 @@ struct pinkIndexer_options {
float reflectionRadius; /* In m^-1 */
float customPhotonEnergy;
float customBandwidth;
float maxRefinementDisbalance;
};
#include <stddef.h>
......
Markdown is supported
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