aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2011-02-06 22:28:46 +0100
committerThomas White <taw@physics.org>2012-02-22 15:27:13 +0100
commitf649cc8921b73d85123950c066859f7afe7451b2 (patch)
tree277579e9a9a3bc9c52857f3c8b1a424b7a2b474b
parentbbb90c2f911b071adca3e4cafec36913ae6d3599 (diff)
Banish "struct cpeak" forever
-rw-r--r--Makefile.am2
-rw-r--r--Makefile.in4
-rw-r--r--src/hrs-scaling.c50
-rw-r--r--src/reflist.c49
-rw-r--r--src/reflist.h1
5 files changed, 72 insertions, 34 deletions
diff --git a/Makefile.am b/Makefile.am
index b6eb3d86..81cc91a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -93,7 +93,7 @@ src_reintegrate_SOURCES = src/reintegrate.c src/cell.c src/hdf5-file.c \
src/utils.c src/detector.c src/peaks.c src/image.c \
src/stream.c src/index.c src/dirax.c src/mosflm.c \
src/templates.c src/geometry.c src/symmetry.c \
- src/thread-pool.c
+ src/thread-pool.c src/reflist.c
src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \
src/utils.c src/cell.c src/thread-pool.c
diff --git a/Makefile.in b/Makefile.in
index e75020c5..71045159 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -209,7 +209,7 @@ am_src_reintegrate_OBJECTS = src/reintegrate.$(OBJEXT) \
src/stream.$(OBJEXT) src/index.$(OBJEXT) src/dirax.$(OBJEXT) \
src/mosflm.$(OBJEXT) src/templates.$(OBJEXT) \
src/geometry.$(OBJEXT) src/symmetry.$(OBJEXT) \
- src/thread-pool.$(OBJEXT)
+ src/thread-pool.$(OBJEXT) src/reflist.$(OBJEXT)
src_reintegrate_OBJECTS = $(am_src_reintegrate_OBJECTS)
src_reintegrate_LDADD = $(LDADD)
src_reintegrate_DEPENDENCIES = $(top_builddir)/lib/libgnu.a
@@ -623,7 +623,7 @@ src_reintegrate_SOURCES = src/reintegrate.c src/cell.c src/hdf5-file.c \
src/utils.c src/detector.c src/peaks.c src/image.c \
src/stream.c src/index.c src/dirax.c src/mosflm.c \
src/templates.c src/geometry.c src/symmetry.c \
- src/thread-pool.c
+ src/thread-pool.c src/reflist.c
src_estimate_background_SOURCES = src/estimate_background.c src/stream.c \
src/utils.c src/cell.c src/thread-pool.c
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c
index f2ddaaba..d5d96ffc 100644
--- a/src/hrs-scaling.c
+++ b/src/hrs-scaling.c
@@ -28,6 +28,7 @@
#include "geometry.h"
#include "cell.h"
#include "utils.h"
+#include "reflist.h"
/* Maximum number of iterations of NLSq scaling per macrocycle. */
@@ -39,20 +40,18 @@ static void s_uhavha(signed int hat, signed int kat, signed int lat,
{
double uha_val = 0.0;
double vha_val = 0.0;
- struct cpeak *spots = image->cpeaks;
- int hi;
+ RefList *reflections = image->reflections;
+ Reflection *refl;
- for ( hi=0; hi<image->n_cpeaks; hi++ ) {
+ for ( refl = find_refl(reflections, hat, kat, lat);
+ refl != NULL;
+ refl = next_found_refl(refl) ) {
double ic, sigi;
- if ( !spots[hi].scalable ) continue;
+ if ( !get_scalable(refl) ) continue;
- if ( spots[hi].h != hat ) continue;
- if ( spots[hi].k != kat ) continue;
- if ( spots[hi].l != lat ) continue;
-
- ic = spots[hi].intensity / spots[hi].p;
+ ic = get_intensity(refl) / get_partiality(refl);
sigi = sqrt(fabs(ic));
uha_val += 1.0 / pow(sigi, 2.0);
@@ -278,49 +277,38 @@ static double *lsq_intensities(struct image *images, int n,
I_full = new_list_intensity();
for ( i=0; i<num_items(obs); i++ ) {
- signed int h, k, l;
struct refl_item *it = get_item(obs, i);
double num = 0.0;
double den = 0.0;
int m;
- get_asymm(it->h, it->k, it->l, &h, &k, &l, sym);
-
/* For each frame */
for ( m=0; m<n; m++ ) {
double G;
- int a;
+ Reflection *refl;
G = images[m].osf;
- /* For each peak */
- for ( a=0; a<images[m].n_cpeaks; a++ ) {
-
- signed int ha, ka, la;
+ for ( refl = find_refl(images[m].reflections,
+ it->h, it->k, it->l);
+ refl != NULL;
+ refl = next_found_refl(refl) ) {
- if ( !images[m].cpeaks[a].scalable ) continue;
+ double p;
- /* Correct reflection? */
- get_asymm(images[m].cpeaks[a].h,
- images[m].cpeaks[a].k,
- images[m].cpeaks[a].l,
- &ha, &ka, &la, sym);
- if ( ha != h ) continue;
- if ( ka != k ) continue;
- if ( la != l ) continue;
+ if ( !get_scalable(refl) ) continue;
- num += images[m].cpeaks[a].intensity
- * images[m].cpeaks[a].p * G;
+ p = get_partiality(refl);
- den += pow(images[m].cpeaks[a].p, 2.0)
- * pow(G, 2.0);
+ num += get_intensity(refl) * p * G;
+ den += pow(p, 2.0) * pow(G, 2.0);
}
}
- set_intensity(I_full, h, k, l, num/den);
+ set_intensity(I_full, it->h, it->k, it->l, num/den);
}
diff --git a/src/reflist.c b/src/reflist.c
index 990bc535..7f5d011e 100644
--- a/src/reflist.c
+++ b/src/reflist.c
@@ -77,6 +77,11 @@ Reflection *find_refl(RefList *list, INDICES)
}
+Reflection *next_found_refl(Reflection *refl)
+{
+}
+
+
/********************************** Getters ***********************************/
double get_excitation_error(Reflection *refl)
@@ -94,6 +99,27 @@ void get_indices(Reflection *refl, signed int *h, signed int *k, signed int *l)
}
+double get_partiality(Reflection *refl)
+{
+}
+
+
+double get_intensity(Reflection *refl)
+{
+}
+
+
+void get_partial(Reflection *refl, double *r1, double *r2, double *p,
+ int *clamp_low, int *clamp_high)
+{
+}
+
+
+int get_scalable(Reflection *refl)
+{
+}
+
+
/********************************** Setters ***********************************/
void set_detector_pos(Reflection *refl, double exerr, double x, double y)
@@ -107,6 +133,22 @@ void set_partial(Reflection *refl, double r1, double r2, double p,
}
+void set_indices(Reflection *refl,
+ signed int h, signed int k, signed int l)
+{
+}
+
+
+void set_int(Reflection *refl, double intensity)
+{
+}
+
+
+void set_scalable(Reflection *refl, int scalable)
+{
+}
+
+
/********************************* Insertion **********************************/
Reflection *add_refl(RefList *list, INDICES)
@@ -120,6 +162,13 @@ Reflection *add_refl_with_det_pos(RefList *refl, INDICES, double exerr,
}
+/********************************** Deletion **********************************/
+
+void delete_refl(Reflection *refl)
+{
+}
+
+
/********************************* Iteration **********************************/
Reflection *first_refl(RefList *list)
diff --git a/src/reflist.h b/src/reflist.h
index 0ba09a3b..d1f0d53c 100644
--- a/src/reflist.h
+++ b/src/reflist.h
@@ -28,6 +28,7 @@ extern void reflist_free(RefList *list);
/* Search */
extern Reflection *find_refl(RefList *list, INDICES);
+extern Reflection *next_found_refl(Reflection *refl);
/* Get */
extern double get_excitation_error(Reflection *refl);