diff options
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/index.c | 42 | ||||
-rw-r--r-- | libcrystfel/src/index.h | 1 | ||||
-rw-r--r-- | libcrystfel/src/stream.c | 20 | ||||
-rw-r--r-- | libcrystfel/src/stream.h | 1 |
4 files changed, 59 insertions, 5 deletions
diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index 8ac04368..8a390d71 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -283,10 +283,13 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, } for ( i=0; i<n; i++ ) { - methods[i] = get_indm_from_string(method_strings[i]); - if ( methods[i] == INDEXING_ERROR ) { + int err = 0; + methods[i] = get_indm_from_string_2(method_strings[i], &err); + if ( err ) { ERROR("----- Notice -----\n"); - ERROR("The way indexing options are used has changed in this CrystFEL version.\n"); + ERROR("The way indexing options are given has changed in this CrystFEL version.\n"); + ERROR("The indexing method should contain only the method itself and "); + ERROR("prior information modifiers ('cell' or 'latt')\n"); ERROR("To disable prediction refinement ('norefine'), use --no-refine.\n"); ERROR("To check cell axes only ('axes'), use --no-cell-combinations.\n"); ERROR("To disable all unit cell checks ('raw'), use --no-check-cell.\n"); @@ -297,6 +300,7 @@ IndexingPrivate *setup_indexing(const char *method_list, UnitCell *cell, free(methods); return NULL; } + } /* No cell parameters -> no cell checking, no prior cell */ @@ -877,13 +881,15 @@ static IndexingMethod warn_method(const char *str) } -IndexingMethod get_indm_from_string(const char *str) +IndexingMethod get_indm_from_string_2(const char *str, int *err) { int n, i; char **bits; IndexingMethod method = INDEXING_NONE; int have_method = 0; + if ( err != NULL ) *err = 0; + n = assplode(str, "-", &bits, ASSPLODE_NONE); for ( i=0; i<n; i++ ) { @@ -945,6 +951,28 @@ IndexingMethod get_indm_from_string(const char *str) } else if ( strcmp(bits[i], "nocell") == 0) { method = set_nocellparams(method); + /* Deprecated options */ + } else if ( strcmp(bits[i], "retry") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "noretry") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "multi") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "nomulti") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "refine") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "norefine") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "raw") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "bad") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "comb") == 0) { + if ( err != NULL ) *err = 1; + } else if ( strcmp(bits[i], "axes") == 0) { + if ( err != NULL ) *err = 1; + } else { ERROR("Bad list of indexing methods: '%s'\n", str); return INDEXING_ERROR; @@ -959,3 +987,9 @@ IndexingMethod get_indm_from_string(const char *str) return method; } + + +IndexingMethod get_indm_from_string(const char *str) +{ + return get_indm_from_string_2(str, NULL); +} diff --git a/libcrystfel/src/index.h b/libcrystfel/src/index.h index ac386390..ae5185db 100644 --- a/libcrystfel/src/index.h +++ b/libcrystfel/src/index.h @@ -130,6 +130,7 @@ typedef struct _indexingprivate IndexingPrivate; /* Convert indexing methods to/from text */ extern char *indexer_str(IndexingMethod indm); extern IndexingMethod get_indm_from_string(const char *method); +extern IndexingMethod get_indm_from_string_2(const char *method, int *err); #include "detector.h" #include "cell.h" diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index fb4b0c70..d7d997cf 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -67,8 +67,18 @@ struct _stream int minor_version; long long int ln; + + int old_indexers; /* True if the stream reader encountered a deprecated + * indexing method */ }; + +int stream_has_old_indexers(Stream *st) +{ + return st->old_indexers; +} + + static int read_peaks(Stream *st, struct image *image) { char *rval = NULL; @@ -1196,10 +1206,14 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf) } if ( strncmp(line, "indexed_by = ", 13) == 0 ) { - image->indexed_by = get_indm_from_string(line+13); + int err = 0; + image->indexed_by = get_indm_from_string_2(line+13, &err); if ( image->indexed_by == INDEXING_ERROR ) { ERROR("Failed to read indexer list\n"); } + if ( err ) { + st->old_indexers = 1; + } } if ( strncmp(line, "photon_energy_eV = ", 19) == 0 ) { @@ -1327,6 +1341,7 @@ Stream *open_stream_for_read(const char *filename) st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; + st->old_indexers = 0; if ( strcmp(filename, "-") == 0 ) { st->fh = stdin; @@ -1393,6 +1408,7 @@ Stream *open_stream_fd_for_write(int fd) st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; + st->old_indexers = 0; st->fh = fdopen(fd, "w"); if ( st->fh == NULL ) { @@ -1442,6 +1458,7 @@ Stream *open_stream_for_write_3(const char *filename, st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; + st->old_indexers = 0; st->fh = fopen(filename, "w"); if ( st->fh == NULL ) { @@ -1493,6 +1510,7 @@ Stream *open_stream_for_write_2(const char *filename, st = malloc(sizeof(struct _stream)); if ( st == NULL ) return NULL; + st->old_indexers = 0; st->fh = fopen(filename, "w"); if ( st->fh == NULL ) { diff --git a/libcrystfel/src/stream.h b/libcrystfel/src/stream.h index 764e3e36..2ed7b050 100644 --- a/libcrystfel/src/stream.h +++ b/libcrystfel/src/stream.h @@ -106,6 +106,7 @@ extern void close_stream(Stream *st); extern int read_chunk(Stream *st, struct image *image); extern int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf); +extern int stream_has_old_indexers(Stream *st); extern int write_chunk(Stream *st, struct image *image, struct imagefile *imfile, int include_peaks, int include_reflections, |