aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-24 15:15:09 +0200
committerThomas White <taw@physics.org>2018-02-27 17:12:41 +0100
commit1387f67057ff8b90017e0485fea84851195b46c3 (patch)
tree37f0abd11f68a50469d2791aa050f7a41ee25b1c /libcrystfel
parentd761f0f2167a1acaabef151de031fdc5953ec26a (diff)
Read debug indexing from file
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/index.c32
1 files changed, 27 insertions, 5 deletions
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;