diff options
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r-- | libcrystfel/src/detector.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index e160d1e1..b2e3cc58 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -1076,12 +1076,17 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam, } else if ( strcmp(key, "photon_energy") == 0 ) { if ( beam != NULL ) { - if ( strncmp(val, "/", 1) == 0 ) { + + double v; + char *end; + + v = strtod(val, &end); + if ( (val[0] != '\0') && (end[0] == '\0') ) { + beam->photon_energy = v; + beam->photon_energy_from = NULL; + } else { beam->photon_energy = 0.0; beam->photon_energy_from = strdup(val); - } else { - beam->photon_energy = atof(val); - beam->photon_energy_from = NULL; } } |