From 1387f67057ff8b90017e0485fea84851195b46c3 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 24 Oct 2017 15:15:09 +0200 Subject: Read debug indexing from file --- libcrystfel/src/index.c | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'libcrystfel/src/index.c') diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index ae136a6c..20595604 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -108,11 +108,33 @@ static void show_indexing_flags(IndexingFlags flags) static int debug_index(struct image *image) { - Crystal *cr = crystal_new(); - UnitCell *cell = cell_new(); - cell_set_reciprocal(cell, +0.0000e9, +0.0000e9, +0.0000e9, - +0.0000e9, +0.0000e9, +0.0000e9, - +0.0000e9, +0.0000e9, +0.0000e9); + FILE *fh; + Crystal *cr; + UnitCell *cell; + float asx, asy, asz, bsx, bsy, bsz, csx, csy, csz; + + fh = fopen("../../indexing.debug", "r"); + if ( fh == NULL ) { + ERROR("indexing.debug not found\n"); + return 0; + } + + if ( fscanf(fh, "%e %e %e", &asx, &asy, &asz) != 3 ) { + ERROR("Failed to read a* from indexing.debug\n"); + return 0; + } + if ( fscanf(fh, "%e %e %e", &bsx, &bsy, &bsz) != 3 ) { + ERROR("Failed to read b* from indexing.debug\n"); + return 0; + } + if ( fscanf(fh, "%e %e %e", &csx, &csy, &csz) != 3 ) { + ERROR("Failed to read c* from indexing.debug\n"); + return 0; + } + + cr = crystal_new(); + cell = cell_new(); + cell_set_reciprocal(cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); crystal_set_cell(cr, cell); image_add_crystal(image, cr); return 1; -- cgit v1.2.3