From c194bf7746e3635571808856f29434499eec55b7 Mon Sep 17 00:00:00 2001 From: Valerio Mariani Date: Tue, 25 Mar 2014 17:35:07 +0100 Subject: Refactoring of peaks and reflections I/O --- libcrystfel/src/detector.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'libcrystfel/src/detector.c') diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c index 4681ab28..a7829474 100644 --- a/libcrystfel/src/detector.c +++ b/libcrystfel/src/detector.c @@ -1488,3 +1488,43 @@ void mark_resolution_range_as_bad(struct image *image, } } + + +extern int single_source (struct detector *det, char *element) +{ + int pi; + char *first_datafrom = NULL; + char *curr_datafrom = NULL; + + if ( det->panels[0].data_from == NULL ) { + if ( element != NULL ) { + first_datafrom = strdup(element); + } else { + first_datafrom = strdup("/data/data"); + } + } else { + first_datafrom = strdup(det->panels[0].data_from); + } + + for ( pi=1;pin_panels;pi++ ) { + + if ( det->panels[pi].data_from == NULL ) { + if ( element != NULL ) { + curr_datafrom = strdup(element); + } else { + curr_datafrom = strdup("/data/data"); + } + } else { + curr_datafrom = strdup(det->panels[pi].data_from); + } + + if ( strcmp(curr_datafrom, first_datafrom) != 0 ) { + return 0; + } + } + + free(first_datafrom); + free(curr_datafrom); + + return 1; +} -- cgit v1.2.3