From eeb079dbdd1f28c0850bacb09af2829e785d596b Mon Sep 17 00:00:00 2001 From: Thomas White Date: Tue, 30 Nov 2010 16:42:23 +0100 Subject: Add missing files from previous commit --- src/hrs-scaling.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/hrs-scaling.h | 26 +++++++++++ 2 files changed, 158 insertions(+) create mode 100644 src/hrs-scaling.c create mode 100644 src/hrs-scaling.h diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c new file mode 100644 index 00000000..83c18e17 --- /dev/null +++ b/src/hrs-scaling.c @@ -0,0 +1,132 @@ +/* + * hrs-scaling.c + * + * Intensity scaling using generalised HRS target function + * + * (c) 2006-2010 Thomas White + * + * Part of CrystFEL - crystallography with a FEL + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include +#include +#include +#include + +#include "image.h" +#include "peaks.h" +#include "symmetry.h" +#include "geometry.h" +#include "cell.h" + + +static void show_matrix_eqn(gsl_matrix *M, gsl_vector *v, int r) +{ + int i, j; + + for ( i=0; icpeaks; + + for ( h=0; hn_cpeaks; h++ ) { + + int g; + double v_c, gr, I_full; + + hind = spots[h].h; + kind = spots[h].k; + lind = spots[h].l; + + /* Don't attempt to use spots with very small + * partialities, since it won't be accurate. */ + if ( spots[h].p < 0.1 ) continue; + + if ( integrate_peak(image, spots[h].x, spots[h].y, + &xc, &yc, &I_partial, NULL, NULL, 1, 1) ) { + continue; + } + + get_asymm(hind, kind, lind, &ha, &ka, &la, sym); + I_full = lookup_intensity(i_full, ha, ka, la); + delta_I = I_partial - (spots[h].p * I_full / image->osf); + + + for ( g=0; gprofile_radius) + * gradient(image, k, spots[h], + image->profile_radius); + M_c *= pow(I_full, 2.0); + + gsl_matrix_set(M, g, k, M_curr + M_c); + + } + + gr = gradient(image, k, spots[h], + image->profile_radius); + v_c = delta_I * I_full * gr; + gsl_vector_set(v, k, v_c); + + } + + } + show_matrix_eqn(M, v, NUM_PARAMS); + + shifts = gsl_vector_alloc(NUM_PARAMS); + gsl_linalg_HH_solve(M, v, shifts); + for ( param=0; paramindexed_cell, n, 0); + *pspots = spots; + return mean_partial_dev(image, spots, *n, sym, i_full, NULL); +#endif +} diff --git a/src/hrs-scaling.h b/src/hrs-scaling.h new file mode 100644 index 00000000..28343283 --- /dev/null +++ b/src/hrs-scaling.h @@ -0,0 +1,26 @@ +/* + * hrs-scaling.h + * + * Intensity scaling using generalised HRS target function + * + * (c) 2006-2010 Thomas White + * + * Part of CrystFEL - crystallography with a FEL + * + */ + +#ifndef HRS_SCALING_H +#define HRS_SCALING_H + + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include "image.h" + +extern void scale_intensities(struct image *image, int n, const char *sym); + + +#endif /* HRS_SCALING_H */ -- cgit v1.2.3