diff options
author | Thomas White <taw@physics.org> | 2011-06-17 15:06:14 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:29 +0100 |
commit | 32e1b660775a2b5026e9b5ddbda94644f93b6653 (patch) | |
tree | b9c4ad0850e6cf97ffdff6612f30f999fcd081e0 /src | |
parent | c5b6900196575de9bd649407351b041869ddfed4 (diff) |
Unify uh and vh calculations
Diffstat (limited to 'src')
-rw-r--r-- | src/hrs-scaling.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c index 0876e448..f0978ddb 100644 --- a/src/hrs-scaling.c +++ b/src/hrs-scaling.c @@ -91,47 +91,41 @@ static void s_uhavha(signed int hat, signed int kat, signed int lat, if ( !get_scalable(refl) ) continue; ic = get_intensity(refl) / get_partiality(refl); - sigi = fabs(ic)/10.0; /* FIXME */ + sigi = 10.0; /* FIXME */ uha_val += 1.0 / pow(sigi, 2.0); vha_val += ic / pow(sigi, 2.0); } - if ( uha != NULL ) *uha = uha_val; - if ( vha != NULL ) *vha = vha_val; + *uha = uha_val; + *vha = vha_val; } -static double s_uh(struct image *images, int n, - signed int h, signed int k, signed int l, const char *sym) +static void s_uhvh(struct image *images, int n, + signed int h, signed int k, signed int l, const char *sym, + double *uhp, double *vhp) { int a; - double val = 0.0; + double uh = 0.0; + double vh = 0.0; for ( a=0; a<n; a++ ) { - double uha; - s_uhavha(h, k, l, &images[a], &uha, NULL); - val += pow(images[a].osf, 2.0) * uha; - } - return val; -} + double uha, vha; + s_uhavha(h, k, l, &images[a], &uha, &vha); -static double s_vh(struct image *images, int n, - signed int h, signed int k, signed int l, const char *sym) -{ - int a; - double val = 0.0; + uh += pow(images[a].osf, 2.0) * uha; + vh += images[a].osf * vha; + STATUS("uha = %e\n", uha); + STATUS("vha = %e\n", vha); - for ( a=0; a<n; a++ ) { - double vha; - s_uhavha(h, k, l, &images[a], NULL, &vha); - val += images[a].osf * vha; } - return val; + *uhp = uh; + *vhp = vh; } @@ -216,8 +210,7 @@ static double iterate_scale(struct image *images, int n, double uh, vh; struct refl_item *it = get_item(obs, h); - uh = s_uh(images, n, it->h, it->k, it->l, sym); - vh = s_vh(images, n, it->h, it->k, it->l, sym); + s_uhvh(images, n, it->h, it->k, it->l, sym, &uh, &vh); set_intensity(uh_arr, it->h, it->k, it->l, uh); set_intensity(vh_arr, it->h, it->k, it->l, vh); |