10 #include <qwt_legend.h>
17 setWindowTitle( tr(
"2-D Spectrum Analysis Data/Residuals Viewer" ) );
20 QSize p1size( 560, 240 );
21 QSize p2size( 560, 240 );
36 QLabel* lb_datctrls =
us_banner( tr(
"2DSA Data Viewer" ) );
37 QLabel* lb_resctrls =
us_banner( tr(
"2DSA Residuals Viewer" ) );
38 QLabel* lb_vari =
us_label( tr(
"Variance:" ) );
39 QLabel* lb_rmsd =
us_label( tr(
"RMSD:" ) );
91 tr(
"Experimental Data" ),
98 tr(
"OD Difference" ) );
116 connect(
ck_plteda, SIGNAL( toggled(
bool ) ),
118 connect(
ck_subtin, SIGNAL( toggled(
bool ) ),
120 connect(
ck_subrin, SIGNAL( toggled(
bool ) ),
122 connect(
ck_pltsda, SIGNAL( toggled(
bool ) ),
124 connect(
ck_addtin, SIGNAL( toggled(
bool ) ),
126 connect(
ck_addrin, SIGNAL( toggled(
bool ) ),
128 connect(
ck_pltres, SIGNAL( toggled(
bool ) ),
130 connect(
ck_plttin, SIGNAL( toggled(
bool ) ),
132 connect(
ck_pltrin, SIGNAL( toggled(
bool ) ),
134 connect(
ck_pltran, SIGNAL( toggled(
bool ) ),
136 connect(
ck_shorbm, SIGNAL( toggled(
bool ) ),
139 connect( pb_close, SIGNAL( clicked() ),
150 DbgLv(1) <<
"RP: P" << ( parent != 0 );
173 qDebug() <<
"*ERROR* unable to get RP parent";
333 connect(
resbmap, SIGNAL( destroyed() ),
392 if ( !do_plteda && !do_pltsda )
398 if ( do_plteda && ! do_pltsda )
399 data_plot1->setTitle( tr(
"Experimental Data" ) );
401 else if ( do_plteda && do_pltsda )
402 data_plot1->setTitle( tr(
"Experimental and Simulated Data" ) );
405 data_plot1->setTitle( tr(
"Simulated Data" ) );
422 data_plot1->setAxisTitle( QwtPlot::yLeft, tr(
"Absorbance" ) );
427 count = ( points > count ) ? points : count;
429 QVector< double > rvec( count, 0.0 );
430 QVector< double > vvec( count, 0.0 );
432 double* rr = rvec.data();
433 double* vv = vvec.data();
437 QPen pen_red( Qt::red );
447 for (
int jj = 0; jj < points; jj++ )
452 for (
int ii = 0; ii < count; ii++ )
454 if (
excllist->contains( ii ) )
continue;
459 for (
int jj = 0; jj < points; jj++ )
464 vv[ jj ] =
edata->
value( ii, jj ) - rinoi - tinoi;
467 title = tr(
"Curve " ) + QString::number( ii );
470 curv->setPen( pen_plot );
471 curv->setData( rr, vv, points );
482 for (
int jj = 0; jj < points; jj++ )
487 for (
int ii = 0; ii < count; ii++ )
489 if (
excllist->contains( ii ) )
continue;
494 for (
int jj = 0; jj < points; jj++ )
499 if ( rr[ jj ] >= rl )
500 sval =
sdata->
value( ii, jj ) + rinoi + tinoi;
503 sval =
edata->
value( ii, jj ) - rinoi - tinoi;
511 title = tr(
"S-Curve " ) + QString::number( ii );
514 curv->setPen( pen_red );
515 curv->setData( rr, vv, points );
544 if ( !do_pltres && !do_plttin && !do_pltrin &&
545 !do_pltran && !do_shorbm )
552 data_plot2->setAxisTitle( QwtPlot::xBottom, tr(
"Radius (cm)" ) );
556 QVector< double > rvec( vsize, 0.0 );
557 QVector< double > vvec( vsize, 0.0 );
559 double* rr = rvec.data();
560 double* vv = vvec.data();
564 QPen pen_plot( Qt::green );
569 rr[ 0 ] = !do_pltrin ? xlo : 0.0;
570 rr[ 1 ] = !do_pltrin ? xhi : double( count );
574 curv->setPen( QPen( QBrush( Qt::red ), 2 ) );
575 curv->setData( rr, vv, 2 );
581 for (
int jj = 0; jj < points; jj++ )
588 for (
int ii = 0; ii < count; ii++ )
590 if (
excllist->contains( ii ) )
continue;
598 for (
int jj = 0; jj < points; jj++ )
608 rmsd +=
sq( vv[ jj ] );
612 title = tr(
"resids " ) + QString::number( ii );
615 curv->setPen( pen_plot );
616 curv->setStyle( QwtPlotCurve::Dots );
617 curv->setData( rr, vv, points );
621 rmsd /= (double)( kntva );
622 le_vari->setText( QString::number( rmsd ) );
624 le_rmsd->setText( QString::number( rmsd ) );
646 else if ( do_plttin )
648 data_plot2->setTitle( tr(
"Time-Invariant Noise" ) );
650 for (
int jj = 0; jj < points; jj++ )
656 title = tr(
"ti_noise" );
659 curv->setPen( pen_plot );
660 curv->setData( rr, vv, points );
663 else if ( do_pltrin )
665 data_plot2->setTitle( tr(
"Radially-Invariant Noise" ) );
667 for (
int ii = 0; ii < count; ii++ )
669 rr[ ii ] = (double)( ii + 1 );
673 title = tr(
"ri_noise" );
676 data_plot2->setAxisTitle( QwtPlot::xBottom, tr(
"Scan Number" ) );
677 curv->setPen( pen_plot );
678 curv->setData( rr, vv, count );
681 else if ( do_pltran )
685 for (
int jj = 0; jj < points; jj++ )
692 for (
int ii = 0; ii < count; ii++ )
694 if (
excllist->contains( ii ) )
continue;
698 for (
int jj = 0; jj < points; jj++ )
704 rmsd +=
sq( vv[ jj ] );
708 title = tr(
"random noise " ) + QString::number( ii );
711 curv->setPen( pen_plot );
712 curv->setStyle( QwtPlotCurve::Dots );
713 curv->setData( rr, vv, points );
717 rmsd /= (double)( kntva );
718 le_vari->setText( QString::number( rmsd ) );
720 le_rmsd->setText( QString::number( rmsd ) );
728 QVector< QVector< double > > resids;
729 QVector< double > resscan;
731 resids .resize( count );
732 resscan.resize( points );
736 for (
int ii = 0; ii < count; ii++ )
741 resids[ ii ] = resscan;
751 for (
int jj = 0; jj < points; jj++ )
762 rmsd +=
sq( resscan[ jj ] );
766 resids[ ii ] = resscan;
769 rmsd /= (double)( kntva );
770 le_vari->setText( QString::number( rmsd ) );
772 le_rmsd->setText( QString::number( rmsd ) );
783 connect(
resbmap, SIGNAL( destroyed() ),
785 resbmap->move( this->pos() + QPoint( 100, 100 ) );
790 qApp->processEvents();
795 data_plot2->setAxisScale( QwtPlot::xBottom, xlo, xhi );
802 DbgLv(1) <<
"Resids BitMap Closed!!!";