aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2014-09-24 13:39:28 +0200
committerThomas White <taw@physics.org>2014-09-24 13:39:28 +0200
commit10f77e1e2f11baae436bb149066625d295ae521a (patch)
treed5c7e382dce73695ced86d0af895877bf13b2086 /libcrystfel/src/detector.c
parentf88f11adb68b7b11dbc653543c989108aeb96a8f (diff)
Move photon_energy to "geometry" file
Diffstat (limited to 'libcrystfel/src/detector.c')
-rw-r--r--libcrystfel/src/detector.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index e5319000..9972e2ba 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -820,6 +820,15 @@ static void parse_toplevel(struct detector *det, struct beam_params *beam,
beam->photon_energy_from = NULL;
}
+ } else if ( strcmp(key, "photon_energy_scale") == 0 ) {
+ if ( beam == NULL ) {
+ ERROR("Geometry file contains a reference to "
+ "photon_energy_scale, which is inappropriate in "
+ "this situation.\n");
+ } else {
+ beam->photon_energy_scale = atof(val);
+ }
+
} else if ( parse_field_for_panel(&det->defaults, key, val, det) ) {
ERROR("Unrecognised top level field '%s'\n", key);
}
@@ -908,6 +917,9 @@ struct detector *get_detector_geometry(const char *filename,
return NULL;
}
+ beam->photon_energy = -1.0;
+ beam->photon_energy_scale = 1.0;
+
det->n_panels = 0;
det->panels = NULL;
det->n_bad = 0;
@@ -1247,6 +1259,12 @@ struct detector *get_detector_geometry(const char *filename,
}
}
+ if ( beam->photon_energy < -0.5 ) {
+ STATUS("Photon energy must be specified (note: this is now "
+ "done in the 'geometry' file.\n");
+ reject = 1;
+ }
+
for ( x=0; x<=max_fs; x++ ) {
for ( y=0; y<=max_ss; y++ ) {
if ( find_panel(det, x, y) == NULL ) {