aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaroslav Gevorkov <yaroslav.gevorkov@desy.de>2020-03-03 00:17:57 +0100
committerThomas White <taw@physics.org>2020-03-04 10:02:08 +0100
commitad0e55f5e1cd8fcf092d4883e16c9fe5608c428f (patch)
tree5e79ed18426437f08b010dcdacc9af5c6ea90674
parent9560b439213a51898d0c018ffc3e1fdc8bcaddbd (diff)
add option -pinkIndexer-max-refinement-disbalance
-rw-r--r--doc/man/indexamajig.13
-rw-r--r--libcrystfel/src/pinkindexer.c28
-rw-r--r--libcrystfel/src/pinkindexer.h1
3 files changed, 30 insertions, 2 deletions
diff --git a/doc/man/indexamajig.1 b/doc/man/indexamajig.1
index 7bc71471..c9e156e3 100644
--- a/doc/man/indexamajig.1
+++ b/doc/man/indexamajig.1
@@ -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
diff --git a/libcrystfel/src/pinkindexer.c b/libcrystfel/src/pinkindexer.c
index e3ecf5a9..22208885 100644
--- a/libcrystfel/src/pinkindexer.c
+++ b/libcrystfel/src/pinkindexer.c
@@ -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}
};
diff --git a/libcrystfel/src/pinkindexer.h b/libcrystfel/src/pinkindexer.h
index f1c4f5b0..f79f4331 100644
--- a/libcrystfel/src/pinkindexer.h
+++ b/libcrystfel/src/pinkindexer.h
@@ -49,6 +49,7 @@ struct pinkIndexer_options {
float reflectionRadius; /* In m^-1 */
float customPhotonEnergy;
float customBandwidth;
+ float maxRefinementDisbalance;
};
#include <stddef.h>