aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/integration.c36
-rw-r--r--libcrystfel/src/peaks.c12
-rw-r--r--src/process_hkl.c14
3 files changed, 30 insertions, 32 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index cad0a75c..d2c06db7 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -1342,17 +1342,16 @@ static void setup_profile_boxes(struct intcontext *ic, RefList *list)
void integrate_prof2d(IntegrationMethod meth,
- Crystal *cr, struct image *image, IntDiag int_diag,
+ Crystal *cr, RefList *list,
+ struct image *image, IntDiag int_diag,
signed int idh, signed int idk, signed int idl,
double ir_inn, double ir_mid, double ir_out,
pthread_mutex_t *term_lock, int **masks)
{
- RefList *list;
UnitCell *cell;
struct intcontext *ic;
int i;
- list = crystal_get_reflections(cr);
cell = crystal_get_cell(cr);
ic = intcontext_new(image, cell, meth,
@@ -1593,12 +1592,12 @@ static double estimate_resolution(Crystal *cr, struct image *image)
static void integrate_rings(IntegrationMethod meth,
- Crystal *cr, struct image *image, IntDiag int_diag,
+ Crystal *cr, RefList *list,
+ struct image *image, IntDiag int_diag,
signed int idh, signed int idk, signed int idl,
double ir_inn, double ir_mid, double ir_out,
pthread_mutex_t *term_lock, int **masks)
{
- RefList *list;
Reflection *refl;
RefListIterator *iter;
UnitCell *cell;
@@ -1606,7 +1605,6 @@ static void integrate_rings(IntegrationMethod meth,
int n_rej = 0;
int n_refl = 0;
- list = crystal_get_reflections(cr);
cell = crystal_get_cell(cr);
ic = intcontext_new(image, cell, meth,
@@ -1653,23 +1651,21 @@ void integrate_all_5(struct image *image, IntegrationMethod meth,
/* Predict all reflections */
for ( i=0; i<image->n_crystals; i++ ) {
- RefList *list;
double res;
- double saved_R = crystal_get_profile_radius(image->crystals[i]);
+ double saved_R = crystal_get_profile_radius(image->crystals[i].cr);
if ( overpredict ) {
- crystal_set_profile_radius(image->crystals[i],
+ crystal_set_profile_radius(image->crystals[i].cr,
saved_R * 5);
}
- res = estimate_resolution(image->crystals[i], image);
- crystal_set_resolution_limit(image->crystals[i], res);
+ res = estimate_resolution(image->crystals[i].cr, image);
+ crystal_set_resolution_limit(image->crystals[i].cr, res);
- list = predict_to_res(image->crystals[i], image, res+push_res);
- crystal_set_reflections(image->crystals[i], list);
+ image->crystals[i].refls = predict_to_res(image->crystals[i].cr, image, res+push_res);
if ( overpredict ) {
- crystal_set_profile_radius(image->crystals[i], saved_R);
+ crystal_set_profile_radius(image->crystals[i].cr, saved_R);
}
}
@@ -1681,22 +1677,26 @@ void integrate_all_5(struct image *image, IntegrationMethod meth,
for ( i=0; i<image->n_crystals; i++ ) {
- Crystal *cr = image->crystals[i];
-
switch ( meth & INTEGRATION_METHOD_MASK ) {
case INTEGRATION_NONE :
break;
case INTEGRATION_RINGS :
- integrate_rings(meth, cr, image,
+ integrate_rings(meth,
+ image->crystals[i].cr,
+ image->crystals[i].refls,
+ image,
int_diag, idh, idk, idl,
ir_inn, ir_mid, ir_out,
term_lock, masks);
break;
case INTEGRATION_PROF2D :
- integrate_prof2d(meth, cr, image,
+ integrate_prof2d(meth,
+ image->crystals[i].cr,
+ image->crystals[i].refls,
+ image,
int_diag, idh, idk, idl,
ir_inn, ir_mid, ir_out,
term_lock, masks);
diff --git a/libcrystfel/src/peaks.c b/libcrystfel/src/peaks.c
index d56f6d03..63dd6966 100644
--- a/libcrystfel/src/peaks.c
+++ b/libcrystfel/src/peaks.c
@@ -62,15 +62,15 @@
/** \file peaks.h */
-static void add_crystal_to_mask(struct image *image,
- struct detgeom_panel *p, int pn,
- double ir_inn, int *mask, Crystal *cr)
+static void add_reflections_to_mask(struct image *image,
+ struct detgeom_panel *p, int pn,
+ double ir_inn, int *mask, RefList *list)
{
Reflection *refl;
RefListIterator *iter;
/* Loop over all reflections */
- for ( refl = first_refl(crystal_get_reflections(cr), &iter);
+ for ( refl = first_refl(list, &iter);
refl != NULL;
refl = next_refl(refl, iter) )
{
@@ -121,8 +121,8 @@ int *make_BgMask(struct image *image, struct detgeom_panel *p,
if ( image->crystals == NULL ) return mask;
for ( i=0; i<image->n_crystals; i++ ) {
- add_crystal_to_mask(image, p, pn, ir_inn,
- mask, image->crystals[i]);
+ add_reflections_to_mask(image, p, pn, ir_inn,
+ mask, image->crystals[i].refls);
}
return mask;
diff --git a/src/process_hkl.c b/src/process_hkl.c
index be1c95d4..31e4b1fc 100644
--- a/src/process_hkl.c
+++ b/src/process_hkl.c
@@ -271,7 +271,7 @@ static void apply_kpred(double k, RefList *list)
static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
- RefList *reference, const SymOpList *sym,
+ RefList *new_refl, RefList *reference, const SymOpList *sym,
double **hist_vals, signed int hist_h,
signed int hist_k, signed int hist_l, int *hist_n,
struct polarisation p, double min_snr, double max_adu,
@@ -280,11 +280,8 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
{
Reflection *refl;
RefListIterator *iter;
- RefList *new_refl;
double scale;
- new_refl = crystal_get_reflections(cr);
-
/* First, correct for polarisation */
apply_kpred(1.0/image->lambda, new_refl);
polarisation_correction(new_refl, crystal_get_cell(cr), p);
@@ -309,7 +306,7 @@ static int merge_crystal(RefList *model, struct image *image, Crystal *cr,
scale = 1.0;
}
- for ( refl = first_refl(crystal_get_reflections(cr), &iter);
+ for ( refl = first_refl(new_refl, &iter);
refl != NULL;
refl = next_refl(refl, iter) )
{
@@ -431,7 +428,8 @@ static int merge_stream(Stream *st,
for ( i=0; i<image->n_crystals; i++ ) {
- Crystal *cr = image->crystals[i];
+ Crystal *cr = image->crystals[i].cr;
+ RefList *refls = image->crystals[i].refls;
n_crystals_seen++;
if ( (n_crystals_seen > start_after)
@@ -440,8 +438,8 @@ static int merge_stream(Stream *st,
{
int r;
n_crystals++;
- r = merge_crystal(model, image, cr, reference,
- sym, hist_vals,
+ r = merge_crystal(model, image, cr, refls,
+ reference, sym, hist_vals,
hist_h, hist_k, hist_l,
hist_i, p,
min_snr, max_adu, push_res,