aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2011-03-29 15:29:33 +0200
committerThomas White <taw@physics.org>2012-02-22 15:27:22 +0100
commit0215205efb28d4ea24b93ce4005f4668a358cc32 (patch)
tree47b42b4c5b7b82a164a4513311ecd6948e8dfba7 /src/detector.c
parentabb1edf5301c36a814e65b9851c0848e35f82173 (diff)
Improve bad pixel handling
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c
index 3a00607a..95cbc08a 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -464,6 +464,36 @@ static int parse_field_bad(struct badregion *panel, const char *key,
}
+static void parse_toplevel(struct detector *det, const char *key,
+ const char *val)
+{
+ if ( strcmp(key, "mask") == 0 ) {
+
+ det->mask = strdup(val);
+
+ } else if ( strcmp(key, "mask_bad") == 0 ) {
+
+ char *end;
+ double v = strtod(val, &end);
+
+ if ( end != val ) {
+ det->mask_bad = v;
+ }
+
+ } else if ( strcmp(key, "mask_good") == 0 ) {
+
+ char *end;
+ double v = strtod(val, &end);
+
+ if ( end != val ) {
+ det->mask_good = v;
+ }
+
+ } else {
+ ERROR("Unrecognised top level field '%s'\n", key);
+ }
+}
+
struct detector *get_detector_geometry(const char *filename)
{
FILE *fh;
@@ -516,6 +546,7 @@ struct detector *get_detector_geometry(const char *filename)
n2 = assplode(bits[0], "/\\.", &path, ASSPLODE_NONE);
if ( n2 < 2 ) {
/* This was a top-level option, but not handled above. */
+ parse_toplevel(det, bits[0], bits[2]);
for ( i=0; i<n1; i++ ) free(bits[i]);
free(bits);
for ( i=0; i<n2; i++ ) free(path[i]);