aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/stream.c
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2016-10-07 15:46:29 +0200
committerThomas White <taw@physics.org>2016-10-10 15:21:56 +0200
commit4f17116d29759077a02d80fd410965f848ffc05f (patch)
treeba4243f7c2a8ec91cd0350841fc882accb61b4ef /libcrystfel/src/stream.c
parent34198e6f92f19dfeb0ee13c0fcc60c82b05f85e3 (diff)
Added detector shift to crystal structure, wrote get and get functions
Diffstat (limited to 'libcrystfel/src/stream.c')
-rw-r--r--libcrystfel/src/stream.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index d374a3d3..c8218790 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -702,6 +702,7 @@ static int write_crystal(Stream *st, Crystal *cr, int include_reflections)
double csx, csy, csz;
double a, b, c, al, be, ga;
double rad;
+ double det_shift_x, det_shift_y;
int ret = 0;
fprintf(st->fh, CRYSTAL_START_MARKER"\n");
@@ -737,6 +738,11 @@ static int write_crystal(Stream *st, Crystal *cr, int include_reflections)
fprintf(st->fh, "%s\n", crystal_get_notes(cr));
}
+ crystal_get_det_shift(cr, &det_shift_x, &det_shift_y);
+
+ fprintf(st->fh, "predict_refine/det_shift x = %.3f y = %.3f mm",
+ det_shift_x*1e3, det_shift_y*1e3);
+
reflist = crystal_get_reflections(cr);
if ( reflist != NULL ) {
@@ -918,6 +924,7 @@ static void read_crystal(Stream *st, struct image *image, StreamReadFlags srf)
Crystal *cr;
int n;
Crystal **crystals_new;
+ double shift_x, shift_y;
as.u = 0.0; as.v = 0.0; as.w = 0.0;
bs.u = 0.0; bs.v = 0.0; bs.w = 0.0;
@@ -1008,6 +1015,12 @@ static void read_crystal(Stream *st, struct image *image, StreamReadFlags srf)
crystal_set_profile_radius(cr, rad*1e9);
}
+ if ( sscanf(line, "predict_refine/det_shift x = %lf "
+ "y = %lf mm\n", &shift_x, &shift_y ) == 2 ) {
+ crystal_set_det_shift(cr, shift_x*1e-3, shift_y*1e-3);
+ }
+
+
if ( (strcmp(line, REFLECTION_START_MARKER) == 0)
&& (srf & STREAM_READ_REFLECTIONS) )
{
@@ -1029,7 +1042,8 @@ static void read_crystal(Stream *st, struct image *image, StreamReadFlags srf)
if ( reflist == NULL ) {
ERROR("Failed while reading reflections\n");
ERROR("Filename = %s\n", image->filename);
- ERROR("Event = %s\n", get_event_string(image->event));
+ ERROR("Event = %s\n",
+ get_event_string(image->event));
break;
}