From 0215205efb28d4ea24b93ce4005f4668a358cc32 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 29 Mar 2011 15:29:33 +0200 Subject: Improve bad pixel handling --- src/detector.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/detector.c') 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