diff options
author | Thomas White <taw@physics.org> | 2015-03-17 17:26:07 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-04-20 15:50:39 +0200 |
commit | c18a02f6e07ad21fee5c7e6a1fc0e6f64efba17c (patch) | |
tree | ed1c40981a93eaacbc8dd16a38d8eb7cb08d9e19 | |
parent | e9bdc3984e6693aff913e37c0d6afebec6511530 (diff) |
Throw out crystals which could not be refined
-rw-r--r-- | libcrystfel/src/stream.c | 5 | ||||
-rw-r--r-- | src/process_image.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 78ac9a40..abc08c06 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -842,7 +842,10 @@ int write_chunk(Stream *st, struct image *i, struct hdfile *hdfile, } for ( j=0; j<i->n_crystals; j++ ) { - ret = write_crystal(st, i->crystals[j], include_reflections); + if ( crystal_get_user_flag(i->crystals[j]) == 0 ) { + ret = write_crystal(st, i->crystals[j], + include_reflections); + } } fprintf(st->fh, CHUNK_END_MARKER"\n"); diff --git a/src/process_image.c b/src/process_image.c index 6ad5c00e..da9f3f4a 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -282,9 +282,9 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, } free(rn); - pargs->n_crystals = image.n_crystals; for ( i=0; i<image.n_crystals; i++ ) { crystal_set_image(image.crystals[i], &image); + crystal_set_user_flag(image.crystals[i], 0); } /* Set beam/crystal parameters */ @@ -330,6 +330,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, if ( refine_prediction(&image, image.crystals[i]) ) { ERROR("Prediction refinement failed.\n"); + crystal_set_user_flag(image.crystals[i], 1); continue; } @@ -382,6 +383,14 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, get_event_string(image.event)); } + /* Count crystals which are still good */ + pargs->n_crystals = 0; + for ( i=0; i<image.n_crystals; i++ ) { + if ( crystal_get_user_flag(image.crystals[i]) == 0 ) { + pargs->n_crystals++; + } + } + for ( i=0; i<image.n_crystals; i++ ) { cell_free(crystal_get_cell(image.crystals[i])); reflist_free(crystal_get_reflections(image.crystals[i])); |