From f937b91c7c9016665efd0c38af1e0a5d21d41c99 Mon Sep 17 00:00:00 2001 From: Pascal Hogan-Lamarre Date: Sun, 4 Oct 2020 20:57:30 -0400 Subject: Solved problem concerning prof_radius and diff_lim calculation, prof_radius and diff_lim removed from sol file --- libcrystfel/src/fromfile.c | 10 ++++------ libcrystfel/src/index.c | 28 +++++++++++++++++++--------- libcrystfel/src/integration.c | 9 ++------- src/process_image.c | 10 +++------- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/libcrystfel/src/fromfile.c b/libcrystfel/src/fromfile.c index 05262458..13044ebe 100644 --- a/libcrystfel/src/fromfile.c +++ b/libcrystfel/src/fromfile.c @@ -42,7 +42,7 @@ /* There are 9 vector components, * 2 detector shifts, 1 profile radius, * 1 resolution limit */ -#define NPARAMS_PER_LINE 13 +#define NPARAMS_PER_LINE 11 /* The keys read from file * are the filename, event */ #define NKEYS_PER_LINE 2 @@ -326,7 +326,7 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) Crystal *cr; UnitCell *cell; float asx, asy, asz, bsx, bsy, bsz, csx, csy, csz; - float xshift, yshift, profile_radius, resolution_limit; + float xshift, yshift; struct fromfile_entries *item, *p, *pprime; int ncryst = 0; float *sol; @@ -359,8 +359,6 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) csz = sol[8] * 1e9; xshift = sol[9] * 1e-3; yshift = sol[10] * 1e-3; - profile_radius = sol[11] * 1e9; - resolution_limit = sol[12] * 1e9; cell = cell_new(); cell_set_reciprocal(cell, asx, asy, asz, bsx, bsy, bsz, csx, csy, csz); @@ -371,8 +369,6 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) cr = crystal_new(); ncryst += 1; crystal_set_cell(cr, cell); - crystal_set_profile_radius(cr, profile_radius); - crystal_set_resolution_limit(cr, resolution_limit); crystal_set_det_shift(cr, xshift , yshift); update_detector(image->det, xshift , yshift); image_add_crystal(image, cr); @@ -382,6 +378,8 @@ int fromfile_index(struct image *image, void *mpriv, int crystal_number) HASH_FIND(hh, dp->sol_hash, &item->key, sizeof(struct fromfile_keys), pprime); + /* If a similar tag exist, + * recursive call increasing the crystal_number by 1 */ if ( pprime != NULL ) { ncryst += fromfile_index(image, mpriv, crystal_number+1); } diff --git a/libcrystfel/src/index.c b/libcrystfel/src/index.c index e0e8ff05..7b03ba3e 100644 --- a/libcrystfel/src/index.c +++ b/libcrystfel/src/index.c @@ -664,9 +664,7 @@ static int try_indexer(struct image *image, IndexingMethod indm, Crystal *cr = image->crystals[this_crystal]; crystal_set_image(cr, image); - if ( indm != INDEXING_FILE){ - crystal_set_profile_radius(cr, 0.02e9); - } + crystal_set_profile_radius(cr, 0.02e9); crystal_set_mosaicity(cr, 0.0); /* Pre-refinement unit cell check if requested */ @@ -877,12 +875,14 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, if ( ipriv == NULL ) return; - map_all_peaks(image); + if ( ipriv->methods[0] != INDEXING_FILE){ + map_all_peaks(image); + orig = image->features; + } + image->crystals = NULL; image->n_crystals = 0; - orig = image->features; - for ( n=0; nn_methods; n++ ) { int done = 0; @@ -890,7 +890,9 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, int ntry = 0; int success = 0; - image->features = sort_peaks(orig); + if ( ipriv->methods[0] != INDEXING_FILE){ + image->features = sort_peaks(orig); + } do { @@ -906,7 +908,9 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, } while ( !done ); - image_feature_list_free(image->features); + if ( ipriv->methods[0] != INDEXING_FILE){ + image_feature_list_free(image->features); + } /* Stop now if the pattern is indexed (don't try again for more * crystals with a different indexing method) */ @@ -917,13 +921,19 @@ void index_pattern_3(struct image *image, IndexingPrivate *ipriv, int *ping, } + if ( ipriv->methods[0] == INDEXING_FILE){ + map_all_peaks(image); + } + else{ + image->features = orig; + } + if ( n < ipriv->n_methods ) { image->indexed_by = ipriv->methods[n]; } else { image->indexed_by = INDEXING_NONE; } - image->features = orig; } diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c index 8a3c581e..3d8258c1 100644 --- a/libcrystfel/src/integration.c +++ b/libcrystfel/src/integration.c @@ -1687,14 +1687,9 @@ void integrate_all_5(struct image *image, IntegrationMethod meth, saved_R * 5); } - if ( image->indexed_by != INDEXING_FILE ){ - res = estimate_resolution(crystal_get_cell(image->crystals[i]), + res = estimate_resolution(crystal_get_cell(image->crystals[i]), image->features); - crystal_set_resolution_limit(image->crystals[i], res); - } - else{ - res = crystal_get_resolution_limit(image->crystals[i]); - } + crystal_set_resolution_limit(image->crystals[i], res); list = predict_to_res(image->crystals[i], res+push_res); crystal_set_reflections(image->crystals[i], list); diff --git a/src/process_image.c b/src/process_image.c index 003886c4..b785705a 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -430,9 +430,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, } } else { for ( i=0; ifix_profile_r < 0.0 ) { for ( i=0; i