10 #include <qwt_legend.h>
17 setObjectName(
"US_ResidPlotPc" );
18 setAttribute( Qt::WA_DeleteOnClose,
true );
19 setWindowTitle( tr(
"Param. Constrained Spectrum Analysis "
20 "Data/Residuals Viewer" ) );
23 QSize p1size( 560, 240 );
24 QSize p2size( 560, 240 );
39 QLabel* lb_datctrls =
us_banner( tr(
"PCSA Data Viewer" ) );
40 QLabel* lb_resctrls =
us_banner( tr(
"PCSA Residuals Viewer" ) );
41 QLabel* lb_vari =
us_label( tr(
"Variance:" ) );
42 QLabel* lb_rmsd =
us_label( tr(
"RMSD:" ) );
94 tr(
"Experimental Data" ),
101 tr(
"OD Difference" ) );
119 connect(
ck_plteda, SIGNAL( toggled(
bool ) ),
121 connect(
ck_subtin, SIGNAL( toggled(
bool ) ),
123 connect(
ck_subrin, SIGNAL( toggled(
bool ) ),
125 connect(
ck_pltsda, SIGNAL( toggled(
bool ) ),
127 connect(
ck_addtin, SIGNAL( toggled(
bool ) ),
129 connect(
ck_addrin, SIGNAL( toggled(
bool ) ),
131 connect(
ck_pltres, SIGNAL( toggled(
bool ) ),
133 connect(
ck_plttin, SIGNAL( toggled(
bool ) ),
135 connect(
ck_pltrin, SIGNAL( toggled(
bool ) ),
137 connect(
ck_pltran, SIGNAL( toggled(
bool ) ),
139 connect(
ck_shorbm, SIGNAL( toggled(
bool ) ),
142 connect( pb_close, SIGNAL( clicked() ),
151 DbgLv(1) <<
"RP: P" << ( parent != 0 );
176 qDebug() <<
"*ERROR* unable to get RP parent";
336 connect(
resbmap, SIGNAL( destroyed() ),
395 if ( !do_plteda && !do_pltsda )
401 if ( do_plteda && ! do_pltsda )
402 data_plot1->setTitle( tr(
"Experimental Data" ) );
404 else if ( do_plteda && do_pltsda )
405 data_plot1->setTitle( tr(
"Experimental and Simulated Data" ) );
408 data_plot1->setTitle( tr(
"Simulated Data" ) );
425 data_plot1->setAxisTitle( QwtPlot::yLeft, tr(
"Absorbance" ) );
430 count = ( points > count ) ? points : count;
432 QVector< double > rvec( count, 0.0 );
433 QVector< double > vvec( count, 0.0 );
435 double* rr = rvec.data();
436 double* vv = vvec.data();
440 QPen pen_red( Qt::red );
450 for (
int jj = 0; jj < points; jj++ )
455 for (
int ii = 0; ii < count; ii++ )
457 if (
excllist->contains( ii ) )
continue;
462 for (
int jj = 0; jj < points; jj++ )
467 vv[ jj ] =
edata->
value( ii, jj ) - rinoi - tinoi;
470 title = tr(
"Curve " ) + QString::number( ii );
473 curv->setPen( pen_plot );
474 curv->setData( rr, vv, points );
485 for (
int jj = 0; jj < points; jj++ )
490 for (
int ii = 0; ii < count; ii++ )
492 if (
excllist->contains( ii ) )
continue;
497 for (
int jj = 0; jj < points; jj++ )
502 if ( rr[ jj ] >= rl )
503 sval =
sdata->
value( ii, jj ) + rinoi + tinoi;
506 sval =
edata->
value( ii, jj ) - rinoi - tinoi;
514 title = tr(
"S-Curve " ) + QString::number( ii );
517 curv->setPen( pen_red );
518 curv->setData( rr, vv, points );
548 if ( !do_pltres && !do_plttin && !do_pltrin &&
549 !do_pltran && !do_shorbm )
556 data_plot2->setAxisTitle( QwtPlot::xBottom, tr(
"Radius (cm)" ) );
560 QVector< double > rvec( vsize, 0.0 );
561 QVector< double > vvec( vsize, 0.0 );
563 double* rr = rvec.data();
564 double* vv = vvec.data();
568 QPen pen_plot( Qt::green );
576 rr[ 0 ] = !do_pltrin ? xlo : 0.0;
577 rr[ 1 ] = !do_pltrin ? xhi : double( count );
581 curv->setPen( QPen( QBrush( Qt::red ), 2 ) );
582 curv->setData( rr, vv, 2 );
588 for (
int jj = 0; jj < points; jj++ )
595 for (
int ii = 0; ii < count; ii++ )
597 if (
excllist->contains( ii ) )
continue;
605 for (
int jj = 0; jj < points; jj++ )
622 title = tr(
"resids " ) + QString::number( ii );
625 curv->setPen( pen_plot );
626 curv->setStyle( QwtPlotCurve::Dots );
627 curv->setData( rr, vv, points );
631 rmsd /= (double)( kntva );
632 le_vari->setText( QString::number( rmsd ) );
634 le_rmsd->setText( QString::number( rmsd ) );
656 else if ( do_plttin )
658 data_plot2->setTitle( tr(
"Time-Invariant Noise" ) );
660 for (
int jj = 0; jj < points; jj++ )
666 title = tr(
"ti_noise" );
669 curv->setPen( pen_plot );
670 curv->setData( rr, vv, points );
673 else if ( do_pltrin )
675 data_plot2->setTitle( tr(
"Radially-Invariant Noise" ) );
677 for (
int ii = 0; ii < count; ii++ )
679 rr[ ii ] = (double)( ii + 1 );
683 title = tr(
"ri_noise" );
686 data_plot2->setAxisTitle( QwtPlot::xBottom, tr(
"Scan Number" ) );
687 curv->setPen( pen_plot );
688 curv->setData( rr, vv, count );
691 else if ( do_pltran )
695 for (
int jj = 0; jj < points; jj++ )
702 for (
int ii = 0; ii < count; ii++ )
704 if (
excllist->contains( ii ) )
continue;
708 for (
int jj = 0; jj < points; jj++ )
720 title = tr(
"random noise " ) + QString::number( ii );
723 curv->setPen( pen_plot );
724 curv->setStyle( QwtPlotCurve::Dots );
725 curv->setData( rr, vv, points );
729 rmsd /= (double)( kntva );
730 le_vari->setText( QString::number( rmsd ) );
732 le_rmsd->setText( QString::number( rmsd ) );
740 QVector< QVector< double > > resids;
741 QVector< double > resscan;
743 resids .resize( count );
744 resscan.resize( points );
748 for (
int ii = 0; ii < count; ii++ )
753 resids[ ii ] = resscan;
763 for (
int jj = 0; jj < points; jj++ )
777 resscan[ jj ] = rvalu;
780 resids[ ii ] = resscan;
783 rmsd /= (double)( kntva );
784 le_vari->setText( QString::number( rmsd ) );
786 le_rmsd->setText( QString::number( rmsd ) );
797 connect(
resbmap, SIGNAL( destroyed() ),
799 resbmap->move( this->pos() + QPoint( 100, 100 ) );
804 qApp->processEvents();
809 data_plot2->setAxisScale( QwtPlot::xBottom, xlo, xhi );
816 DbgLv(1) <<
"Resids BitMap Closed!!!";