diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cell_explorer.c | 11 | ||||
-rw-r--r-- | src/compare_hkl.c | 30 | ||||
-rw-r--r-- | src/geoptimiser.c | 2 | ||||
-rw-r--r-- | src/get_hkl.c | 4 | ||||
-rw-r--r-- | src/im-sandbox.c | 2 | ||||
-rw-r--r-- | src/indexamajig.c | 67 | ||||
-rw-r--r-- | src/merge.c | 5 | ||||
-rw-r--r-- | src/partialator.c | 6 | ||||
-rw-r--r-- | src/process_hkl.c | 3 | ||||
-rw-r--r-- | src/process_image.c | 3 | ||||
-rw-r--r-- | src/process_image.h | 3 |
11 files changed, 74 insertions, 62 deletions
diff --git a/src/cell_explorer.c b/src/cell_explorer.c index c8bbb069..f6c2c590 100644 --- a/src/cell_explorer.c +++ b/src/cell_explorer.c @@ -658,7 +658,9 @@ static void scan_cells(CellWindow *w) if ( ignore ) continue; - cell_get_parameters(cells[i], &a, &b, &c, &al, &be, &ga); + if ( cell_get_parameters(cells[i], &a, &b, &c, &al, &be, &ga) ) { + continue; + } a *= 1e10; b *= 1e10; c *= 1e10; al = rad2deg(al); be = rad2deg(be); ga = rad2deg(ga); @@ -719,7 +721,10 @@ static void scan_minmax(CellWindow *w) int j; int found = 0; - cell_get_parameters(w->cells[i], &a, &b, &c, &al, &be, &ga); + if ( cell_get_parameters(w->cells[i], &a, &b, &c, &al, &be, &ga) ) { + ERROR("Cell %i is bad\n", i); + continue; + } a *= 1e10; b *= 1e10; c *= 1e10; al = rad2deg(al); be = rad2deg(be); ga = rad2deg(ga); @@ -1555,6 +1560,8 @@ int main(int argc, char *argv[]) return 1; } + gsl_set_error_handler_off(); + w.cells = NULL; w.indms = NULL; w.n_cells = 0; diff --git a/src/compare_hkl.c b/src/compare_hkl.c index 51e51dc9..81f12c94 100644 --- a/src/compare_hkl.c +++ b/src/compare_hkl.c @@ -286,13 +286,13 @@ static void add_to_fom(struct fom_context *fctx, double i1, double i2, break; case FOM_D1SIG : - if ( fabs(i1-i2) < (sig1+sig2)/2.0 ) { + if ( fabs(i1-i2) < sqrt(sig1*sig1 + sig2*sig2) ) { fctx->n_within[bin]++; } break; case FOM_D2SIG : - if ( fabs(i1-i2) < sig1+sig2 ) { /* = 2 * (sig1+sig2)/2 */ + if ( fabs(i1-i2) < 2.0*sqrt(sig1*sig1 + sig2*sig2) ) { fctx->n_within[bin]++; } break; @@ -1125,7 +1125,7 @@ int main(int argc, char *argv[]) char *bfile = NULL; char *sym_str = NULL; SymOpList *sym; - int ncom, nrej, nneg, nres, nbij, ncen; + int ncom, nrej, nmul, nneg, nres, nbij, ncen; RefList *list1_acc; RefList *list2_acc; RefList *list1; @@ -1149,6 +1149,7 @@ int main(int argc, char *argv[]) double min_I = +INFINITY; double max_I = -INFINITY; float highres, lowres; + int mul_cutoff = 0; /* Long options */ const struct option longopts[] = { @@ -1164,6 +1165,7 @@ int main(int argc, char *argv[]) {"shell-file", 1, NULL, 7}, {"highres", 1, NULL, 8}, {"lowres", 1, NULL, 9}, + {"min-measurements", 1, NULL, 11}, {"ignore-negs", 0, &config_ignorenegs, 1}, {"zero-negs", 0, &config_zeronegs, 1}, {"intensity-shells", 0, &config_intshells, 1}, @@ -1260,6 +1262,13 @@ int main(int argc, char *argv[]) rmin_fix = 1.0 / (lowres/1e10); break; + case 11 : + if ( sscanf(optarg, "%i", &mul_cutoff) != 1 ) { + ERROR("Invalid value for --min-measurements\n"); + return 1; + } + break; + case '?' : break; @@ -1413,6 +1422,7 @@ int main(int argc, char *argv[]) /* Select reflections to be used */ ncom = 0; nrej = 0; + nmul = 0; nneg = 0; nres = 0; nbij = 0; @@ -1426,6 +1436,7 @@ int main(int argc, char *argv[]) signed int h, k, l; double val1, val2; double esd1, esd2; + int mul1, mul2; Reflection *refl2; Reflection *refl1_acc; Reflection *refl2_acc; @@ -1441,6 +1452,9 @@ int main(int argc, char *argv[]) esd1 = get_esd_intensity(refl1); esd2 = get_esd_intensity(refl2); + mul1 = get_redundancy(refl1); + mul2 = get_redundancy(refl2); + if ( (val1 < sigma_cutoff * esd1) || (val2 < sigma_cutoff * esd2) ) { @@ -1453,6 +1467,11 @@ int main(int argc, char *argv[]) continue; } + if ( (mul1 < mul_cutoff) || (mul2 < mul_cutoff) ) { + nmul++; + continue; + } + if ( config_zeronegs ) { int d = 0; if ( val1 < 0.0 ) { @@ -1544,6 +1563,11 @@ int main(int argc, char *argv[]) " negative intensities which were set to zero.\n", nneg); } + if ( nmul > 0 ) { + STATUS("%i reflection pairs rejected because either or both" + " versions had too few measurements.\n", nmul); + } + if ( nres > 0 ) { STATUS("%i reflection pairs rejected because either or both" " versions were outside the resolution range.\n", nres); diff --git a/src/geoptimiser.c b/src/geoptimiser.c index e0337358..4ba2c5d0 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -2488,8 +2488,10 @@ int main(int argc, char *argv[]) } #ifdef HAVE_SAVE_TO_PNG +#if !GLIB_CHECK_VERSION(2,36,0) g_type_init(); #endif +#endif ret_val = optimize_geometry(gparams, det, quadrants, connected); diff --git a/src/get_hkl.c b/src/get_hkl.c index d6efe747..77f34da2 100644 --- a/src/get_hkl.c +++ b/src/get_hkl.c @@ -98,7 +98,9 @@ static void show_help(const char *s) static void copy_notes(RefList *out, RefList *in) { - reflist_add_notes(out, reflist_get_notes(in)); + if ( reflist_get_notes(in) != NULL ) { + reflist_add_notes(out, reflist_get_notes(in)); + } } diff --git a/src/im-sandbox.c b/src/im-sandbox.c index f5493453..2dabf3e9 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -372,7 +372,7 @@ static void run_work(const struct index_args *iargs, Stream *st, } time_accounts_set(taccs, TACC_FINALCLEANUP); - cleanup_indexing(iargs->indm, iargs->ipriv); + cleanup_indexing(iargs->ipriv); free_detector_geometry(iargs->det); free(iargs->hdf5_peak_path); free_copy_hdf5_field_list(iargs->copyme); diff --git a/src/indexamajig.c b/src/indexamajig.c index ef803931..6300f7ff 100644 --- a/src/indexamajig.c +++ b/src/indexamajig.c @@ -3,13 +3,13 @@ * * Index patterns, output hkl+intensity etc. * - * Copyright © 2012-2015 Deutsches Elektronen-Synchrotron DESY, + * Copyright © 2012-2017 Deutsches Elektronen-Synchrotron DESY, * a research centre of the Helmholtz Association. * Copyright © 2012 Richard Kirian * Copyright © 2012 Lorenzo Galli * * Authors: - * 2010-2015 Thomas White <taw@physics.org> + * 2010-2017 Thomas White <taw@physics.org> * 2011 Richard Kirian * 2012 Lorenzo Galli * 2012 Chunhong Yoon @@ -202,8 +202,6 @@ int main(int argc, char *argv[]) int config_checkprefix = 1; int config_basename = 0; int integrate_saturated = 0; - IndexingMethod *indm; - IndexingPrivate **ipriv; char *indm_str = NULL; char *cellfile = NULL; char *prefix = NULL; @@ -262,7 +260,6 @@ int main(int argc, char *argv[]) ERROR("Couldn't allocate HDF5 field list.\n"); return 1; } - iargs.indm = NULL; /* No default */ iargs.ipriv = NULL; /* No default */ iargs.int_meth = integration_method("rings-nocen-nosat-nograd", NULL); iargs.push_res = 0.0; @@ -644,35 +641,6 @@ int main(int argc, char *argv[]) iargs.hdf5_peak_path = command_line_peak_path; } - /* Parse indexing methods */ - if ( indm_str == NULL ) { - - STATUS("You didn't specify an indexing method, so I won't try " - " to index anything.\n" - "If that isn't what you wanted, re-run with" - " --indexing=<methods>.\n"); - indm = NULL; - - } else { - - int i = 0; - - indm = build_indexer_list(indm_str); - if ( indm == NULL ) { - ERROR("Invalid indexer list '%s'\n", indm_str); - return 1; - } - free(indm_str); - - /* If --no-refine, unset the refinement flag on all methods */ - if ( no_refine ) { - while ( indm[i] != INDEXING_NONE ) { - indm[i] &= ~INDEXING_REFINE; - i++; - } - } - } - /* Parse integration method */ if ( int_str != NULL ) { @@ -808,23 +776,30 @@ int main(int argc, char *argv[]) } free(outfile); - /* Prepare the indexer */ - if ( indm != NULL ) { - ipriv = prepare_indexing(indm, iargs.cell, iargs.det, - iargs.tols, iargs.felix_options); - if ( ipriv == NULL ) { - ERROR("Failed to prepare indexing.\n"); + /* Prepare the indexing system */ + if ( indm_str == NULL ) { + + STATUS("You didn't specify an indexing method, so I won't try " + " to index anything.\n" + "If that isn't what you wanted, re-run with" + " --indexing=<methods>.\n"); + iargs.ipriv = NULL; + + } else { + + iargs.ipriv = setup_indexing(indm_str, iargs.cell, iargs.det, + iargs.tols, no_refine, + iargs.felix_options); + if ( iargs.ipriv == NULL ) { + ERROR("Failed to set up indexing system\n"); return 1; } - } else { - ipriv = NULL; + free(indm_str); + } gsl_set_error_handler_off(); - iargs.indm = indm; - iargs.ipriv = ipriv; - create_sandbox(&iargs, n_proc, prefix, config_basename, fh, st, tempdir); @@ -836,7 +811,7 @@ int main(int argc, char *argv[]) free_detector_geometry(iargs.det); free(iargs.hdf5_peak_path); close_stream(st); - cleanup_indexing(indm, ipriv); + cleanup_indexing(iargs.ipriv); return 0; } diff --git a/src/merge.c b/src/merge.c index 8d1fae0f..9734c469 100644 --- a/src/merge.c +++ b/src/merge.c @@ -237,10 +237,7 @@ RefList *merge_intensities(Crystal **crystals, int n, int n_threads, Reflection *refl; RefListIterator *iter; - if ( n == 0 ) { - ERROR("No crystals!\n"); - return NULL; - } + if ( n == 0 ) return NULL; full = reflist_new(); diff --git a/src/partialator.c b/src/partialator.c index 09feebb4..569145e8 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -191,6 +191,12 @@ static void write_split(Crystal **crystals, int n_crystals, const char *outfile, snprintf(tmp, 1024, "%s1", outfile); split = merge_intensities(crystals1, n_crystals1, nthreads, pmodel, min_measurements, push_res, 1); + + if ( split == NULL ) { + ERROR("Not enough crystals for two way split!\n"); + return; + } + STATUS("Writing two-way split to %s ", tmp); write_reflist_2(tmp, split, sym); reflist_free(split); diff --git a/src/process_hkl.c b/src/process_hkl.c index d2cf640b..301bc6e4 100644 --- a/src/process_hkl.c +++ b/src/process_hkl.c @@ -287,7 +287,8 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr, if ( isnan(scale) ) return 1; if ( scale <= 0.0 ) return 1; if ( stat != NULL ) { - fprintf(stat, "%s %f %f\n", image->filename, scale, cc); + fprintf(stat, "%s %s %f %f\n", image->filename, + get_event_string(image->event), scale, cc); } } else { diff --git a/src/process_image.c b/src/process_image.c index d54e5a79..e6e6d22a 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -241,8 +241,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, /* Index the pattern */ time_accounts_set(taccs, TACC_INDEXING); - index_pattern_2(&image, iargs->indm, iargs->ipriv, - &sb_shared->pings[cookie]); + index_pattern_2(&image, iargs->ipriv, &sb_shared->pings[cookie]); r = chdir(rn); if ( r ) { diff --git a/src/process_image.h b/src/process_image.h index 2ac48b83..bc8b31fd 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -62,8 +62,7 @@ struct index_args float min_snr; int check_hdf5_snr; struct detector *det; - IndexingMethod *indm; - IndexingPrivate **ipriv; + IndexingPrivate *ipriv; int peaks; /* Peak detection method */ float tols[4]; struct beam_params *beam; |