aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2019-08-30 14:37:27 +0200
committerThomas White <taw@physics.org>2019-09-02 13:14:32 +0200
commit1df82f92bb366bac6bb2e7e6e04506b2d22dab0e (patch)
tree079d986091833be890bf3861812b5bb3d162383d /src
parent77406eb6d3a655364e52f046215fcebe8d873368 (diff)
process_hkl,partialator: Allow arbitrary direction and degree of polarisation
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c25
-rw-r--r--src/process_hkl.c34
2 files changed, 37 insertions, 22 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 68c886c9..ef6d0f80 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -325,6 +325,7 @@ static void show_help(const char *s)
" -m, --model=<model> Specify partiality model.\n"
" --min-measurements=<n> Minimum number of measurements to require.\n"
" --no-polarisation Disable polarisation correction.\n"
+" --polarisation=<p> Specify type of polarisation correction.\n"
" --max-adu=<n> Saturation value of detector.\n"
" --min-res=<n> Merge only crystals which diffract above <n> A.\n"
" --push-res=<n> Merge higher than apparent resolution cutoff.\n"
@@ -951,7 +952,7 @@ int main(int argc, char *argv[])
PartialityModel pmodel = PMODEL_XSPHERE;
int min_measurements = 2;
char *rval;
- int polarisation = 1;
+ struct polarisation polarisation = {.fraction = 1.0, .angle= 0.0};
int start_after = 0;
int stop_after = 0;
double max_adu = +INFINITY;
@@ -1005,14 +1006,14 @@ int main(int argc, char *argv[])
{"force-radius", 1, NULL, 11},
{"min-res", 1, NULL, 12},
{"force-lambda", 1, NULL, 13},
+ {"polarisation", 1, NULL, 14},
+ {"polarization", 1, NULL, 14}, /* compat */
+ {"no-polarisation", 0, NULL, 15},
+ {"no-polarization", 0, NULL, 15}, /* compat */
{"no-scale", 0, &no_scale, 1},
{"no-Bscale", 0, &no_Bscale, 1},
{"no-pr", 0, &no_pr, 1},
- {"no-polarisation", 0, &polarisation, 0},
- {"no-polarization", 0, &polarisation, 0}, /* compat */
- {"polarisation", 0, &polarisation, 1},
- {"polarization", 0, &polarisation, 1}, /* compat */
{"no-free", 0, &no_free, 1},
{"output-every-cycle", 0, &output_everycycle, 1},
{"no-logs", 0, &no_logs, 1},
@@ -1184,6 +1185,13 @@ int main(int argc, char *argv[])
force_lambda *= 1e-10;
break;
+ case 14 :
+ polarisation = parse_polarisation(optarg);
+ break;
+
+ case 15 :
+ polarisation.fraction = 0.5;
+ break;
case 0 :
break;
@@ -1427,11 +1435,8 @@ int main(int argc, char *argv[])
cr_refl = apply_max_adu(cr_refl, max_adu);
- if ( polarisation ) {
- polarisation_correction(cr_refl,
- crystal_get_cell(cr),
- image);
- }
+ polarisation_correction(cr_refl, crystal_get_cell(cr),
+ image->lambda, polarisation);
if ( !no_free ) select_free_reflections(cr_refl, rng);
diff --git a/src/process_hkl.c b/src/process_hkl.c
index 393dc3e8..5e17f31c 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -80,7 +80,8 @@ static void show_help(const char *s)
" model.\n"
" --even-only Merge even numbered crystals only\n"
" --odd-only Merge odd numbered crystals only\n"
-" --no-polarisation Disable polarisation correction.\n"
+" --no-polarisation Disable polarisation correction.\n"
+" --polarisation=<p> Specify type of polarisation correction.\n"
" --min-measurements=<n> Require at least <n> measurements before a\n"
" reflection appears in the output. Default: 2\n"
" --min-snr=<n> Require individual intensity measurements to\n"
@@ -258,7 +259,7 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
RefList *reference, const SymOpList *sym,
double **hist_vals, signed int hist_h,
signed int hist_k, signed int hist_l, int *hist_n,
- int config_nopolar, double min_snr, double max_adu,
+ struct polarisation p, double min_snr, double max_adu,
double push_res, double min_cc, int do_scale,
FILE *stat)
{
@@ -270,9 +271,8 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
new_refl = crystal_get_reflections(cr);
/* First, correct for polarisation */
- if ( !config_nopolar ) {
- polarisation_correction(new_refl, crystal_get_cell(cr), image);
- }
+ polarisation_correction(new_refl, crystal_get_cell(cr),
+ image->lambda, p);
if ( reference != NULL ) {
if ( do_scale ) {
@@ -385,7 +385,7 @@ static int merge_all(Stream *st, RefList *model, RefList *reference,
const SymOpList *sym,
double **hist_vals, signed int hist_h,
signed int hist_k, signed int hist_l,
- int *hist_i, int config_nopolar, int min_measurements,
+ int *hist_i, struct polarisation p, int min_measurements,
double min_snr, double max_adu,
int start_after, int stop_after, double min_res,
double push_res, double min_cc, int do_scale, int flag_even_odd, char *stat_output)
@@ -435,7 +435,7 @@ static int merge_all(Stream *st, RefList *model, RefList *reference,
r = merge_crystal(model, &image, cr, reference,
sym, hist_vals,
hist_h, hist_k, hist_l,
- hist_i, config_nopolar,
+ hist_i, p,
min_snr, max_adu, push_res,
min_cc, do_scale, stat);
if ( r == 0 ) n_crystals_used++;
@@ -506,7 +506,7 @@ int main(int argc, char *argv[])
int hist_i;
int space_for_hist = 0;
char *histo_params = NULL;
- int config_nopolar = 0;
+ struct polarisation polarisation = {.fraction = 1.0, .angle= 0.0};
char *rval;
int min_measurements = 2;
int r;
@@ -530,8 +530,6 @@ int main(int argc, char *argv[])
{"scale", 0, &config_scale, 1},
{"even-only", 0, &config_evenonly, 1},
{"odd-only", 0, &config_oddonly, 1},
- {"no-polarisation", 0, &config_nopolar, 1},
- {"no-polarization", 0, &config_nopolar, 1},
{"symmetry", 1, NULL, 'y'},
{"histogram", 1, NULL, 'g'},
{"hist-parameters", 1, NULL, 'z'},
@@ -544,6 +542,10 @@ int main(int argc, char *argv[])
{"version", 0, NULL, 7},
{"min-cc", 1, NULL, 8},
{"stat", 1, NULL, 9},
+ {"polarisation", 1, NULL, 10},
+ {"polarization", 1, NULL, 10}, /* compat */
+ {"no-polarisation", 0, NULL, 11},
+ {"no-polarization", 0, NULL, 11}, /* compat */
{0, 0, NULL, 0}
};
@@ -671,6 +673,14 @@ int main(int argc, char *argv[])
twopass = 1;
break;
+ case 10 :
+ polarisation = parse_polarisation(optarg);
+ break;
+
+ case 11 :
+ polarisation.fraction = 0.5;
+ break;
+
case 0 :
break;
@@ -760,7 +770,7 @@ int main(int argc, char *argv[])
hist_i = 0;
r = merge_all(st, model, NULL, sym, &hist_vals, hist_h, hist_k, hist_l,
- &hist_i, config_nopolar, min_measurements, min_snr,
+ &hist_i, polarisation, min_measurements, min_snr,
max_adu, start_after, stop_after, min_res, push_res,
min_cc, config_scale, flag_even_odd, stat_output);
fprintf(stderr, "\n");
@@ -795,7 +805,7 @@ int main(int argc, char *argv[])
r = merge_all(st, model, reference, sym, &hist_vals,
hist_h, hist_k, hist_l, &hist_i,
- config_nopolar, min_measurements, min_snr,
+ polarisation, min_measurements, min_snr,
max_adu, start_after, stop_after, min_res,
push_res, min_cc, config_scale,
flag_even_odd, stat_output);