aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-11-19 17:43:27 +0100
committerThomas White <taw@physics.org>2013-11-23 02:52:50 -0800
commit671d31caf204963bc3bc46b1c832110113eeaf6b (patch)
tree5424b09b336617ad233cb397a32aab5108b16961
parent2e2386192d946988811cb75bac649877ba0fe0c7 (diff)
Improve show_peak_box() (and its use)
-rw-r--r--libcrystfel/src/integration.c67
1 files changed, 33 insertions, 34 deletions
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index 5bd520e4..fe6f3127 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -310,7 +310,7 @@ static void colour_off(enum boxmask_val b)
#endif
-static void show_peak_box(struct intcontext *ic, struct peak_box *bx)
+static void show_reference_profile(struct intcontext *ic, int i)
{
#ifdef HAVE_CURSES_COLOR
int q;
@@ -320,43 +320,25 @@ static void show_peak_box(struct intcontext *ic, struct peak_box *bx)
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE) ; /* Background */
init_pair(2, COLOR_WHITE, COLOR_RED); /* Peak */
- init_pair(3, COLOR_BLACK, COLOR_CYAN); /* Blackhole */
-
- printw("Pixel values:\n");
- for ( q=ic->w-1; q>=0; q-- ) {
-
- int p;
- for ( p=0; p<ic->w; p++ ) {
-
- colour_on(bx->bm[p+q*ic->w]);
- printw("%5.0f ", boxi(ic, bx, p, q));
- colour_off(bx->bm[p+q*ic->w]);
-
- }
-
- printw("\n");
- }
+ printw("Reference profile number %i (%i contributions):\n", i,
+ ic->n_profiles_in_reference[i]);
- printw("\nFitted background:\n");
for ( q=ic->w-1; q>=0; q-- ) {
int p;
for ( p=0; p<ic->w; p++ ) {
- colour_on(bx->bm[p+q*ic->w]);
- printw("%5.0f ", bx->a*p + bx->b*q + bx->c);
- colour_off(bx->bm[p+q*ic->w]);
+ colour_on(ic->bm[p+q*ic->w]);
+ printw("%4.0f ", ic->reference_profiles[i][p+ic->w*q]);
+ colour_off(ic->bm[p+q*ic->w]);
}
printw("\n");
}
- printw("Reference profile number %i, ", bx->rp);
- printw("Background parameters: a=%.2f, b=%.2f, c=%.2f\n",
- bx->a, bx->b, bx->c);
refresh();
getch();
endwin();
@@ -364,7 +346,7 @@ static void show_peak_box(struct intcontext *ic, struct peak_box *bx)
}
-static void show_reference_profile(struct intcontext *ic, int i)
+static void show_peak_box(struct intcontext *ic, struct peak_box *bx)
{
#ifdef HAVE_CURSES_COLOR
int q;
@@ -374,25 +356,46 @@ static void show_reference_profile(struct intcontext *ic, int i)
start_color();
init_pair(1, COLOR_WHITE, COLOR_BLUE) ; /* Background */
init_pair(2, COLOR_WHITE, COLOR_RED); /* Peak */
+ init_pair(3, COLOR_BLACK, COLOR_CYAN); /* Blackhole */
- printw("Reference profile number %i (%i contributions):\n", i,
- ic->n_profiles_in_reference[i]);
+ printw("Pixel values:\n");
+ for ( q=ic->w-1; q>=0; q-- ) {
+
+ int p;
+
+ for ( p=0; p<ic->w; p++ ) {
+
+ colour_on(bx->bm[p+q*ic->w]);
+ printw("%5.0f ", boxi(ic, bx, p, q));
+ colour_off(bx->bm[p+q*ic->w]);
+
+ }
+ printw("\n");
+ }
+
+ printw("\nFitted background (parameters a=%.2f, b=%.2f, c=%.2f)\n",
+ bx->a, bx->b, bx->c);
for ( q=ic->w-1; q>=0; q-- ) {
int p;
for ( p=0; p<ic->w; p++ ) {
- colour_on(ic->bm[p+q*ic->w]);
- printw("%4.0f ", ic->reference_profiles[i][p+ic->w*q]);
- colour_off(ic->bm[p+q*ic->w]);
+ colour_on(bx->bm[p+q*ic->w]);
+ printw("%5.0f ", bx->a*p + bx->b*q + bx->c);
+ colour_off(bx->bm[p+q*ic->w]);
}
printw("\n");
}
+ if ( ic->meth & INTEGRATION_PROF2D ) {
+ printw("\nReference profile number %i, ", bx->rp);
+ show_reference_profile(ic, bx->rp);
+ }
+
refresh();
getch();
endwin();
@@ -900,16 +903,12 @@ 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);
- show_peak_box(ic, bx);
}
- return 1;
}
if ( n_bg < 4 ) {
if ( bx->verbose ) {
ERROR("Not enough bg pixels (%i)\n", n_bg);
- show_peak_box(ic, bx);
}
- return 1;
}
setup_peak_integrals(ic, bx);