aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/crystfel_geometry.515
-rw-r--r--libcrystfel/src/detector.c55
-rw-r--r--libcrystfel/src/detector.h9
3 files changed, 69 insertions, 10 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5
index e2b85878..04a3aad9 100644
--- a/doc/man/crystfel_geometry.5
+++ b/doc/man/crystfel_geometry.5
@@ -148,9 +148,10 @@ mask_bad = 0x00
.SH BAD REGIONS
-You can also specify bad regions. Peaks with centroid locations within such a region will not be integrated nor used for indexing. Bad regions are specified in pixel units, but in the lab coordinate system (see above). Bad regions are distinguished from normal panels by the fact that they begin with the three letters "bad".
+You can also specify bad regions. Peaks with centroid locations within such a region will not be integrated nor used for indexing. Bad regions are specified in pixel units, either in the lab coordinate system (see above) or in fast scan/slow scan coordinates (mixtures are not allowed). In the latter case, the range of pixels is specified \fIinclusively\fR. Bad regions are distinguished from normal panels by the fact that they begin with the three letters "bad".
-Example:
+Examples:
+.br
.br
badregionA/min_x = -20.0
.br
@@ -160,6 +161,16 @@ badregionA/min_y = -100.0
.br
badregionA/max_y = +100.0
+.br
+badregionB/min_fs = 128
+.br
+badregionB/max_fs = 160
+.br
+badregionB/min_ss = 256
+.br
+badregionB/max_ss = 512
+
+
.PP
See the "examples" folder for some examples (look at the ones ending in .geom).
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 257d1daa..bd0be1b6 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -272,11 +272,21 @@ int in_bad_region(struct detector *det, double fs, double ss)
ry = ys + p->cny;
for ( i=0; i<det->n_bad; i++ ) {
+
struct badregion *b = &det->bad[i];
- if ( rx < b->min_x ) continue;
- if ( rx > b->max_x ) continue;
- if ( ry < b->min_y ) continue;
- if ( ry > b->max_y ) continue;
+
+ if ( b->is_fsss ) {
+ if ( fs < b->min_fs ) continue;
+ if ( fs > b->max_fs ) continue;
+ if ( ss < b->min_ss ) continue;
+ if ( ss > b->max_ss ) continue;
+ } else {
+ if ( rx < b->min_x ) continue;
+ if ( rx > b->max_x ) continue;
+ if ( ry < b->min_y ) continue;
+ if ( ry > b->max_y ) continue;
+ }
+
return 1;
}
@@ -511,6 +521,11 @@ static struct badregion *new_bad_region(struct detector *det, const char *name)
new->max_x = NAN;
new->min_y = NAN;
new->max_y = NAN;
+ new->min_fs = 0;
+ new->max_fs = 0;
+ new->min_ss = 0;
+ new->max_ss = 0;
+ new->is_fsss = 0;
strcpy(new->name, name);
return new;
@@ -704,12 +719,36 @@ static int parse_field_bad(struct badregion *panel, const char *key,
if ( strcmp(key, "min_x") == 0 ) {
panel->min_x = atof(val);
+ if ( panel->is_fsss ) {
+ ERROR("You can't mix x/y and fs/ss in a bad region.\n");
+ }
} else if ( strcmp(key, "max_x") == 0 ) {
panel->max_x = atof(val);
+ if ( panel->is_fsss ) {
+ ERROR("You can't mix x/y and fs/ss in a bad region.\n");
+ }
} else if ( strcmp(key, "min_y") == 0 ) {
panel->min_y = atof(val);
+ if ( panel->is_fsss ) {
+ ERROR("You can't mix x/y and fs/ss in a bad region.\n");
+ }
} else if ( strcmp(key, "max_y") == 0 ) {
panel->max_y = atof(val);
+ if ( panel->is_fsss ) {
+ ERROR("You can't mix x/y and fs/ss in a bad region.\n");
+ }
+ } else if ( strcmp(key, "min_fs") == 0 ) {
+ panel->min_fs = atof(val);
+ panel->is_fsss = 1;
+ } else if ( strcmp(key, "max_fs") == 0 ) {
+ panel->max_fs = atof(val);
+ panel->is_fsss = 1;
+ } else if ( strcmp(key, "min_ss") == 0 ) {
+ panel->min_ss = atof(val);
+ panel->is_fsss = 1;
+ } else if ( strcmp(key, "max_ss") == 0 ) {
+ panel->max_ss = atof(val);
+ panel->is_fsss = 1;
} else {
ERROR("Unrecognised field '%s'\n", key);
}
@@ -1008,22 +1047,22 @@ struct detector *get_detector_geometry(const char *filename)
for ( i=0; i<det->n_bad; i++ ) {
- if ( isnan(det->bad[i].min_x) ) {
+ if ( !det->bad[i].is_fsss && isnan(det->bad[i].min_x) ) {
ERROR("Please specify the minimum x coordinate for"
" bad region %s\n", det->bad[i].name);
reject = 1;
}
- if ( isnan(det->bad[i].min_y) ) {
+ if ( !det->bad[i].is_fsss && isnan(det->bad[i].min_y) ) {
ERROR("Please specify the minimum y coordinate for"
" bad region %s\n", det->bad[i].name);
reject = 1;
}
- if ( isnan(det->bad[i].max_x) ) {
+ if ( !det->bad[i].is_fsss && isnan(det->bad[i].max_x) ) {
ERROR("Please specify the maximum x coordinate for"
" bad region %s\n", det->bad[i].name);
reject = 1;
}
- if ( isnan(det->bad[i].max_y) ) {
+ if ( !det->bad[i].is_fsss && isnan(det->bad[i].max_y) ) {
ERROR("Please specify the maximum y coordinate for"
" bad region %s\n", det->bad[i].name);
reject = 1;
diff --git a/libcrystfel/src/detector.h b/libcrystfel/src/detector.h
index e44147eb..c63326fb 100644
--- a/libcrystfel/src/detector.h
+++ b/libcrystfel/src/detector.h
@@ -102,10 +102,19 @@ struct panel
struct badregion
{
char name[1024];
+ int is_fsss;
+
double min_x;
double max_x;
double min_y;
double max_y;
+
+ /* Specified INCLUSIVELY */
+ int min_fs;
+ int max_fs;
+ int min_ss;
+ int max_ss;
+
};