aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-10-26 15:06:38 +0100
committerThomas White <taw@physics.org>2020-10-26 15:08:50 +0100
commit2089e6e3c0a34430239dce596bc27db30611ac2f (patch)
tree0b269fba30065b28c51ca3456313d26347fc58e5 /src
parent6819e268a8401fec0001812e7612909b3211fab1 (diff)
Label all uses of cell tolerances
I'm sick of fixing this same issue over and over again. New rule: any code handling unit cell tolerances MUST be labelled with details of units.
Diffstat (limited to 'src')
-rw-r--r--src/crystfelindexingopts.c3
-rw-r--r--src/crystfelindexingopts.h6
-rw-r--r--src/gui_project.c4
-rw-r--r--src/indexamajig.c14
4 files changed, 18 insertions, 9 deletions
diff --git a/src/crystfelindexingopts.c b/src/crystfelindexingopts.c
index e4e2ffd3..e9e9ab3e 100644
--- a/src/crystfelindexingopts.c
+++ b/src/crystfelindexingopts.c
@@ -567,6 +567,8 @@ int crystfel_indexing_opts_get_cell_check(CrystFELIndexingOpts *opts)
}
+
+/* Values in 'tols' are in frac (not %) and rad */
void crystfel_indexing_opts_get_tolerances(CrystFELIndexingOpts *opts,
float *tols)
{
@@ -785,6 +787,7 @@ void crystfel_indexing_opts_set_cell_check(CrystFELIndexingOpts *opts,
}
+/* Values in 'tols' are in frac (not %) and rad */
void crystfel_indexing_opts_set_tolerances(CrystFELIndexingOpts *opts,
float *tols)
{
diff --git a/src/crystfelindexingopts.h b/src/crystfelindexingopts.h
index ddf6b1b2..32c8de44 100644
--- a/src/crystfelindexingopts.h
+++ b/src/crystfelindexingopts.h
@@ -64,7 +64,7 @@ struct _crystfelindexingopts
GtkWidget *retry;
GtkWidget *check_peaks;
GtkWidget *check_cell;
- GtkWidget *tols[6];
+ GtkWidget *tols[6]; /* frac (not %) and radians */
GtkWidget *enable_hitfind;
GtkWidget *ignore_fewer_peaks;
@@ -97,7 +97,7 @@ extern int crystfel_indexing_opts_get_retry(CrystFELIndexingOpts *opts);
extern int crystfel_indexing_opts_get_peak_check(CrystFELIndexingOpts *opts);
extern int crystfel_indexing_opts_get_cell_check(CrystFELIndexingOpts *opts);
extern void crystfel_indexing_opts_get_tolerances(CrystFELIndexingOpts *opts,
- float *tols);
+ float *tols); /* frac (not %) and rad */
extern int crystfel_indexing_opts_get_min_peaks(CrystFELIndexingOpts *opts);
extern char *crystfel_indexing_opts_get_integration_method_string(CrystFELIndexingOpts *opts);
@@ -124,7 +124,7 @@ extern void crystfel_indexing_opts_set_peak_check(CrystFELIndexingOpts *opts,
extern void crystfel_indexing_opts_set_cell_check(CrystFELIndexingOpts *opts,
int cell_check);
extern void crystfel_indexing_opts_set_tolerances(CrystFELIndexingOpts *opts,
- float *tols);
+ float *tols); /* frac (not %) and rad */
extern void crystfel_indexing_opts_set_min_peaks(CrystFELIndexingOpts *opts,
int min_peaks);
diff --git a/src/gui_project.c b/src/gui_project.c
index f0bb2b38..38e800ba 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -120,6 +120,7 @@ int match_filename(const char *fn, enum match_type_id mt)
}
+/* "tols" is in frac (not %) and radians */
static void parse_tols(const char *text, float *tols)
{
int r;
@@ -597,6 +598,9 @@ int save_project(struct crystfelproject *proj)
proj->indexing_params.no_peak_check);
fprintf(fh, "indexing.no_cell_check %i\n",
proj->indexing_params.no_cell_check);
+
+ /* Values in file are in percent and degrees */
+ /* Values in "tol" are in frac (not %) and radians */
fprintf(fh, "indexing.cell_tolerance %f,%f,%f,%f,%f,%f\n",
proj->indexing_params.tols[0]*100.0,
proj->indexing_params.tols[1]*100.0,
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 8285f780..2f96ecac 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -382,6 +382,8 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)
break;
case 401 :
+ /* Values in 'tols' are in frac (not %) and rad
+ * Conversion happens a few lines below */
r = sscanf(arg, "%f,%f,%f,%f,%f,%f",
&args->iargs.tols[0], &args->iargs.tols[1], &args->iargs.tols[2],
&args->iargs.tols[3], &args->iargs.tols[4], &args->iargs.tols[5]);
@@ -620,12 +622,12 @@ int main(int argc, char *argv[])
args.iargs.cell = NULL;
args.iargs.noisefilter = 0;
args.iargs.median_filter = 0;
- args.iargs.tols[0] = 0.05;
- args.iargs.tols[1] = 0.05;
- args.iargs.tols[2] = 0.05;
- args.iargs.tols[3] = deg2rad(1.5);
- args.iargs.tols[4] = deg2rad(1.5);
- args.iargs.tols[5] = deg2rad(1.5);
+ args.iargs.tols[0] = 0.05; /* frac (not %) */
+ args.iargs.tols[1] = 0.05; /* frac (not %) */
+ args.iargs.tols[2] = 0.05; /* frac (not %) */
+ args.iargs.tols[3] = deg2rad(1.5); /* radians */
+ args.iargs.tols[4] = deg2rad(1.5); /* radians */
+ args.iargs.tols[5] = deg2rad(1.5); /* radians */
args.iargs.threshold = 800.0;
args.iargs.min_sq_gradient = 100000.0;
args.iargs.min_snr = 5.0;