aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2021-05-11 11:55:29 +0200
committerThomas White <taw@physics.org>2021-05-11 11:55:29 +0200
commitbbb5ce788392222ed745aa65895f90a6490bc3c5 (patch)
tree267252c50a5c686010076376b38ce3af4b64b023
parent6defaebb8132e35f1960556021f18a79ee96d1a1 (diff)
Set panel for bad region when there is only one panel
When there is only one panel, we can safely assume that fs/ss bad regions refer to it without it being stated in the geometry file. This allows some older Pilatus geometry files to be used without complaints. A further improvement would be to determine the panel when all the data comes from one "slab" so the panel is still ambiguous. However, on further thought it seems like a lot of work to do this reliably in all cases. I'm not even sure that this case in particular is causing anyone problems. Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/32
-rw-r--r--libcrystfel/src/datatemplate.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index 6733c108..ad274689 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -1015,6 +1015,19 @@ static int check_mask_and_satmap_placeholders(const DataTemplate *dt)
}
+static int try_guess_panel(struct dt_badregion *bad, DataTemplate *dt)
+{
+ if ( dt->n_panels == 1 ) {
+ bad->panel_name = dt->panels[0].name;
+ ERROR("WARNING: Assuming bad_%s/panel = %s\n",
+ bad->name, dt->panels[0].name);
+ return 1;
+ }
+
+ return 0;
+}
+
+
DataTemplate *data_template_new_from_string(const char *string_in)
{
DataTemplate *dt;
@@ -1340,9 +1353,11 @@ DataTemplate *data_template_new_from_string(const char *string_in)
if ( dt->bad[i].is_fsss ) {
if ( dt->bad[i].panel_name == NULL ) {
- ERROR("Panel not specified for bad region '%s'\n",
- dt->bad[i].name);
- reject = 1;
+ if ( !try_guess_panel(&dt->bad[i], dt) ) {
+ ERROR("Panel not specified for bad "
+ "region '%s'\n", dt->bad[i].name);
+ reject = 1;
+ }
} else if ( lookup_panel(dt->bad[i].panel_name, dt,
&dt->bad[i].panel_number) )