aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/integration.c37
-rw-r--r--src/process_image.c7
2 files changed, 43 insertions, 1 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 0acd060a..315c8a33 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -49,7 +49,8 @@
#include "integration.h"
-#define VERBOSITY ((h==0) && (k==13) && (l==13))
+#define VERBOSITY (0)
+// ((h==-6) && (k==0) && (l==-8))
static void check_eigen(gsl_vector *e_val)
@@ -549,6 +550,23 @@ static int init_intcontext(struct intcontext *ic)
}
+static void free_intcontext(struct intcontext *ic)
+{
+ int i;
+
+ free(ic->boxes);
+ for ( i=0; i<ic->n_reference_profiles; i++ ) {
+ free(ic->reference_profiles[i]);
+ free(ic->reference_den[i]);
+ }
+ free(ic->reference_profiles);
+ free(ic->reference_den);
+ free(ic->n_profiles_in_reference);
+ free(ic->bm);
+ gsl_matrix_free(ic->bgm);
+}
+
+
static void setup_ring_masks(struct intcontext *ic,
double ir_inn, double ir_mid, double ir_out)
{
@@ -602,6 +620,19 @@ static struct peak_box *add_box(struct intcontext *ic)
idx = ic->n_boxes++;
+ ic->boxes[idx].cfs = 0;
+ ic->boxes[idx].css = 0;
+ ic->boxes[idx].bm = NULL;
+ ic->boxes[idx].pn = -1;
+ ic->boxes[idx].p = NULL;
+ ic->boxes[idx].a = 0.0;
+ ic->boxes[idx].b = 0.0;
+ ic->boxes[idx].c = 0.0;
+ ic->boxes[idx].intensity = 0.0;
+ ic->boxes[idx].sigma = 0.0;
+ ic->boxes[idx].J = 0.0;
+ ic->boxes[idx].rp = -1;
+ ic->boxes[idx].refl = NULL;
ic->boxes[idx].verbose = 0;
return &ic->boxes[idx];
@@ -1184,6 +1215,8 @@ static void measure_all_intensities(IntegrationMethod meth, RefList *list,
}
}
+ free_intcontext(&ic);
+
image->num_saturated_peaks = n_saturated;
}
@@ -1581,6 +1614,8 @@ static void integrate_rings(IntegrationMethod meth, Crystal *cr,
}
+ free_intcontext(&ic);
+
crystal_set_num_saturated_reflections(cr, n_saturated);
crystal_set_resolution_limit(cr, limit);
crystal_set_reflections(cr, list);
diff --git a/src/process_image.c b/src/process_image.c
index 65deace5..7e91de2d 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -183,9 +183,16 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
iargs->stream_peaks, iargs->stream_refls);
for ( i=0; i<image.n_crystals; i++ ) {
+ cell_free(crystal_get_cell(image.crystals[i]));
+ reflist_free(crystal_get_reflections(image.crystals[i]));
crystal_free(image.crystals[i]);
}
+ for ( i=0; i<image.det->n_panels; i++ ) {
+ free(image.dp[i]);
+ free(image.bad[i]);
+ }
+
free(image.data);
if ( image.flags != NULL ) free(image.flags);
image_feature_list_free(image.features);