aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2012-03-06 14:46:13 +0100
committerThomas White <taw@physics.org>2012-03-06 14:46:13 +0100
commit3710defb709b7ab33ae7849873c4fb62de96e138 (patch)
tree0c50ad73099324891826efb2bbfc33a8ec03d8a3
parent95f05d7d455c9bfd28af83b72dfeb47b77fca621 (diff)
Rename old array functions to get them out of the way of API consistency
-rw-r--r--doc/reference/CrystFEL-sections.txt4
-rw-r--r--libcrystfel/src/peaks.c2
-rw-r--r--libcrystfel/src/reflist-utils.c4
-rw-r--r--libcrystfel/src/reflist.c8
-rw-r--r--libcrystfel/src/reflist.h4
-rw-r--r--src/compare_hkl.c4
-rw-r--r--src/diffraction.c8
-rw-r--r--src/get_hkl.c12
-rw-r--r--src/hrs-scaling.c2
-rw-r--r--src/list_tmp.h32
-rw-r--r--src/partial_sim.c4
-rw-r--r--src/pattern_sim.c12
-rw-r--r--src/process_hkl.c9
13 files changed, 39 insertions, 66 deletions
diff --git a/doc/reference/CrystFEL-sections.txt b/doc/reference/CrystFEL-sections.txt
index 576c4a27..284740a1 100644
--- a/doc/reference/CrystFEL-sections.txt
+++ b/doc/reference/CrystFEL-sections.txt
@@ -35,12 +35,12 @@ get_temp2
<SUBSECTION>
set_detector_pos
set_partial
-set_int
+set_intensity
set_scalable
set_refinable
set_redundancy
set_esd_intensity
-set_ph
+set_phase
set_symmetric_indices
set_temp1
set_temp2
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index 55abff27..3c383855 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -672,7 +672,7 @@ void integrate_reflections(struct image *image, int polar, int use_closer,
/* Record intensity and set redundancy to 1 on success */
if ( r == 0 ) {
- set_int(refl, intensity);
+ set_intensity(refl, intensity);
set_esd_intensity(refl, sigma);
set_redundancy(refl, 1);
} else {
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index 8ad33f3f..8f445ff4 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -299,13 +299,13 @@ RefList *read_reflections_from_file(FILE *fh)
char *v;
refl = add_refl(out, h, k, l);
- set_int(refl, intensity);
+ set_intensity(refl, intensity);
set_detector_pos(refl, 0.0, fs, ss);
set_esd_intensity(refl, sigma);
set_redundancy(refl, cts);
ph = strtod(phs, &v);
- if ( v != NULL ) set_ph(refl, deg2rad(ph));
+ if ( v != NULL ) set_phase(refl, deg2rad(ph));
/* The 1/d value is actually ignored. */
diff --git a/libcrystfel/src/reflist.c b/libcrystfel/src/reflist.c
index 4bfa113c..69335781 100644
--- a/libcrystfel/src/reflist.c
+++ b/libcrystfel/src/reflist.c
@@ -596,14 +596,14 @@ void set_partial(Reflection *refl, double r1, double r2, double p,
/**
- * set_int:
+ * set_intensity:
* @refl: A %Reflection
* @intensity: The intensity for the reflection.
*
* Set the intensity for the reflection. Note that retrieval is done with
* get_intensity().
**/
-void set_int(Reflection *refl, double intensity)
+void set_intensity(Reflection *refl, double intensity)
{
refl->data.intensity = intensity;
}
@@ -665,12 +665,12 @@ void set_esd_intensity(Reflection *refl, double esd)
/**
- * set_ph:
+ * set_phase:
* @refl: A %Reflection
* @phase: New phase for the reflection
*
**/
-void set_ph(Reflection *refl, double phase)
+void set_phase(Reflection *refl, double phase)
{
refl->data.phase = phase;
refl->data.have_phase = 1;
diff --git a/libcrystfel/src/reflist.h b/libcrystfel/src/reflist.h
index fe1ca2af..401201e5 100644
--- a/libcrystfel/src/reflist.h
+++ b/libcrystfel/src/reflist.h
@@ -96,14 +96,14 @@ extern void set_detector_pos(Reflection *refl, double exerr,
double fs, double ss);
extern void set_partial(Reflection *refl, double r1, double r2, double p,
double clamp_low, double clamp_high);
-extern void set_int(Reflection *refl, double intensity);
+extern void set_intensity(Reflection *refl, double intensity);
extern void set_scalable(Reflection *refl, int scalable);
extern void set_refinable(Reflection *refl, int refinable);
extern void set_redundancy(Reflection *refl, int red);
extern void set_temp1(Reflection *refl, double temp);
extern void set_temp2(Reflection *refl, double temp);
extern void set_esd_intensity(Reflection *refl, double esd);
-extern void set_ph(Reflection *refl, double phase);
+extern void set_phase(Reflection *refl, double phase);
extern void set_symmetric_indices(Reflection *refl,
signed int hs, signed int ks, signed int ls);
diff --git a/src/compare_hkl.c b/src/compare_hkl.c
index 3fc18fea..dde90990 100644
--- a/src/compare_hkl.c
+++ b/src/compare_hkl.c
@@ -446,12 +446,12 @@ int main(int argc, char *argv[])
/* Add divided version to 'output' list */
tr = add_refl(ratio, h, k, l);
- set_int(tr, val1/val2);
+ set_intensity(tr, val1/val2);
set_redundancy(tr, 1);
}
if ( ratiofile != NULL ) {
- write_reflist(ratiofile, ratio, cell);
+ write_reflist(ratiofile, ratio);
}
reflist_free(ratio);
diff --git a/src/diffraction.c b/src/diffraction.c
index d0413863..429931c2 100644
--- a/src/diffraction.c
+++ b/src/diffraction.c
@@ -120,8 +120,8 @@ static double sym_lookup_intensity(const double *intensities,
get_equiv(sym, NULL, i, h, k, l, &he, &ke, &le);
- f = (double)lookup_flag(flags, he, ke, le);
- val = lookup_intensity(intensities, he, ke, le);
+ f = (double)lookup_arr_flag(flags, he, ke, le);
+ val = lookup_arr_intensity(intensities, he, ke, le);
ret += f*val;
@@ -147,8 +147,8 @@ static double sym_lookup_phase(const double *phases,
get_equiv(sym, NULL, i, h, k, l, &he, &ke, &le);
- f = (double)lookup_flag(flags, he, ke, le);
- val = lookup_phase(phases, he, ke, le);
+ f = (double)lookup_arr_flag(flags, he, ke, le);
+ val = lookup_arr_phase(phases, he, ke, le);
ret += f*val;
diff --git a/src/get_hkl.c b/src/get_hkl.c
index 4afefd51..c1310418 100644
--- a/src/get_hkl.c
+++ b/src/get_hkl.c
@@ -98,7 +98,7 @@ static void poisson_reflections(RefList *list, double adu_per_photon)
val = get_intensity(refl);
c = adu_per_photon * poisson_noise(val/adu_per_photon);
- set_int(refl, c);
+ set_intensity(refl, c);
}
}
@@ -121,7 +121,7 @@ static void noise_reflections(RefList *list)
r = (double)random()/RAND_MAX;
val += 0.1 * val * r;
- set_int(refl, val);
+ set_intensity(refl, val);
}
}
@@ -233,7 +233,7 @@ static RefList *twin_reflections(RefList *in,
if ( !skip ) {
Reflection *new = add_refl(out, h, k, l);
- set_int(new, total);
+ set_intensity(new, total);
set_esd_intensity(new, sqrt(sigma));
}
@@ -297,9 +297,7 @@ static RefList *expand_reflections(RefList *in, const SymOpList *target,
/* FIXME: Make phase negative if the reflection is
* separated from the original via an inversion */
get_phase(refl, &have_phase);
- if ( have_phase ) {
- set_ph(new, -ph);
- }
+ if ( have_phase ) set_phase(new, -ph);
}
@@ -569,7 +567,7 @@ int main(int argc, char *argv[])
special_position(mero, m, h, k, l);
inty *= (double)num_equivs(mero, m);
- set_int(refl, inty);
+ set_intensity(refl, inty);
}
diff --git a/src/hrs-scaling.c b/src/hrs-scaling.c
index fd82536f..21a34bbf 100644
--- a/src/hrs-scaling.c
+++ b/src/hrs-scaling.c
@@ -293,7 +293,7 @@ static RefList *lsq_intensities(struct image *images, int n, int n_threads)
{
double Ih;
Ih = get_temp1(refl) / get_temp2(refl);
- set_int(refl, Ih);
+ set_intensity(refl, Ih);
}
return full;
diff --git a/src/list_tmp.h b/src/list_tmp.h
index 63d4ef20..064efc8d 100644
--- a/src/list_tmp.h
+++ b/src/list_tmp.h
@@ -42,28 +42,8 @@
#define ERROR_T(...) fprintf(stderr, __VA_ARGS__)
-static inline void LABEL(integrate)(TYPE *ref, signed int h,
- signed int k, signed int l,
- TYPE i)
-{
- int idx;
-
- if ( (abs(h) > INDMAX) || (abs(k) > INDMAX) || (abs(l) > INDMAX) ) {
- ERROR_T("\nReflection %i %i %i is out of range!\n", h, k, l);
- ERROR_T("You need to re-configure INDMAX and re-run.\n");
- exit(1);
- }
-
- if ( h < 0 ) h += IDIM;
- if ( k < 0 ) k += IDIM;
- if ( l < 0 ) l += IDIM;
-
- idx = h + (IDIM*k) + (IDIM*IDIM*l);
- ref[idx] += i;
-}
-
-static inline void LABEL(set)(TYPE *ref, signed int h,
+static inline void LABEL(set_arr)(TYPE *ref, signed int h,
signed int k, signed int l,
TYPE i)
{
@@ -84,7 +64,7 @@ static inline void LABEL(set)(TYPE *ref, signed int h,
}
-static inline TYPE LABEL(lookup)(const TYPE *ref, signed int h,
+static inline TYPE LABEL(lookup_arr)(const TYPE *ref, signed int h,
signed int k, signed int l)
{
int idx;
@@ -104,7 +84,7 @@ static inline TYPE LABEL(lookup)(const TYPE *ref, signed int h,
}
-static inline TYPE *LABEL(new_list)(void)
+static inline TYPE *LABEL(new_arr)(void)
{
TYPE *r;
size_t r_size;
@@ -115,12 +95,6 @@ static inline TYPE *LABEL(new_list)(void)
}
-static inline void LABEL(zero_list)(TYPE *ref)
-{
- memset(ref, 0, IDIM*IDIM*IDIM*sizeof(TYPE));
-}
-
-
#undef LABEL
#undef TYPE
#undef ERROR_T
diff --git a/src/partial_sim.c b/src/partial_sim.c
index 7a60f5c8..b9cb69e5 100644
--- a/src/partial_sim.c
+++ b/src/partial_sim.c
@@ -114,7 +114,7 @@ static void calculate_partials(RefList *partial, double osf,
pthread_mutex_lock(full_lock);
rfull = add_refl(full, h, k, l);
If = fabs(gaussian_noise(0.0, 1000.0));
- set_int(rfull, If);
+ set_intensity(rfull, If);
set_redundancy(rfull, 1);
pthread_mutex_unlock(full_lock);
@@ -146,7 +146,7 @@ static void calculate_partials(RefList *partial, double osf,
Ip = gaussian_noise(Ip, 100.0);
- set_int(refl, Ip);
+ set_intensity(refl, Ip);
set_esd_intensity(refl, 100.0);
}
}
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index 19f58589..1ed6b8ba 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -113,7 +113,7 @@ static double *intensities_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- double *out = new_list_intensity();
+ double *out = new_arr_intensity();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -124,7 +124,7 @@ static double *intensities_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_intensity(out, h, k, l, intensity);
+ set_arr_intensity(out, h, k, l, intensity);
}
@@ -136,7 +136,7 @@ static double *phases_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- double *out = new_list_phase();
+ double *out = new_arr_phase();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -147,7 +147,7 @@ static double *phases_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_phase(out, h, k, l, phase);
+ set_arr_phase(out, h, k, l, phase);
}
@@ -160,7 +160,7 @@ static unsigned char *flags_from_list(RefList *list)
{
Reflection *refl;
RefListIterator *iter;
- unsigned char *out = new_list_flag();
+ unsigned char *out = new_arr_flag();
for ( refl = first_refl(list, &iter);
refl != NULL;
@@ -170,7 +170,7 @@ static unsigned char *flags_from_list(RefList *list)
get_indices(refl, &h, &k, &l);
- set_flag(out, h, k, l, 1);
+ set_arr_flag(out, h, k, l, 1);
}
diff --git a/src/process_hkl.c b/src/process_hkl.c
index d90bc9ef..fb0f7fa4 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -169,10 +169,11 @@ static void merge_pattern(RefList *model, RefList *new, int max_only,
/* User asked for max only? */
if ( !max_only ) {
- set_int(model_version, model_int + intensity);
+ set_intensity(model_version,
+ model_int + intensity);
} else {
if ( intensity>get_intensity(model_version) ) {
- set_int(model_version, intensity);
+ set_intensity(model_version, intensity);
}
}
@@ -298,7 +299,7 @@ static void scale_intensities(RefList *model, RefList *new, const SymOpList *sym
refl = next_refl(refl, iter) ) {
double intensity = get_intensity(refl);
- set_int(refl, intensity*s);
+ set_intensity(refl, intensity*s);
}
}
@@ -375,7 +376,7 @@ static void merge_all(FILE *fh, RefList *model,
double intensity = get_intensity(refl);
int red = get_redundancy(refl);
- set_int(refl, intensity / (double)red);
+ set_intensity(refl, intensity / (double)red);
}