From dc034839d3f9fed72ef47d75af2e06de266cea4e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 15 Apr 2014 15:35:28 +0200 Subject: Store beam divergence and bandwidth, and crystal profile radius, in stream --- libcrystfel/src/stream.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'libcrystfel/src/stream.c') diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 09bb1631..74b420ed 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -324,6 +324,7 @@ static void write_crystal(Stream *st, Crystal *cr, int include_reflections) double bsx, bsy, bsz; double csx, csy, csz; double a, b, c, al, be, ga; + double rad; fprintf(st->fh, CRYSTAL_START_MARKER"\n"); @@ -351,6 +352,9 @@ static void write_crystal(Stream *st, Crystal *cr, int include_reflections) fprintf(st->fh, "centering = %c\n", cell_get_centering(cell)); fprintf(st->fh, "unique_axis = %c\n", cell_get_unique_axis(cell)); + rad = crystal_get_profile_radius(cr); + fprintf(st->fh, "profile_radius = %.5f nm^-1\n", rad/1e9); + reflist = crystal_get_reflections(cr); if ( reflist != NULL ) { @@ -408,6 +412,9 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile, fprintf(st->fh, "photon_energy_eV = %f\n", J_to_eV(ph_lambda_to_en(i->lambda))); + fprintf(st->fh, "beam_divergence = %.5f mrad\n", i->div*1e3); + fprintf(st->fh, "beam_bandwidth = %.5f %%\n", i->bw*100.0); + copy_hdf5_fields(hdfile, i->copyme, st->fh); if ( i->det != NULL ) { @@ -500,7 +507,7 @@ void read_crystal(Stream *st, struct image *image) do { - float u, v, w, lim; + float u, v, w, lim, rad; char c; rval = fgets(line, 1023, st->fh); @@ -561,6 +568,10 @@ void read_crystal(Stream *st, struct image *image) crystal_set_resolution_limit(cr, lim*1e9); } + if ( sscanf(line, "profile_radius = %f nm^-1", &rad) == 1 ) { + crystal_set_profile_radius(cr, rad*1e9); + } + if ( strcmp(line, REFLECTION_START_MARKER) == 0 ) { RefList *reflist; @@ -643,6 +654,8 @@ int read_chunk(Stream *st, struct image *image) do { + float div, bw; + rval = fgets(line, 1023, st->fh); /* Trouble? */ @@ -668,6 +681,14 @@ int read_chunk(Stream *st, struct image *image) have_ev = 1; } + if ( sscanf(line, "beam_divergence = %f mrad", &div) == 1 ) { + image->div = div/1e3; + } + + if ( sscanf(line, "beam_bandwidth = %f %%", &bw) == 1 ) { + image->bw = bw/100.0; + } + if ( strncmp(line, "camera_length_", 14) == 0 ) { if ( image->det != NULL ) { -- cgit v1.2.3