diff options
author | Thomas White <taw@physics.org> | 2017-02-07 15:06:48 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-02-16 10:32:08 +0100 |
commit | c1b825fd1040c89114d4a8c2c5d3fbba3f946d2a (patch) | |
tree | 51361667e60c3e5b432b4e3639a73d0605f2484e /libcrystfel/src/detector.c | |
parent | 80b54c66c36c46a247d6d015be60ea9e73aa025f (diff) |
Fix mask path placeholder check
The mask paths for all panels have to have the same number of
placeholders, but the masks do not have to have the same number of
placeholders as the panel data blocks.
This also tidies up a few excess strdup() calls, and removes
partial_event_substitution() because retrieve_full_path() can now handle
the number of placeholders being too small.
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r-- | libcrystfel/src/detector.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index 42ffbe40..8c98f79e 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -1204,7 +1204,7 @@ struct detector *get_detector_geometry_2(const char *filename, int i; int rgi, rgci; int reject = 0; - int path_dim; + int path_dim, mask_path_dim; int dim_dim; int dim_reject = 0; int dim_dim_reject = 0; @@ -1389,6 +1389,7 @@ struct detector *get_detector_geometry_2(const char *filename, } + mask_path_dim = -1; for ( i=0; i<det->n_panels; i++ ) { int panel_mask_dim = 0; @@ -1398,8 +1399,7 @@ struct detector *get_detector_geometry_2(const char *filename, next_instance = det->panels[i].mask; - while(next_instance) - { + while ( next_instance ) { next_instance = strstr(next_instance, "%"); if ( next_instance != NULL ) { next_instance += 1*sizeof(char); @@ -1407,18 +1407,29 @@ struct detector *get_detector_geometry_2(const char *filename, } } - if ( panel_mask_dim != path_dim ) { - dim_reject = 1; + if ( mask_path_dim == -1 ) { + mask_path_dim = panel_mask_dim; + } else { + if ( panel_mask_dim != mask_path_dim ) { + dim_reject = 1; + } } + } } - if ( dim_reject == 1) { + if ( dim_reject == 1 ) { ERROR("All panels' data and mask entries must have the same " "number of placeholders\n"); reject = 1; } + if ( mask_path_dim > path_dim ) { + ERROR("Number of placeholders in mask cannot be larger than " + "for data\n"); + reject = 1; + } + det->path_dim = path_dim; dim_dim_reject = 0; |