aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/integration.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-11-22 23:36:04 -0800
committerThomas White <taw@physics.org>2013-11-23 02:52:52 -0800
commit431c44e9a64add4becfbb6b407effba0411eb5b9 (patch)
tree6a772b8699c0494dc4d3a1e37a1f59d042069040 /libcrystfel/src/integration.c
parent130b1bd699079e6418f6f8d44fca191cfd102f70 (diff)
More fixes for --int-diag
Diffstat (limited to 'libcrystfel/src/integration.c')
-rw-r--r--libcrystfel/src/integration.c71
1 files changed, 11 insertions, 60 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index c3d2730e..63495c43 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -316,12 +316,6 @@ static void show_reference_profile(struct intcontext *ic, int i)
#ifdef HAVE_CURSES_COLOR
int q;
- initscr();
- clear();
- start_color();
- init_pair(1, COLOR_WHITE, COLOR_BLUE) ; /* Background */
- init_pair(2, COLOR_WHITE, COLOR_RED); /* Peak */
-
printw("Reference profile number %i (%i contributions):\n", i,
ic->n_profiles_in_reference[i]);
@@ -339,10 +333,6 @@ static void show_reference_profile(struct intcontext *ic, int i)
printw("\n");
}
-
- refresh();
- getch();
- endwin();
#endif
}
@@ -397,6 +387,11 @@ static void show_peak_box(struct intcontext *ic, struct peak_box *bx)
show_reference_profile(ic, bx->rp);
}
+ printw("\nIntensity = %.2f +/- %.2f\n", get_intensity(bx->refl),
+ get_esd_intensity(bx->refl));
+
+ printw("\n\n");
+
refresh();
getch();
endwin();
@@ -430,10 +425,6 @@ static void fit_bg(struct intcontext *ic, struct peak_box *bx)
}
}
- if ( bx->verbose ) {
- show_matrix_eqn(bx->bgm, v);
- }
-
/* SVD is massive overkill here */
ans = solve_svd(v, bx->bgm);
gsl_vector_free(v);
@@ -859,9 +850,6 @@ static int check_box(struct intcontext *ic, struct peak_box *bx, int *sat)
if ( (fs < 0) || (fs >= bx->p->w)
|| (ss < 0) || (ss >= bx->p->h) ) {
- if ( bx->verbose ) {
- ERROR("Box fell off edge of panel\n");
- }
return 1;
}
@@ -901,19 +889,11 @@ static int check_box(struct intcontext *ic, struct peak_box *bx, int *sat)
}
}
- if ( n_pk < 4 ) {
- if ( bx->verbose ) {
- ERROR("Not enough peak pixels (%i)\n", n_pk);
- }
- }
- if ( n_bg < 4 ) {
- if ( bx->verbose ) {
- ERROR("Not enough bg pixels (%i)\n", n_bg);
- }
- }
-
setup_peak_integrals(ic, bx);
+ if ( n_pk < 4 ) return 1;
+ if ( n_bg < 4 ) return 1;
+
return 0;
}
@@ -992,22 +972,13 @@ static int center_and_check_box(struct intcontext *ic, struct peak_box *bx,
bx->css += iss;
t_offs_fs += ifs;
t_offs_ss += iss;
- if ( bx->verbose ) {
- STATUS("Centering step %i,%i\n", ifs, iss);
- }
free(bx->bm);
if ( check_box(ic, bx, sat) ) {
- if ( bx->verbose ) {
- ERROR("Box invalid after centering step.\n");
- }
return 1;
}
if ( t_offs_fs*t_offs_fs + t_offs_ss*t_offs_ss > ic->w*ic->w ) {
- if ( bx->verbose ) {
- ERROR("Box drifted too far during centering.\n");
- }
return 1;
}
@@ -1042,10 +1013,6 @@ static double fit_intensity(struct intcontext *ic, struct peak_box *bx)
}
}
- if ( bx->verbose ) {
- STATUS("J = %f\n", J);
- }
-
return J * sum;
}
@@ -1460,10 +1427,6 @@ static void integrate_prof2d(IntegrationMethod meth, Crystal *cr,
struct peak_box *bx;
bx = &ic.boxes[i];
- if ( bx->verbose ) {
- show_reference_profile(&ic, bx->rp);
- STATUS("%f -> ", bx->intensity);
- }
bx->intensity = fit_intensity(&ic, bx);
bx->sigma = calc_sigma(&ic, bx);
@@ -1499,7 +1462,10 @@ static void integrate_prof2d(IntegrationMethod meth, Crystal *cr,
pss += bx->offs_ss;
set_detector_pos(bx->refl, 0.0, pfs, pss);
+ if ( bx->verbose ) show_peak_box(&ic, bx);
+
}
+
}
refine_rigid_groups(&ic);
@@ -1529,7 +1495,6 @@ static void integrate_rings_once(Reflection *refl, struct image *image,
double one_over_d;
int r;
double bgmean, sig2_bg, sig2_poisson, aduph;
- double pkmean, sig2_pk;
set_redundancy(refl, 0);
@@ -1591,9 +1556,6 @@ static void integrate_rings_once(Reflection *refl, struct image *image,
* error to be one photon */
if ( fabs(intensity / aduph) < 1.0 ) {
sig2_poisson = aduph;
- if ( bx->verbose ) {
- STATUS("number of photons less than 1\n");
- }
}
/* If intensity is negative by more than one photon, assume that
@@ -1601,21 +1563,10 @@ static void integrate_rings_once(Reflection *refl, struct image *image,
* appropriate size */
if ( intensity < -aduph ) {
sig2_poisson = -aduph*intensity;
- if ( bx->verbose ) {
- STATUS("very negative (%.2f photons)\n",
- intensity/aduph);
- }
}
sigma = sqrt(sig2_poisson + bx->m*sig2_bg);
- mean_var_area(ic, bx, BM_PK, &pkmean, &sig2_pk);
- if ( bx->verbose ) {
- STATUS("bg mean, var = %.2f, %.2f\n", bgmean, sig2_bg);
- STATUS("pk mean, var = %.2f, %.2f\n", pkmean, sig2_pk);
- STATUS("intensity = %.2f +/- %.2f\n", intensity, sigma);
- }
-
if ( intensity < -5.0*sigma ) {
delete_box(ic, bx);
ic->n_implausible++;