aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/man/crystfel_geometry.56
-rw-r--r--libcrystfel/src/datatemplate.c7
-rw-r--r--libcrystfel/src/datatemplate_priv.h4
-rw-r--r--libcrystfel/src/image.c11
4 files changed, 25 insertions, 3 deletions
diff --git a/doc/man/crystfel_geometry.5 b/doc/man/crystfel_geometry.5
index eef98486..b8674f13 100644
--- a/doc/man/crystfel_geometry.5
+++ b/doc/man/crystfel_geometry.5
@@ -94,6 +94,12 @@ mask_good = 0x27
mask_bad = 0x00
.PD 0
+.IP "\fBdetector_shift_x = \fInnn \fB[m|mm]"
+.IP "\fBdetector_shift_y = \fInnn \fB[m|mm]"
+.PD
+These specify that the entire detector should be shifted by this amount in the x and y directions. The units should be specified as \fBm\fR or \fBmm\fR. If units are not specified, the value will be taken as metres. \fInnn\fR can be a file metadata location (e.g. an HDF5 path).
+
+.PD 0
.IP "\fBpeak_list = \fIloc"
.PD
This gives the location of the peak list (for \fB--peaks=cxi\fR or \fB--peaks=hdf5\fR - see indexamajig(1)) in the data files.
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c
index 65da1a54..cc028025 100644
--- a/libcrystfel/src/datatemplate.c
+++ b/libcrystfel/src/datatemplate.c
@@ -756,6 +756,11 @@ static int parse_toplevel(DataTemplate *dt,
return 1;
}
+ } else if ( strcmp(key, "detector_shift_x") == 0 ) {
+ dt->shift_x_from = strdup(val);
+
+ } else if ( strcmp(key, "detector_shift_y") == 0 ) {
+ dt->shift_y_from = strdup(val);
} else if ( strcmp(key, "photon_energy") == 0 ) {
return parse_photon_energy(val,
@@ -872,6 +877,8 @@ DataTemplate *data_template_new_from_string(const char *string_in)
dt->rigid_group_collections = NULL;
dt->photon_energy_bandwidth = -1.0;
dt->peak_list = NULL;
+ dt->shift_x_from = NULL;
+ dt->shift_y_from = NULL;
/* The default defaults... */
defaults.orig_min_fs = -1;
diff --git a/libcrystfel/src/datatemplate_priv.h b/libcrystfel/src/datatemplate_priv.h
index 75492db5..e9ce3ccb 100644
--- a/libcrystfel/src/datatemplate_priv.h
+++ b/libcrystfel/src/datatemplate_priv.h
@@ -202,6 +202,10 @@ struct _datatemplate
int n_rg_collections;
char *peak_list;
+
+ /* Shift of whole detector, in m */
+ char * shift_x_from;
+ char * shift_y_from;
};
#endif /* DATATEMPLATE_PRIV_H */
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 47cbfea7..b70b920f 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -340,7 +340,8 @@ static char *get_value_and_units(struct image *image, const char *from,
}
-static double get_length(struct image *image, const char *from)
+static double get_length(struct image *image, const char *from,
+ double default_scale)
{
char *units;
double value;
@@ -348,7 +349,7 @@ static double get_length(struct image *image, const char *from)
units = get_value_and_units(image, from, &value);
if ( units == NULL ) {
- scale = 1.0e-3;
+ scale = default_scale;
} else {
if ( strcmp(units, "mm") == 0 ) {
scale = 1e-3;
@@ -421,13 +422,17 @@ void create_detgeom(struct image *image, const DataTemplate *dtempl)
/* NB cnx,cny are in pixels, cnz is in m */
detgeom->panels[i].cnx = dtempl->panels[i].cnx;
detgeom->panels[i].cny = dtempl->panels[i].cny;
- detgeom->panels[i].cnz = get_length(image, dtempl->panels[i].cnz_from);
+ detgeom->panels[i].cnz = get_length(image, dtempl->panels[i].cnz_from, 1e-3);
/* Apply offset (in m) and then convert cnz from
* m to pixels */
detgeom->panels[i].cnz += dtempl->panels[i].cnz_offset;
detgeom->panels[i].cnz /= detgeom->panels[i].pixel_pitch;
+ /* Apply overall shift (already in m) */
+ detgeom->panels[i].cnx += get_length(image, dtempl->shift_x_from, 1.0);
+ detgeom->panels[i].cny += get_length(image, dtempl->shift_y_from, 1.0);
+
detgeom->panels[i].max_adu = dtempl->panels[i].max_adu;
switch ( dtempl->panels[i].adu_scale_unit ) {