diff options
author | Thomas White <taw@physics.org> | 2015-04-16 15:17:00 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-04-20 12:56:03 +0200 |
commit | b91dbbe0052f17b44ba0b47befe46a4567906c33 (patch) | |
tree | ef4880edcfa647dab961ce95a3fd124c58468146 /libcrystfel | |
parent | 4a5c2b7ac8c1c514a33d575a9a9ecba69a2129d3 (diff) |
Add INDEXING_DEBUG
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/index.c | 32 | ||||
-rw-r--r-- | libcrystfel/src/index.h | 6 |
2 files changed, 36 insertions, 2 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index c3f7c35d..9ac5b3cc 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -55,6 +55,19 @@ #include "grainspotter.h" +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); + crystal_set_cell(cr, cell); + image_add_crystal(image, cr); + return 1; +} + + IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, struct detector *det, float *ltl) { @@ -96,6 +109,10 @@ IndexingPrivate **prepare_indexing(IndexingMethod *indm, UnitCell *cell, det, ltl); break; + case INDEXING_DEBUG : + iprivs[n] = (IndexingPrivate *)strdup("Hello!"); + break; + default : ERROR("Don't know how to prepare indexing method %i\n", indm[n]); @@ -166,6 +183,10 @@ void cleanup_indexing(IndexingMethod *indms, IndexingPrivate **privs) grainspotter_cleanup(privs[n]); break; + case INDEXING_DEBUG : + free(privs[n]); + break; + default : ERROR("Don't know how to clean up indexing method %i\n", indms[n]); @@ -231,6 +252,9 @@ static int try_indexer(struct image *image, IndexingMethod indm, return grainspotter_index(image, ipriv); break; + case INDEXING_DEBUG : + return debug_index(image); + default : ERROR("Unrecognised indexing method: %i\n", indm); break; @@ -369,6 +393,10 @@ char *indexer_str(IndexingMethod indm) strcpy(str, "simulation"); break; + case INDEXING_DEBUG : + strcpy(str, "debug"); + break; + default : ERROR("Unrecognised indexing method %i\n", indm & INDEXING_METHOD_MASK); @@ -442,6 +470,10 @@ IndexingMethod *build_indexer_list(const char *str) list[++nmeth] = INDEXING_SIMULATION; return list; + } else if ( strcmp(methods[i], "debug") == 0) { + list[++nmeth] = INDEXING_DEBUG; + return list; + } else if ( strcmp(methods[i], "raw") == 0) { list[nmeth] = set_raw(list[nmeth]); diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h index 0e105aeb..dcb21858 100644 --- a/libcrystfel/src/index.h +++ b/libcrystfel/src/index.h @@ -3,13 +3,13 @@ * * Perform indexing (somehow) * - * Copyright © 2012-2014 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Richard Kirian * Copyright © 2012 Lorenzo Galli * * Authors: - * 2010-2014 Thomas White <taw@physics.org> + * 2010-2015 Thomas White <taw@physics.org> * 2010 Richard Kirian * 2012 Lorenzo Galli * @@ -69,6 +69,7 @@ * @INDEXING_GRAINSPOTTER: Invoke GrainSpotter * @INDEXING_XDS: Invoke XDS * @INDEXING_SIMULATION: Dummy value + * @INDEXING_DEBUG: Results injector for debugging * @INDEXING_CHECK_CELL_COMBINATIONS: Check linear combinations of unit cell * axes for agreement with given cell. * @INDEXING_CHECK_CELL_AXES: Check unit cell axes for agreement with given @@ -95,6 +96,7 @@ typedef enum { INDEXING_GRAINSPOTTER = 4, INDEXING_XDS = 5, INDEXING_SIMULATION = 6, + INDEXING_DEBUG = 7, /* Bits at the top of the IndexingMethod are flags which modify the * behaviour of the indexer. */ |