aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--doc/man/crystfel_geometry.56
-rw-r--r--libcrystfel/src/detector.c26
2 files changed, 16 insertions, 16 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5
index ed3b6a68..47ca5138 100644
--- a/doc/man/crystfel_geometry.5
+++ b/doc/man/crystfel_geometry.5
@@ -211,12 +211,10 @@ mask_bad = 0x00
Set this to 1 or "true" to ignore this panel completely.
.PD 0
-.IP \fBrail_x\fR
-.IP \fBrail_y\fR
-.IP \fBrail_z\fR
+.IP \fBrail_direction\fR
.IP \fBclen_for_centering\fR
.PD
-Specify the direction in which the panel should move when the camera length is increased. \fBclen_for_centering\fR is the camera length at which the central beam intersects the centre of the detector. If you've only calibrated the detector at one camera length, perhaps using prior known values for the rail direction, then this should be the camera length at which you calibrated the detector. \fBclen_for_centering\fR is the camera length \fBbefore\fR applying the \fBcoffset\fR, i.e. for CSPAD/CXI/LCLS data this value should be an "encoder value" in metres. If you specify any of the rail_{x,y,z} values, you must also specify clen_for_centering. The default is for the panel to move in the +z direction, so rail_x=0, rail_y=0, rail_z=1 and clen_for_centering is irrelevant. The square root of the sum of the squares of the rail values (i.e. the modulus of the "rail vector") should normally be equal to one. Otherwise, the camera length changes from the centering value will be correspondingly scaled.
+Specify the direction in which the panel should move when the camera length is increased. \fBclen_for_centering\fR is the camera length at which the central beam intersects the centre of the detector. If you've only calibrated the detector at one camera length, perhaps using prior known values for the rail direction, then this should be the camera length at which you calibrated the detector. \fBclen_for_centering\fR is the camera length \fBbefore\fR applying the \fBcoffset\fR, i.e. for CSPAD/CXI/LCLS data this value should be an "encoder value" in metres. If you specify the rail direction, you must also specify clen_for_centering. The default is for the panel to move in the +z direction, so rail_direction = z and clen_for_centering is irrelevant. The modulus of the "rail vector" should normally be equal to one. Otherwise, the camera length changes from the centering value will be correspondingly scaled (which might sometimes be what you want!).
.SH BAD REGIONS
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' */