jfjoch_process/jfjoch_scale: Improve parameter handling
This commit is contained in:
+20
-15
@@ -32,7 +32,7 @@
|
||||
#include "../image_analysis/WriteReflections.h"
|
||||
#include "../image_analysis/UpdateReflectionResolution.h"
|
||||
|
||||
void print_usage(Logger &logger) {
|
||||
void print_usage() {
|
||||
std::cout << "Usage ./jfjoch_analysis {<options>} <input.h5>" << std::endl;
|
||||
std::cout << "Options:" << std::endl;
|
||||
std::cout << " -o, --output-prefix <txt> Output file prefix (default: output)" << std::endl;
|
||||
@@ -46,30 +46,30 @@ void print_usage(Logger &logger) {
|
||||
std::cout << " Spot finding" << std::endl;
|
||||
std::cout << " --spot-sigma <num> Noise sigma level for spot finding (default: 3.0)" << std::endl;
|
||||
std::cout << " --spot-threshold <num> Photon count threshold for spot finding (default: 10)" << std::endl;
|
||||
std::cout << " --spot-resolution <num> High resolution limit for spot finding (default: 1.5)" << std::endl;
|
||||
std::cout << " --spot-high-resolution <num> High resolution limit for spot finding (default: 1.5)" << std::endl;
|
||||
std::cout << " --max-spots <num> Max spot count (default: 250)" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " Indexing" << std::endl;
|
||||
std::cout << " -R, --rotation-indexing[=num] Rotation indexing (optional: min angular range deg)" << std::endl;
|
||||
std::cout << " -X, --indexing-algorithm <txt> Indexing algorithm (FFBIDX|FFT|FFTW|Auto|None)" << std::endl;
|
||||
std::cout << " -F, --fft-indexing Use FFT indexing algorithm (shortcut for -X FFT)" << 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 << " --no-beam-center-refine No least-square beam center refinement" << std::endl;
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " Scaling and merging" << std::endl;
|
||||
std::cout << " -M, --scale-merge Scale and merge (refine mosaicity) and write scaled.hkl + image.dat" << std::endl;
|
||||
std::cout << " -P, --partiality <txt> Partiality refinement fixed|rot|unity (default: fixed)" << std::endl;
|
||||
std::cout << " -M, --scale-merge Scale and merge (refine mosaicity) and write scaled.hkl + image.dat" << std::endl;
|
||||
std::cout << " -P, --partiality <txt> Partiality refinement fixed|rot|unity (default: fixed)" << std::endl;
|
||||
std::cout << " -A, --anomalous Anomalous mode (don't merge Friedel pairs)" << std::endl;
|
||||
std::cout << " -B, --refine-bfactor Refine per image B-factor" << std::endl;
|
||||
std::cout << " -w, --wedge[=num] Refine image wedge during scaling with starting wedge value" << std::endl;
|
||||
std::cout << " --scaling-high-resolution <num> High resolution limit for spot finding (default: no limit)" << std::endl;
|
||||
std::cout << " --min-partiality <num> Minimum partiality to accept reflection (default: 0.02)" << std::endl;
|
||||
std::cout << " --min-image-cc <num> Per-image CC limit in percent (default: no limit)" << std::endl;
|
||||
std::cout << " --scaling-iterations <num> Number of scaling iterations with no reference data (default: 3)" << std::endl;
|
||||
std::cout << " -z, --reference-mtz <file> Reference MTZ file" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
OPT_SPOT_SIGMA = 1000,
|
||||
@@ -79,7 +79,8 @@ enum {
|
||||
OPT_NO_BEAM_CENTER_REFINE,
|
||||
OPT_MIN_PARTIALITY,
|
||||
OPT_MIN_IMAGE_CC,
|
||||
OPT_SCALING_ITERATIONS
|
||||
OPT_SCALING_ITERATIONS,
|
||||
OPT_SCALING_HIGH_RESOLUTION
|
||||
};
|
||||
|
||||
static option long_options[] = {
|
||||
@@ -88,7 +89,7 @@ static option long_options[] = {
|
||||
{"threads", required_argument, nullptr, 'N'},
|
||||
{"start-image", required_argument, nullptr, 's'},
|
||||
{"end-image", required_argument, nullptr, 'e'},
|
||||
{"stride", required_argument, nullptr, 't'},
|
||||
{"stride", required_argument, nullptr, 't'},
|
||||
{"rotation-indexing", optional_argument, nullptr, 'R'},
|
||||
{"indexing-algorithm", required_argument, nullptr, 'X'},
|
||||
{"unit-cell", required_argument, nullptr, 'C'},
|
||||
@@ -102,12 +103,13 @@ static option long_options[] = {
|
||||
|
||||
{"spot-sigma", required_argument, nullptr, OPT_SPOT_SIGMA},
|
||||
{"spot-threshold", required_argument, nullptr, OPT_SPOT_THRESHOLD},
|
||||
{"spot-resolution", required_argument, nullptr, OPT_SPOT_RESOLUTION},
|
||||
{"spot-high-resolution", required_argument, nullptr, OPT_SPOT_RESOLUTION},
|
||||
{"max-spots", required_argument, nullptr, OPT_MAX_SPOTS},
|
||||
{"no-beam-center-refine", no_argument, nullptr, OPT_NO_BEAM_CENTER_REFINE},
|
||||
{"min-partiality", required_argument, nullptr, OPT_MIN_PARTIALITY},
|
||||
{"min-image-cc", required_argument, nullptr, OPT_MIN_IMAGE_CC},
|
||||
{"scaling-iterations", required_argument, nullptr, OPT_SCALING_ITERATIONS},
|
||||
{"scaling-high-resolution", required_argument, nullptr, OPT_SCALING_HIGH_RESOLUTION},
|
||||
|
||||
{nullptr, 0, nullptr, 0}
|
||||
};
|
||||
@@ -219,7 +221,7 @@ int main(int argc, char **argv) {
|
||||
std::optional<float> d_min_scale_merge;
|
||||
|
||||
if (argc == 1) {
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@@ -268,7 +270,7 @@ int main(int argc, char **argv) {
|
||||
indexing_algorithm = IndexingAlgorithmEnum::None;
|
||||
else {
|
||||
logger.Error("Invalid indexing algorithm: {}", alg);
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
@@ -279,7 +281,7 @@ int main(int argc, char **argv) {
|
||||
logger.Error(
|
||||
"Invalid unit cell. Expected: \"a,b,c,alpha,beta,gamma\" (6 floats, comma-separated, no spaces). Got: {}",
|
||||
optarg ? optarg : "<null>");
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
fixed_reference_unit_cell = uc;
|
||||
@@ -317,7 +319,7 @@ int main(int argc, char **argv) {
|
||||
partiality_model = PartialityModel::Rotation;
|
||||
else {
|
||||
logger.Error("Invalid partiality mode: {}", optarg);
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
break;
|
||||
@@ -350,6 +352,9 @@ int main(int argc, char **argv) {
|
||||
case OPT_MIN_IMAGE_CC:
|
||||
min_image_cc = std::stod(optarg);
|
||||
break;
|
||||
case OPT_SCALING_HIGH_RESOLUTION:
|
||||
d_min_scale_merge = atof(optarg);
|
||||
break;
|
||||
case OPT_SCALING_ITERATIONS:
|
||||
scaling_iter = atoi(optarg);
|
||||
if (scaling_iter <= 0) {
|
||||
@@ -359,14 +364,14 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
default:
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
if (optind != argc - 1) {
|
||||
logger.Error("Input file not specified");
|
||||
print_usage(logger);
|
||||
print_usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user