aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2015-03-06 15:51:02 +0100
committerThomas White <taw@physics.org>2015-03-12 16:37:25 +0100
commite4a0136db78d7d4204fb8c2d712de65c7a176973 (patch)
treeb0f02de8cd22fbf66fffacfe33785dd5848554f2
parentd7b326f4e75cf6bda8c1a097a92923820aa4b6e3 (diff)
Improve rejection
-rw-r--r--src/partialator.c3
-rw-r--r--src/rejection.c31
-rw-r--r--src/rejection.h1
3 files changed, 34 insertions, 1 deletions
diff --git a/src/partialator.c b/src/partialator.c
index 0f0c2631..ce3e965d 100644
--- a/src/partialator.c
+++ b/src/partialator.c
@@ -584,6 +584,7 @@ int main(int argc, char *argv[])
if ( noscale ) STATUS("Scale factors fixed at 1.\n");
full = scale_intensities(crystals, n_crystals,
nthreads, noscale, pmodel, min_measurements);
+ check_rejection(crystals, n_crystals);
srdata.crystals = crystals;
srdata.n = n_crystals;
@@ -609,11 +610,13 @@ int main(int argc, char *argv[])
&srdata);
show_duds(crystals, n_crystals);
+ check_rejection(crystals, n_crystals);
/* Re-estimate all the full intensities */
reflist_free(full);
full = scale_intensities(crystals, n_crystals, nthreads,
noscale, pmodel, min_measurements);
+ check_rejection(crystals, n_crystals);
srdata.full = full;
diff --git a/src/rejection.c b/src/rejection.c
index d413666f..0b59e813 100644
--- a/src/rejection.c
+++ b/src/rejection.c
@@ -36,6 +36,7 @@
#include "crystal.h"
#include "reflist.h"
+#include "rejection.h"
static double mean_intensity(RefList *list)
@@ -62,6 +63,7 @@ void early_rejection(Crystal **crystals, int n)
{
int i;
double m = 0.0;
+ double mean_m;
FILE *fh = fopen("reject.dat", "w");
int n_flag = 0;
@@ -71,7 +73,13 @@ void early_rejection(Crystal **crystals, int n)
u = mean_intensity(list);
m += u;
fprintf(fh, "%i %f\n", i, u);
- if ( u < 100.0 ) {
+ }
+ mean_m = m/n;
+ for ( i=0; i<n; i++ ) {
+ double u;
+ RefList *list = crystal_get_reflections(crystals[i]);
+ u = mean_intensity(list);
+ if ( u/mean_m < 0.2 ) {
crystal_set_user_flag(crystals[i], 5);
n_flag++;
}
@@ -80,4 +88,25 @@ void early_rejection(Crystal **crystals, int n)
STATUS("Mean intensity/peak = %f ADU\n", m/n);
STATUS("%i crystals flagged\n", n_flag);
+ check_rejection(crystals, n);
+}
+
+
+void check_rejection(Crystal **crystals, int n)
+{
+ int i;
+ int n_acc = 0;
+
+ for ( i=0; i<n; i++ ) {
+ if ( crystal_get_user_flag(crystals[i]) == 0 ) {
+ n_acc++;
+ if ( n_acc >= 2 ) break;
+ }
+ }
+
+ if ( n_acc < 2 ) {
+ ERROR("Not enough crystals left to proceed (%i). Sorry.\n",
+ n_acc);
+ exit(1);
+ }
}
diff --git a/src/rejection.h b/src/rejection.h
index 891d6216..fb73bd41 100644
--- a/src/rejection.h
+++ b/src/rejection.h
@@ -38,5 +38,6 @@
#include "crystal.h"
extern void early_rejection(Crystal **crystals, int n);
+extern void check_rejection(Crystal **crystals, int n);
#endif /* REJECTION_H */