From 38073031bfad2da698cfc85790adc0c8277c9837 Mon Sep 17 00:00:00 2001 From: Valerio Mariani Date: Fri, 25 Jul 2014 11:00:50 +0200 Subject: More bugfixes for multi-event mode --- libcrystfel/src/stream.c | 38 +++++++++++++++++++++++++++----------- src/process_hkl.c | 3 ++- 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index a826dc02..66e8a179 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -138,16 +138,26 @@ static int read_peaks_2_3(FILE *fh, struct image *image) first = 0; - p = find_panel_by_name(image->det, pn); + if ( r == 5 ) { - add_x = x-p->orig_min_fs+p->min_fs; - add_y = x-p->orig_min_ss+p->min_ss; - if ( r == 5 ) { + p = find_panel_by_name(image->det, pn); + if ( p == NULL ) { + ERROR("Panel not found: %s\n"); + return 1; + } + + add_x = x-p->orig_min_fs+p->min_fs; + add_y = x-p->orig_min_ss+p->min_ss; + image_add_feature(image->features, add_x, add_y, image, intensity, NULL); + + printf("Here4\n"); + } + } while ( rval != NULL ); /* Got read error of some kind before finding PEAK_LIST_END_MARKER */ @@ -250,6 +260,7 @@ static RefList *read_stream_reflections_2_3(FILE *fh, struct detector *det) } first = 0; + if ( r == 10 ) { double ph; @@ -257,12 +268,14 @@ static RefList *read_stream_reflections_2_3(FILE *fh, struct detector *det) struct panel *p; float write_fs, write_ss; - p = find_panel_by_name(det,pn); refl = add_refl(out, h, k, l); set_intensity(refl, intensity); - write_ss = ss-p->orig_min_ss+p->min_ss; - write_fs = fs-p->orig_min_fs+p->min_fs; - set_detector_pos(refl, 0.0, write_fs, write_ss); + if ( det != NULL ) { + p = find_panel_by_name(det,pn); + set_detector_pos(refl, 0.0, write_fs, write_ss); + write_ss = ss-p->orig_min_ss+p->min_ss; + write_fs = fs-p->orig_min_fs+p->min_fs; + } set_esd_intensity(refl, sigma); set_redundancy(refl, cts); ph = strtod(phs, &v); @@ -972,7 +985,8 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf) } } - if ( strcmp(line, PEAK_LIST_START_MARKER) == 0 ) { + if ( (srf & STREAM_READ_PEAKS) + && strcmp(line, PEAK_LIST_START_MARKER) == 0 ) { int fail; @@ -988,8 +1002,7 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf) } if ( (srf & STREAM_READ_CRYSTALS) - && (strcmp(line, CRYSTAL_START_MARKER) == 0) ) - { + && (strcmp(line, CRYSTAL_START_MARKER) == 0) ) { read_crystal(st, image, srf); } @@ -1065,6 +1078,9 @@ Stream *open_stream_for_read(const char *filename) } else if ( strncmp(line, "CrystFEL stream format 2.2", 26) == 0 ) { st->major_version = 2; st->minor_version = 2; + } else if ( strncmp(line, "CrystFEL stream format 2.3", 26) == 0 ) { + st->major_version = 2; + st->minor_version = 3; } else { ERROR("Invalid stream, or stream format is too new.\n"); close_stream(st); diff --git a/src/process_hkl.c b/src/process_hkl.c index 2497215a..cd8640a9 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -337,7 +337,8 @@ static int merge_all(Stream *st, RefList *model, RefList *reference, image.det = NULL; /* Get data from next chunk */ - rval = read_chunk(st, &image); + rval = read_chunk_2(st, &image, STREAM_READ_REFLECTIONS | + STREAM_READ_UNITCELL); if ( rval ) break; n_images++; -- cgit v1.2.3