diff options
author | Thomas White <taw@physics.org> | 2011-03-16 14:18:02 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:20 +0100 |
commit | 14d12aa55a6e342d7a7c83b90e88d68e11be0e7a (patch) | |
tree | 875e78ee3c809d6f9b64c2aba5d389f5bede1597 | |
parent | 193c900d095203fb74671abc1e0b52f0b1d6d62a (diff) |
--record=peaksifnotindexed option
-rw-r--r-- | src/indexamajig.c | 17 | ||||
-rw-r--r-- | src/stream.c | 25 | ||||
-rw-r--r-- | src/stream.h | 11 |
3 files changed, 40 insertions, 13 deletions
diff --git a/src/indexamajig.c b/src/indexamajig.c index f53e4d85..e1e0e8fd 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -132,17 +132,20 @@ static void show_help(const char *s) "\n\n" "You can control what information is included in the output stream using\n" "' --record=<flags>'. Possible flags are:\n\n" -" pixels Include a list of sums of pixel values within the\n" -" integration domain, correcting for individual pixel\n" -" solid angles.\n" +" pixels Include a list of sums of pixel values within the\n" +" integration domain, correcting for individual pixel\n" +" solid angles.\n" "\n" -" integrated Include a list of reflection intensities, produced by\n" -" integrating around predicted peak locations.\n" +" integrated Include a list of reflection intensities, produced by\n" +" integrating around predicted peak locations.\n" "\n" -" peaks Include peak locations and intensities from the peak search.\n" +" peaks Include peak locations and intensities from the peak\n" +" search.\n" "\n" -" peaksifindexed As 'peaks', but only if the pattern could be indexed.\n\n" +" peaksifindexed As 'peaks', but only if the pattern could be indexed.\n" "\n" +" peaksifnotindexed As 'peaks', but only if the pattern could NOT be indexed.\n" +"\n\n" "The default is '--record=integrated'. The flags 'pixels' and 'integrated'\n" "are mutually exclusive, as are the flags 'peaks' and 'peaksifindexed'.\n" "\n\n" diff --git a/src/stream.c b/src/stream.c index 7aaa74fd..545bed43 100644 --- a/src/stream.c +++ b/src/stream.c @@ -69,6 +69,10 @@ int parse_stream_flags(const char *a) exclusive("peaks", "peaksifindexed"); return -1; } + if ( ret & STREAM_PEAKS_IF_NOT_INDEXED ) { + exclusive("peaks", "peaksifnotindexed"); + return -1; + } ret |= STREAM_PEAKS; } else if ( strcmp(flags[i], "peaksifindexed") == 0) { @@ -76,8 +80,25 @@ int parse_stream_flags(const char *a) exclusive("peaks", "peaksifindexed"); return -1; } + if ( ret & STREAM_PEAKS_IF_NOT_INDEXED ) { + exclusive("peaksifnotindexed", + "peaksifindexed"); + return -1; + } ret |= STREAM_PEAKS_IF_INDEXED; + } else if ( strcmp(flags[i], "peaksifnotindexed") == 0) { + if ( ret & STREAM_PEAKS ) { + exclusive("peaks", "peaksifnotindexed"); + return -1; + } + if ( ret & STREAM_PEAKS_IF_INDEXED ) { + exclusive("peaksifnotindexed", + "peaksifindexed"); + return -1; + } + ret |= STREAM_PEAKS_IF_NOT_INDEXED; + } else { ERROR("Unrecognised stream flag '%s'\n", flags[i]); return 0; @@ -267,7 +288,9 @@ void write_chunk(FILE *ofh, struct image *i, int f) J_to_eV(ph_lambda_to_en(i->lambda))); if ( (f & STREAM_PEAKS) - || ((f & STREAM_PEAKS_IF_INDEXED) && (i->indexed_cell != NULL)) ) { + || ((f & STREAM_PEAKS_IF_INDEXED) && (i->indexed_cell != NULL)) + || ((f & STREAM_PEAKS_IF_NOT_INDEXED) && (i->indexed_cell == NULL)) ) + { fprintf(ofh, "\n"); write_peaks(i, ofh); } diff --git a/src/stream.h b/src/stream.h index c0343b2a..df02b1fb 100644 --- a/src/stream.h +++ b/src/stream.h @@ -22,11 +22,12 @@ struct image; /* Possible options dictating what goes into the output stream */ enum { - STREAM_NONE = 0, - STREAM_INTEGRATED = 1<<0, - STREAM_PIXELS = 1<<1, - STREAM_PEAKS = 1<<2, - STREAM_PEAKS_IF_INDEXED = 1<<3, + STREAM_NONE = 0, + STREAM_INTEGRATED = 1<<0, + STREAM_PIXELS = 1<<1, + STREAM_PEAKS = 1<<2, + STREAM_PEAKS_IF_INDEXED = 1<<3, + STREAM_PEAKS_IF_NOT_INDEXED = 1<<4, }; |