aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2016-08-11 10:49:39 +0200
committerThomas White <taw@physics.org>2016-08-11 10:52:31 +0200
commit8785e174d9724d578bbf7e2811b9d60378a8fc4c (patch)
tree83ab27ac627e91a29ade6d17e3ec7ed8561e4a12 /libcrystfel
parent6165c653343746f718227d003e065f6715f6c87f (diff)
Take rail direction as a vector rather than individual x,y,z values
Just to make it more consistent with fs/ss directions
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/detector.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index f0e49d3a..268fe77f 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -897,12 +897,14 @@ static int parse_field_for_panel(struct panel *panel, const char *key,
panel->cnx = atof(val);
} else if ( strcmp(key, "corner_y") == 0 ) {
panel->cny = atof(val);
- } else if ( strcmp(key, "rail_x") == 0 ) {
- panel->rail_x = atof(val);
- } else if ( strcmp(key, "rail_y") == 0 ) {
- panel->rail_y = atof(val);
- } else if ( strcmp(key, "rail_z") == 0 ) {
- panel->rail_z = atof(val);
+ } else if ( strcmp(key, "rail_direction") == 0 ) {
+ if ( dir_conv(val, &panel->rail_x,
+ &panel->rail_y,
+ &panel->rail_z) )
+ {
+ ERROR("Invalid rail direction '%s'\n", val);
+ reject = 1;
+ }
} else if ( strcmp(key, "clen_for_centering") == 0 ) {
panel->clen_for_centering = atof(val);
} else if ( strcmp(key, "adu_per_eV") == 0 ) {
@@ -1537,9 +1539,7 @@ struct detector *get_detector_geometry_2(const char *filename,
reject = 1;
}
- if ( isnan(p->clen_for_centering)
- && ( !isnan(p->rail_x) || !isnan(p->rail_y)
- || !isnan(p->rail_z) ) )
+ if ( isnan(p->clen_for_centering) && !isnan(p->rail_x) )
{
ERROR("You must specify clen_for_centering if you "
"specify the rail direction (panel %s)\n",
@@ -1548,9 +1548,11 @@ struct detector *get_detector_geometry_2(const char *filename,
}
/* The default rail direction */
- if ( isnan(p->rail_x) ) p->rail_x = 0.0;
- if ( isnan(p->rail_y) ) p->rail_y = 0.0;
- if ( isnan(p->rail_z) ) p->rail_z = 1.0;
+ if ( isnan(p->rail_x) ) {
+ p->rail_x = 0.0;
+ p->rail_y = 0.0;
+ p->rail_z = 1.0;
+ }
if ( isnan(p->clen_for_centering) ) p->clen_for_centering = 0.0;
/* It's OK if the badrow direction is '0' */