jfjoch_process: First pixel refine integration
This commit is contained in:
@@ -58,7 +58,7 @@ void print_usage() {
|
||||
std::cout << " -X, --indexing-algorithm <txt> Indexing algorithm (FFBIDX|FFT|FFTW|Auto|None)" << std::endl;
|
||||
std::cout << " -S, --space-group <num> Space group number - used for both indexing and scaling" << std::endl;
|
||||
std::cout << " -C, --unit-cell <cell> Fix reference unit cell: \"a,b,c,alpha,beta,gamma\"" << std::endl;
|
||||
std::cout << " -r, --refine <txt> Geometry refinement algorithm (none|orientation|beam_and_lattice)" << std::endl;
|
||||
std::cout << " -r, --refine <txt> Geometry refinement algorithm (none|orientation|beam_and_lattice|pixelrefine)" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " Scaling and merging" << std::endl;
|
||||
@@ -73,6 +73,10 @@ void print_usage() {
|
||||
std::cout << " --scaling-iterations <num> Number of scaling iterations with no reference data (default: 3)" << std::endl;
|
||||
std::cout << " --scaling-output <txt> Output format for scaling results mtz|cif|txt (default: mtz)" << std::endl;
|
||||
std::cout << " -z, --reference-mtz <file> Reference MTZ file" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " Pixel refinement (experimental, select via -r pixelrefine, needs --reference-mtz)" << std::endl;
|
||||
std::cout << " --bandwidth <num> Relative X-ray bandwidth FWHM (e.g. 0.01 for 1% DMM); default from file or 0" << std::endl;
|
||||
}
|
||||
|
||||
enum {
|
||||
@@ -87,7 +91,8 @@ enum {
|
||||
OPT_SCALING_OUTPUT,
|
||||
OPT_SINGLE_PASS_ROTATION,
|
||||
OPT_REDO_ROTATION_SPOTS,
|
||||
OPT_FORCE_ROTATION_LATTICE
|
||||
OPT_FORCE_ROTATION_LATTICE,
|
||||
OPT_BANDWIDTH
|
||||
};
|
||||
|
||||
static option long_options[] = {
|
||||
@@ -123,6 +128,7 @@ static option long_options[] = {
|
||||
{"scaling-iterations", required_argument, nullptr, OPT_SCALING_ITERATIONS},
|
||||
{"scaling-high-resolution", required_argument, nullptr, OPT_SCALING_HIGH_RESOLUTION},
|
||||
{"scaling-output", required_argument, nullptr, OPT_SCALING_OUTPUT},
|
||||
{"bandwidth", required_argument, nullptr, OPT_BANDWIDTH},
|
||||
{nullptr, 0, nullptr, 0}
|
||||
};
|
||||
|
||||
@@ -293,6 +299,8 @@ int main(int argc, char **argv) {
|
||||
int64_t scaling_iter = 3;
|
||||
std::optional<CrystalLattice> forced_rotation_lattice;
|
||||
|
||||
std::optional<float> bandwidth_fwhm; // relative FWHM of dlambda/lambda
|
||||
|
||||
IndexingAlgorithmEnum indexing_algorithm = IndexingAlgorithmEnum::Auto;
|
||||
GeomRefinementAlgorithmEnum refinement_algorithm = GeomRefinementAlgorithmEnum::BeamCenter;
|
||||
|
||||
@@ -410,6 +418,8 @@ int main(int argc, char **argv) {
|
||||
refinement_algorithm = GeomRefinementAlgorithmEnum::BeamCenter;
|
||||
else if (alg == "orientation")
|
||||
refinement_algorithm = GeomRefinementAlgorithmEnum::OrientationOnly;
|
||||
else if (alg == "pixelrefine")
|
||||
refinement_algorithm = GeomRefinementAlgorithmEnum::PixelRefine;
|
||||
else {
|
||||
logger.Error("Invalid geom refinement algorithm: {}", alg);
|
||||
print_usage();
|
||||
@@ -515,6 +525,13 @@ int main(int argc, char **argv) {
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
case OPT_BANDWIDTH:
|
||||
bandwidth_fwhm = atof(optarg);
|
||||
if (!(bandwidth_fwhm.value() >= 0.0f)) {
|
||||
logger.Error("Invalid bandwidth: {}", optarg);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
print_usage();
|
||||
@@ -616,6 +633,19 @@ int main(int argc, char **argv) {
|
||||
logger.Info("Max spot count overridden to {}", max_spot_count_override.value());
|
||||
}
|
||||
|
||||
// X-ray bandwidth: CLI overrides the value carried in the dataset; otherwise
|
||||
// keep whatever the dataset provided (0 / none -> monochromatic).
|
||||
if (bandwidth_fwhm)
|
||||
experiment.BandwidthFWHM(bandwidth_fwhm);
|
||||
if (experiment.GetBandwidthFWHM())
|
||||
logger.Info("X-ray bandwidth FWHM set to {:.4f}", experiment.GetBandwidthFWHM().value());
|
||||
|
||||
// PixelRefine integration needs reference intensities (the I_true hypothesis).
|
||||
if (refinement_algorithm == GeomRefinementAlgorithmEnum::PixelRefine && reference_data.empty()) {
|
||||
logger.Warning("-r pixelrefine needs --reference-mtz; falling back to beam_and_lattice");
|
||||
refinement_algorithm = GeomRefinementAlgorithmEnum::BeamCenter;
|
||||
}
|
||||
|
||||
// Configure Indexing
|
||||
IndexingSettings indexing_settings;
|
||||
indexing_settings.Algorithm(indexing_algorithm);
|
||||
|
||||
Reference in New Issue
Block a user