aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-10-18 10:23:25 +0200
committerThomas White <taw@physics.org>2017-10-18 10:23:25 +0200
commit0821a7ddae7901b70ea5ae216c71fe41109fec55 (patch)
treeaf0ee22beb0c6fb4b315449c262a595161b27a8f /libcrystfel
parent7f708ef255f068ef9e91941ac3a0a3d0e04e5ff8 (diff)
indexamajig: Auto-detection of available indexing methods
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/index.c38
-rw-r--r--libcrystfel/src/index.h2
2 files changed, 40 insertions, 0 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c
index 8a390d71..89b8c334 100644
--- a/libcrystfel/src/index.c
+++ b/libcrystfel/src/index.c
@@ -993,3 +993,41 @@ IndexingMethod get_indm_from_string(const char *str)
{
return get_indm_from_string_2(str, NULL);
}
+
+
+static void do_probe(const char *(*func)(UnitCell *cell),
+ UnitCell *cell, char *methods)
+{
+ const char *probe;
+ probe = func(cell);
+ if ( probe != NULL ) {
+ if ( methods[0] != '\0' ) {
+ strcat(methods, ",");
+ }
+ strcat(methods, probe);
+ }
+}
+
+
+char *detect_indexing_methods(UnitCell *cell)
+{
+ char *methods;
+
+ methods = malloc(1024);
+ if ( methods == NULL ) return NULL;
+ methods[0] = '\0';
+
+ do_probe(mosflm_probe, cell, methods);
+ do_probe(dirax_probe, cell, methods);
+ do_probe(asdf_probe, cell, methods);
+ do_probe(xds_probe, cell, methods);
+ /* Don't automatically use Felix (yet) */
+ //do_probe(felix_probe, cell, methods);
+
+ if ( strlen(methods) == 0 ) {
+ free(methods);
+ return NULL;
+ }
+
+ return methods;
+}
diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h
index ae5185db..4e1f1519 100644
--- a/libcrystfel/src/index.h
+++ b/libcrystfel/src/index.h
@@ -143,6 +143,8 @@ extern IndexingPrivate *setup_indexing(const char *methods, UnitCell *cell,
IndexingFlags flags, const char *options,
struct taketwo_options *ttopts);
+extern char *detect_indexing_methods(UnitCell *cell);
+
extern void index_pattern(struct image *image, IndexingPrivate *ipriv);
extern void index_pattern_2(struct image *image, IndexingPrivate *ipriv,