3 #include <QApplication>
30 int main(
int argc,
char* argv[] )
32 QApplication application( argc, argv );
40 return application.exec();
46 setObjectName(
"US_FeMatch" );
56 tr(
"Compare Experimental Data to Sums of Finite Element Solutions" ) );
95 connect(
pb_load, SIGNAL( clicked() ),
96 this, SLOT(
load() ) );
105 connect(
pb_view, SIGNAL( clicked() ),
107 connect(
pb_save, SIGNAL( clicked() ),
119 QLabel* lb_splot =
us_label ( tr(
"Simulation Plot:" ) );
133 QLabel* lb_info =
us_banner( tr(
"Information for this Run" ) );
134 QLabel* lb_triples =
us_banner( tr(
"Cell / Channel / Wavelength" ) );
135 QLabel* lb_id =
us_label ( tr(
"Run ID / Edit ID:" ) );
136 QLabel* lb_temp =
us_label ( tr(
"Average Temperature:" ) );
142 QFontMetrics fm( font );
143 int fontHeight = fm.lineSpacing();
146 te_desc->setMaximumHeight( fontHeight * 1 + 12 );
150 lw_triples->setMaximumHeight( fontHeight * 2 + 12 );
169 QLabel* lb_density =
us_label( tr(
"Density" ) );
170 QLabel* lb_viscosity =
us_label( tr(
"Viscosity" ) );
171 QLabel* lb_vbar =
us_label( tr(
"Vbar" ) );
172 QLabel* lb_compress =
us_label( tr(
"Compressibility" ) );
181 QFontMetrics fme( lb_compress->font() );
182 int pwid = fme.width( lb_compress->text() + 6 );
183 int lwid = pwid * 3 / 4;
185 lb_vbar ->setMinimumWidth( pwid );
186 le_vbar ->setMinimumWidth( lwid );
187 lb_compress->setMinimumWidth( pwid );
190 QLabel* lb_experiment =
us_banner( tr(
"Experimental Parameters (at 20" )
192 QLabel* lb_variance =
us_label ( tr(
"Variance:" ) );
248 QLabel* lb_scan =
us_banner( tr(
"Scan Control" ) );
249 QLabel* lb_from =
us_label ( tr(
"Scan focus from:" ) );
251 QLabel* lb_to =
us_label ( tr(
"to:" ) );
256 ct_to ->setValue( 0 );
261 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
263 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
283 tr(
"OD Difference" ) );
286 tr(
"Velocity Data" ),
288 tr(
"Absorbance" ) );
304 connect(
pb_reset, SIGNAL( clicked() ),
305 this, SLOT(
reset() ) );
306 connect(
pb_close, SIGNAL( clicked() ),
308 connect(
pb_help, SIGNAL( clicked() ),
309 this, SLOT(
help() ) );
312 QLabel* lb_progress =
us_label( tr(
"% Complete:" ) );
314 lb_progress->setAlignment( Qt::AlignCenter );
320 QVBoxLayout* mcctlLayout =
new QVBoxLayout();
321 QHBoxLayout* mosbox =
new QHBoxLayout();
330 QGroupBox* gb_msim =
new QGroupBox();
331 mcctlLayout->setContentsMargins( 0, 0, 0, 0 );
332 gb_msim ->setContentsMargins( 0, 2, 0, 2 );
333 mosbox ->setContentsMargins( 0, 0, 0, 0 );
334 mosbox ->setSpacing( 2 );
335 gb_msim ->setFlat(
true );
337 gb_msim ->setAutoFillBackground(
true );
342 gb_msim->setLayout( mosbox );
343 mosbox ->addLayout( rl_curmod );
344 mosbox ->addLayout( rl_mode );
345 mosbox ->addLayout( rl_mean );
346 mosbox ->addLayout( rl_median );
349 mcctlLayout->addWidget( gb_msim );
354 gb_msim ->setVisible(
false );
356 connect(
rb_curmod, SIGNAL( toggled (
bool ) ),
358 connect(
rb_mean, SIGNAL( toggled (
bool ) ),
360 connect(
rb_median, SIGNAL( toggled (
bool ) ),
362 connect(
rb_mode, SIGNAL( toggled (
bool ) ),
364 connect(
pb_nextm, SIGNAL( clicked () ),
366 connect(
ct_model, SIGNAL( valueChanged (
double ) ),
391 bmd_pos = this->pos() + QPoint( 100, 100 );
392 epd_pos = this->pos() + QPoint( 200, 200 );
393 rpd_pos = this->pos() + QPoint( 300, 400 );
408 setMaximumSize( qApp->desktop()->size() - QSize( 40, 40 ) );
453 DbgLv(1) <<
"LD: open dialog";
458 connect( dialog, SIGNAL( changed(
bool ) ),
460 connect( dialog, SIGNAL(
progress(
const QString ) ),
463 DbgLv(1) <<
"LD: exec dialog";
464 if ( dialog->exec() != QDialog::Accepted )
return;
471 if ( local == US_Disk_DB_Controls::DB )
481 query <<
"get_experiment_info_by_runID"
489 idExp = dbP->
value( 1 ).toInt();
493 DbgLv(1) <<
"SS: ss0 w2tfirst w2tlast timefirst timelast"
505 QString expfpath = workingDir +
"/" +
runID +
"."
507 DbgLv(1) <<
"LD: expf path" << expfpath;
508 QFile xfi( expfpath )
510 if ( xfi.open( QIODevice::ReadOnly ) )
512 QXmlStreamReader xmli( &xfi );
514 while ( ! xmli.atEnd() )
518 if ( xmli.isStartElement() && xmli.name() ==
"speedstep" )
523 DbgLv(1) <<
"LD: sp: rotspeed" << sp.rotorspeed <<
"t1" << sp.time_first;
533 qApp->processEvents();
536 QFontMetrics fm( font );
537 int fontHeight = fm.lineSpacing();
539 lw_triples->setMaximumHeight( fontHeight *
min( ntriples, 4 ) + 12 );
541 for (
int ii = 0; ii < ntriples; ii++ )
552 le_temp->setText( QString::number( avgTemp,
'f', 1 ) +
" " +
DEGC );
555 connect(
lw_triples, SIGNAL( currentRowChanged(
int ) ),
572 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
575 bmd_pos = this->pos() + QPoint( 100, 100 );
576 epd_pos = this->pos() + QPoint( 200, 200 );
577 rpd_pos = this->pos() + QPoint( 300, 300 );
587 dialog->move( this->pos() + QPoint( 100, 100 ) );
589 qApp->processEvents();
604 le_temp->setText( QString::number( avgTemp,
'f', 1 )
613 ct_to ->setStep( 1.0 );
623 QString bmanu =
manual ?
"1" :
"0";
624 QString svbar =
le_vbar ->text();
626 DbgLv(1) <<
"Fem:Upd: (0)svbar" << svbar;
633 bvisc, bcomp, bmanu, errmsg );
637 DbgLv(1) <<
"Fem:Upd: bufvl" << bufvl <<
"svbar" << svbar;
641 bcomp = QString::number( bcomp.toDouble() );
649 manual = ( !bmanu.isEmpty() && bmanu ==
"1" );
650 DbgLv(1) <<
"Fem:Upd: solID" << solID;
652 if ( solID.isEmpty() )
654 QMessageBox::warning(
this, tr(
"Solution/Buffer Fetch" ),
655 tr(
"Empty solution ID value!" ) );
658 else if ( solID.length() < 36 && dbP != NULL )
661 DbgLv(1) <<
"Fem:Upd: (1)svbar" << svbar;
671 svbar = QString::number(
vbar );
673 DbgLv(1) <<
"Fem:Upd: (9)svbar" << svbar;
678 QMessageBox::warning(
this, tr(
"Solution/Buffer Fetch" ),
681 le_solution ->setText( tr(
"( ***Undefined*** )" ) );
703 pb_distrib ->setText ( tr(
"s20,W Distribution" ) );
739 QString triple = QString(
triples.at( drow ) ).replace(
" / ",
"/" );
740 QString dataType = tr(
"Absorbance" );
743 if (
edata->
dataType ==
"IP" ) dataType = tr(
"Interference" );
744 if (
edata->
dataType ==
"FI" ) dataType = tr(
"Fluourescence" );
746 tr(
"Velocity Data for " ) + triple +
" of\n" +
edata->
runID );
750 tr(
"Radius (cm)" ) );
756 int from = (int)
ct_from->value();
757 int to = (int)
ct_to ->value();
765 count = points > count ? points : count;
768 QVector< double > vecr( count );
769 QVector< double > vecv( count );
770 double* rr = vecr.data();
771 double* vv = vecv.data();
775 QPen pen_red( Qt::red );
791 point = ( point < 5 ) ? 5 : point;
792 double baseline = 0.0;
794 for (
int jj = point - 5; jj < point + 6; jj++ )
805 bool highlight = ( scan_nbr >= from && scan_nbr <= to );
809 for (
int jj = 0; jj < points; jj++ )
815 title = tr(
"Curve " ) + QString::number( ii ) + tr(
" in range" );
819 cc->setPen( pen_red );
821 cc->setPen( pen_plot );
823 cc->setData( rr, vv, points );
830 double vh =
edata->
value( scanCount - 1, points - 1 );
837 DbgLv(1) <<
" RL" << rl <<
" VH" << vh;
840 DbgLv(1) <<
" sdata ns nc " << nscan << nconc;
855 DbgLv(2) <<
" II POINTS" << ii << points;
862 for (
int jj = 0; jj < points; jj++ )
868 rmsd +=
sq( da - vp );
870 DbgLv(3) <<
" JJ rr vv" << jj << rr << vv;
878 title =
"SimCurve " + QString::number( ii );
880 cc->setPen( pen_red );
881 cc->setData( rr, vv, count );
882 DbgLv(1) <<
"Sim plot scan count" << ii << count
883 <<
" r0 v0 rN vN" << rr[0] << vv[0 ] << rr[count-1] << vv[count-1];
886 rmsd /= (double)kpts;
889 DbgLv(1) <<
" Sim plot rmsd kpts" << rmsd << kpts;
890 le_rmsd ->setText( QString::number( rmsd ) );
896 for(
int jj=0; jj<points; jj++)
899 DbgLv(1) <<
"VSUM=" << vsum;
902 DbgLv(1) <<
"SDAT 0-3"
907 DbgLv(1) <<
"SDAT *-n"
912 DbgLv(1) <<
"MDL comp 1 s,k,w,D,f"
919 DbgLv(1) <<
"MDL comp 2 s,k,w,D,f"
926 DbgLv(1) <<
"MDL asoc 1 Kd,koff"
929 DbgLv(1) <<
"DS dens visc manual temp"
935 DbgLv(1) <<
"SIMP simpt mType gType rreso menis"
941 DbgLv(1) <<
"SIMP bott temp rnoise tinoise rinoise"
947 DbgLv(1) <<
"SIMP bform bvol bottpos rcoeffs"
954 DbgLv(1) <<
"STEP0 durmin dlymin w2tf w2tl timf timl"
961 DbgLv(1) <<
"STEP0 speed accel accelf"
993 mBox.addButton( tr(
"Save" ), QMessageBox::RejectRole );
994 QPushButton* bSkip = mBox.addButton( tr(
"Skip" ),
995 QMessageBox::NoRole );
996 QPushButton* bEdit = mBox.addButton( tr(
"Edit" ),
997 QMessageBox::YesRole );
998 mBox.setDefaultButton( bEdit );
999 mBox.setWindowTitle ( tr(
"3D Plot Save?" ) );
1000 mBox.setTextFormat ( Qt::RichText );
1002 "You selected Save Data without a 3D Plot already displayed.<br>"
1003 "Do you want a 3D Plot to be saved with the other reports?<ul>"
1004 "<li><b>Save</b> to include the 3D Plot in the report (AS IS);</li>"
1005 "<li><b>Skip</b> to exclude the 3D Plot from report saves;</li>"
1006 "<li><b>Edit</b> to abort save for now so that you can edit<br>"
1007 "the 3D Plot and re-select Save Data when ready.</li></ul>" ) );
1008 mBox.setIcon ( QMessageBox::Information );
1012 if ( mBox.clickedButton() == bEdit )
1014 QMessageBox::information(
this, tr(
"Edit 3D Plot" ),
1015 tr(
"You may now edit the 3D Plot.\n"
1016 "When it is ready, re-select 'Save Data'" ) );
1021 else if ( mBox.clickedButton() == bSkip )
1027 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
1028 QDateTime time0=QDateTime::currentDateTime();
1033 QString tripnode = QString(
triples.at( drow ) ).replace(
" / ",
"" );
1036 QString htmlFile = basename +
"report.html";
1037 QFile rep_f( htmlFile );
1038 if ( ! rep_f.open( QIODevice::WriteOnly | QIODevice::Text ) )
1041 QTextStream ts( &rep_f );
1049 const QString svgext(
".svgz" );
1050 const QString pngext(
".png" );
1051 const QString csvext(
".csv" );
1052 QString img01File = basename +
"velocity" + svgext;
1053 QString img02File = basename +
"residuals" + pngext;
1054 QString img03File = basename +
"s_distrib" + svgext;
1055 QString img04File = basename +
"mw_distrib" + svgext;
1056 QString img05File = basename +
"D_distrib" + svgext;
1057 QString img06File = basename +
"ff0_vs_s" + svgext;
1058 QString img07File = basename +
"ff0_vs_mw" + svgext;
1059 QString img08File = basename +
"D_vs_s" + svgext;
1060 QString img09File = basename +
"D_vs_mw" + svgext;
1061 QString img10File = basename +
"3dplot" + pngext;
1062 QString img11File = basename +
"rbitmap" + pngext;
1063 QString img12File = basename +
"tinoise" + svgext;
1064 QString img13File = basename +
"rinoise" + svgext;
1065 QString mdistFile = basename +
"mdistr_tab" + csvext;
1069 img06File.replace(
"ff0",
"vbar" );
1070 img07File.replace(
"ff0",
"vbar" );
1072 DbgLv(1) <<
"cnstvb" <<
cnstvb <<
"img06File" << img06File;
1079 p1type = ( p1type < 0 ) ? 9 : p1type;
1080 QString p1file = img02File;
1081 if ( p1type == 0 ) p1file = img03File;
1082 else if ( p1type == 1 ) p1file = img04File;
1083 else if ( p1type == 2 ) p1file = img05File;
1084 else if ( p1type == 3 ) p1file = img06File;
1085 else if ( p1type == 4 ) p1file = img07File;
1086 else if ( p1type == 5 ) p1file = img06File;
1087 else if ( p1type == 6 ) p1file = img07File;
1088 else if ( p1type == 7 ) p1file = img08File;
1089 else if ( p1type == 8 ) p1file = img09File;
1090 DbgLv(1) <<
"p1type" << p1type <<
"p1file" << p1file;
1122 if ( p1type != 3 && p1type != 5 )
1129 if ( p1type != 4 && p1type != 6 )
1150 DbgLv(1) <<
"(9)p1type" << p1type;
1178 QwtPlot* nois_plot =
resplotd->rp_data_plot2();
1193 QwtPlot* nois_plot =
resplotd->rp_data_plot2();
1203 QString umsg = tr(
"In directory " )
1204 + basename.left( basename.lastIndexOf(
"/" ) )
1205 + tr(
" ,\nwrote:\n" );
1207 for (
int ii = 0; ii < files.length(); ii++ )
1209 QString fname = files[ ii ];
1211 + fname.mid( fname.lastIndexOf(
"/" ) + 1 ) +
"\n";
1214 QDateTime time1=QDateTime::currentDateTime();
1219 umsg = umsg + tr(
"\nFiles were also saved to the database.\n" );
1221 QDateTime time2=QDateTime::currentDateTime();
1222 int etim1=time0.msecsTo(time1);
1223 int etim2=time1.msecsTo(time2);
1224 int etimt=etim1+etim2;
1225 int et1pc=(etim1*100)/etimt;
1226 int et2pc=(etim2*100)/etimt;
1227 DbgLv(1) <<
"SAVE-FILES: local ms" << etim1 <<
"=" << et1pc <<
"%";
1228 DbgLv(1) <<
"SAVE-FILES: DB ms" << etim2 <<
"=" << et2pc <<
"%";
1230 QApplication::restoreOverrideCursor();
1231 QMessageBox::information(
this, tr(
"Successfully Written" ), umsg );
1238 QTextStream ts( &mtext );
1245 editd->setWindowTitle( tr(
"Report: FE Match Model Simulation" ) );
1246 editd->move( this->pos() + QPoint( 100, 100 ) );
1247 editd->resize( 800, 700 );
1250 editd->
e->setHtml( mtext );
1257 double to =
ct_to->value();
1261 ct_to->disconnect();
1262 ct_to->setValue( from );
1264 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
1274 double from =
ct_from->value();
1281 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
1291 double from =
ct_from->value();
1292 double to =
ct_to ->value();
1293 int displayedScan = 1;
1298 for (
int ii = 0; ii < totalScans; ii++ )
1303 if ( displayedScan >= from && displayedScan <= to )
1309 ct_to->setValue( 0 );
1324 const char* dptyp[] =
1326 "s20,w distribution",
1328 "D20,w distribution",
1337 const int ndptyp =
sizeof( dptyp ) /
sizeof( dptyp[0] );
1346 ii = ( ii == ndptyp ) ? 0 : ii;
1347 ii = (
cnstvb && ii == 5 ) ? 7 : ii;
1348 ii = ( !
cnstvb && ii == 3 ) ? 5 : ii;
1349 pb_distrib->setText( QString( dptyp[ ii ] ) );
1375 QString pltitle = tr(
"Run " ) +
edata->
runID + tr(
" :\nCell " )
1378 QString yatitle = tr(
"Rel. Concentr." );
1382 pltitle = pltitle + tr(
"\ns20,W Distribution" );
1383 xatitle = tr(
"Corrected Sedimentation Coefficient" );
1386 else if ( type == 1 )
1388 pltitle = pltitle + tr(
"\nMW Distribution" );
1389 xatitle = tr(
"Molecular Weight (Dalton)" );
1392 else if ( type == 2 )
1394 pltitle = pltitle + tr(
"\nD20,W Distribution" );
1395 xatitle = tr(
"D20,W (cm^2/sec)" );
1401 data_plot1->setAxisTitle( QwtPlot::yLeft, yatitle );
1402 data_plot1->setAxisTitle( QwtPlot::xBottom, xatitle );
1409 QVector< double > vecx( dsize );
1410 QVector< double > vecy( dsize );
1411 double* xx = vecx.data();
1412 double* yy = vecy.data();
1413 double xmin = 1.0e30;
1414 double xmax = -1.0e30;
1415 double ymin = 1.0e30;
1416 double ymax = -1.0e30;
1421 for (
int jj = 0; jj < dsize; jj++ )
1429 xmin =
min( xval, xmin );
1430 xmax =
max( xval, xmax );
1431 ymin =
min( yval, ymin );
1432 ymax =
max( yval, ymax );
1435 rdif = ( xmax - xmin ) / 20.0;
1438 rdif = ( ymax - ymin ) / 20.0;
1441 xmin = ( type == 0 ) ? xmin :
max( xmin, 0.0 );
1442 ymin =
max( ymin, 0.0 );
1444 data_grid->enableYMin(
true );
1445 data_grid->enableY(
true );
1446 data_grid->setMajPen(
1449 data_curv->setData( xx, yy, dsize );
1450 data_curv->setPen( QPen( Qt::yellow, 3, Qt::SolidLine ) );
1451 data_curv->setStyle( QwtPlotCurve::Sticks );
1453 data_plot1->setAxisAutoScale( QwtPlot::xBottom );
1454 data_plot1->setAxisAutoScale( QwtPlot::yLeft );
1455 data_plot1->setAxisScale( QwtPlot::xBottom, xmin, xmax );
1456 data_plot1->setAxisScale( QwtPlot::yLeft, ymin, ymax );
1464 QString pltitle = tr(
"Run " ) +
edata->
runID + tr(
" :\nCell " )
1471 pltitle = pltitle + tr(
"\nf/f0 vs Sed. Coeff." );
1472 yatitle = tr(
"Frictional Ratio f/f0" );
1473 xatitle = tr(
"Sedimentation Coefficient s20,W" );
1476 else if ( type == 4 )
1478 pltitle = pltitle + tr(
"\nf/f0 vs Mol. Weight" );
1479 yatitle = tr(
"Frictional Ratio f/f0" );
1480 xatitle = tr(
"Molecular Weight" );
1483 else if ( type == 5 )
1485 pltitle = pltitle + tr(
"\nVbar vs Sed. Coeff." );
1486 yatitle = tr(
"Vbar at 20" ) +
DEGC;
1487 xatitle = tr(
"Sedimentation Coefficient s20,W" );
1490 else if ( type == 6 )
1492 pltitle = pltitle + tr(
"\nVbar vs Mol. Weight" );
1493 yatitle = tr(
"Vbar at 20" ) +
DEGC;
1494 xatitle = tr(
"Molecular Weight" );
1497 else if ( type == 7 )
1499 pltitle = pltitle + tr(
"\nDiff. Coeff. vs Sed. Coeff." );
1500 yatitle = tr(
"Diff. Coeff. D20,W" );
1501 xatitle = tr(
"Sedimentation Coefficient s20,W" );
1504 else if ( type == 8 )
1506 pltitle = pltitle + tr(
"\nDiff. Coeff. vs Molecular Weight" );
1507 yatitle = tr(
"Diff. Coeff. D20,W" );
1508 xatitle = tr(
"Molecular Weight" );
1512 data_plot1->setAxisTitle( QwtPlot::yLeft, yatitle );
1513 data_plot1->setAxisTitle( QwtPlot::xBottom, xatitle );
1523 QVector< double > vecx( dsize );
1524 QVector< double > vecy( dsize );
1525 double* xx = vecx.data();
1526 double* yy = vecy.data();
1527 double xmin = 1.0e30;
1528 double xmax = -1.0e30;
1529 double ymin = 1.0e30;
1530 double ymax = -1.0e30;
1535 for (
int jj = 0; jj < dsize; jj++ )
1546 xmin =
min( xval, xmin );
1547 xmax =
max( xval, xmax );
1548 ymin =
min( yval, ymin );
1549 ymax =
max( yval, ymax );
1552 rdif = ( xmax - xmin ) / 20.0;
1555 rdif = ( ymax - ymin ) / 20.0;
1558 xmin = ( type & 1 ) == 1 ? xmin :
max( xmin, 0.0 );
1559 ymin =
max( ymin, 0.0 );
1561 data_grid->enableYMin(
true );
1562 data_grid->enableY(
true );
1563 data_grid->setMajPen(
1566 symbol.setStyle( QwtSymbol::Ellipse );
1567 symbol.setPen( QPen( Qt::red ) );
1568 symbol.setBrush( QBrush( Qt::yellow ) );
1570 symbol.setSize( 5 );
1571 else if ( dsize > 50 )
1572 symbol.setSize( 8 );
1573 else if ( dsize > 20 )
1574 symbol.setSize( 10 );
1576 symbol.setSize( 12 );
1578 data_curv->setStyle( QwtPlotCurve::NoCurve );
1579 data_curv->setSymbol( symbol );
1580 data_curv->setData( xx, yy, dsize );
1582 data_plot1->setAxisAutoScale( QwtPlot::xBottom );
1583 data_plot1->setAxisAutoScale( QwtPlot::yLeft );
1584 data_plot1->setAxisScale( QwtPlot::xBottom, xmin, xmax );
1585 data_plot1->setAxisScale( QwtPlot::yLeft, ymin, ymax );
1593 QString pltitle = tr(
"Run " ) +
edata->
runID + tr(
" :\nCell " )
1595 QString yatitle = tr(
"OD Difference" );
1596 QString xatitle = tr(
"Radius (cm)" );
1599 data_plot1->setAxisTitle( QwtPlot::yLeft, yatitle );
1600 data_plot1->setAxisTitle( QwtPlot::xBottom, xatitle );
1606 QwtPlotCurve* data_curv;
1610 QVector< double > vecx( dsize );
1611 QVector< double > vecy( dsize );
1612 double* xx = vecx.data();
1613 double* yy = vecy.data();
1616 double xmin = 1.0e30;
1617 double xmax = -1.0e30;
1618 double ymin = 1.0e30;
1619 double ymax = -1.0e30;
1624 for (
int jj = 0; jj < dsize; jj++ )
1627 xmin =
min( xval, xmin );
1628 xmax =
max( xval, xmax );
1632 rdif = ( xmax - xmin ) / 20.0;
1635 xmin =
max( xmin, 0.0 );
1637 for (
int ii = 0; ii <
scanCount; ii++ )
1639 for (
int jj = 0; jj < dsize; jj++ )
1641 yval =
resids[ ii ][ jj ];
1642 ymin =
min( yval, ymin );
1643 ymax =
max( yval, ymax );
1647 rdif = ( ymax - ymin ) / 20.0;
1651 data_grid->enableYMin(
true );
1652 data_grid->enableY(
true );
1653 data_grid->setMajPen(
1656 data_plot1->setAxisAutoScale( QwtPlot::xBottom );
1657 data_plot1->setAxisAutoScale( QwtPlot::yLeft );
1658 data_plot1->setAxisScale( QwtPlot::xBottom, xmin, xmax );
1659 data_plot1->setAxisScale( QwtPlot::yLeft, ymin, ymax );
1666 line_curv->setPen( QPen( Qt::red ) );
1667 line_curv->setData( zx, zy, 2 );
1669 for (
int ii = 0; ii <
scanCount; ii++ )
1672 for (
int jj = 0; jj < dsize; jj++ )
1674 yy[ jj ] =
resids[ ii ][ jj ];
1679 data_curv->setPen( QPen( Qt::yellow ) );
1680 data_curv->setStyle( QwtPlotCurve::Dots );
1681 data_curv->setData( xx, yy, dsize );
1748 if (
dataList[ drow ].channel ==
"S" )
1750 if ( !
mfilter.contains(
"=m" ) )
1755 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
1758 mdesc,
dataList[ drow ].editGUID );
1760 connect( &dialog, SIGNAL( changed(
bool ) ),
1763 dialog.move( this->pos() + QPoint( 200, 200 ) );
1764 QApplication::restoreOverrideCursor();
1766 if ( dialog.exec() != QDialog::Accepted )
1769 qApp->processEvents();
1783 QMessageBox::critical(
this, tr(
"Empty Model" ),
1784 tr(
"Loaded model has ZERO components!" ) );
1814 double vbar20 =
le_vbar ->text().toDouble();
1839 if (
cnstvb && mc_vbar != sd.
vbar20 && mc_vbar != 0.0 )
1843 DbgLv(1) <<
"Fem:Adj: avgT" << avgTemp <<
"vb20 vb" << sd.
vbar20 << sd.
vbar;
1848 DbgLv(1) <<
"Fem:Adj: vbars (t,s,m,c,20) "
1850 <<
"scorr dcorr" << scorrec << dcorrec;
1881 QStringList mieGUIDs;
1882 QStringList nieGUIDs;
1885 DbgLv(1) <<
"editGUID " << editGUID;
1886 DbgLv(1) <<
"modelGUID " << modelGUID;
1888 te_desc->setText( tr(
"<b>Scanning noise for %1 ...</b>" )
1890 qApp->processEvents();
1894 mieGUIDs, nieGUIDs );
1896 for (
int jj=0;jj<nenois;jj++)
1897 DbgLv(1) <<
" jj nieG" << jj << nieGUIDs.at(jj);
1908 nldiag->move( this->pos() + QPoint( 200, 200 ) );
1910 qApp->processEvents();
1917 QString noiID = nieGUIDs.at( 0 );
1918 QString typen = noiID.section(
":", 1, 1 );
1919 noiID = noiID.section(
":", 0, 0 );
1921 if ( typen ==
"ti" )
1935 if ( ntinois > 0 && ntinois < npoints )
1938 while ( jj++ < npoints )
1944 if ( nrinois > 0 && nrinois < nscans )
1947 while ( jj++ < nscans )
1958 pmsg = tr(
"The noise file was padded out with zeroes\n"
1959 "in order to match the data range." );
1961 pmsg = tr(
"The noise files were padded out with zeroes\n"
1962 "in order to match the data ranges." );
1964 QMessageBox::information(
this, tr(
"Noise Padded Out" ), pmsg );
1974 qApp->processEvents();
1984 QMessageBox::critical(
this, tr(
"Negative Buoyancy Implied" ),
1985 tr(
"The current Vbar value (%1) implies a buoyancy\n"
1986 "value (%2) that is non-positive.\n\n"
1987 "Simulate Model cannot proceed with this value. Click on\n"
1988 "the <Solution> button and change the Vbar value.\n"
1989 "Note that the Solution may be accepted without being saved." )
1990 .arg(
vbar ).arg( buoy ) );
2000 double radlo = edata->
radius( 0 );
2001 double radhi = edata->
radius( nconc - 1 );
2002 DbgLv(1) <<
" kscan nscan nconc" << kscan << nscan << nconc;
2003 DbgLv(1) <<
" radlo radhi" << radlo << radhi;
2006 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
2026 QString mtyp =
adv_vals[
"meshtype" ];
2027 QString gtyp =
adv_vals[
"gridtype" ];
2028 QString bvol =
adv_vals[
"bndvolume" ];
2029 DbgLv(1) <<
" meshtype" << mtyp;
2031 if ( mtyp.contains(
"Claverie" ) )
2033 else if ( mtyp.contains(
"Moving Hat" ) )
2035 else if ( mtyp.contains(
"File:" ) )
2037 else if ( mtyp.contains(
"ASTFVM" ) )
2040 if ( gtyp.contains(
"Constant" ) )
2044 double concval1 = 0.0;
2070 DbgLv(1) <<
" rdata->c0" << rdata->
value(0,0);
2071 DbgLv(1) <<
" rdata->cN" << rdata->
value(0,nconc-1);
2072 DbgLv(1) <<
" edata->c0" << edata->
value(0,0);
2073 DbgLv(1) <<
" edata->cN" << edata->
value(0,nconc-1);
2078 DbgLv(1) <<
" afrsa init";
2091 DbgLv(1) <<
" nthread ntc ncomp" <<
nthread << ntc << ncomp;
2103 connect( astfem_rsa, SIGNAL( current_component(
int ) ),
2105 DbgLv(1) <<
" afrsa calc";
2116 DbgLv(1) <<
" afvm calc: sigma delta coSed compress"
2121 connect( astfvm, SIGNAL( comp_progress(
int ) ),
2135 DbgLv(1) <<
" USING THREADING";
2141 QList< ThreadWorker* > tworkers;
2142 QList< QThreadEx* > wthreads;
2145 for (
int ii = 0; ii < ncomp; ii++ )
2150 tmodels[ ii ].components.clear();
2165 for (
int ii = 0; ii <
nthread; ii++ )
2167 DbgLv(1) <<
"Thr-Bld ii" << ii <<
"model comps"
2168 <<
tmodels[ii].components.size();
2173 tworker->moveToThread( wthread );
2174 tworkers << tworker;
2175 wthreads << wthread;
2177 connect( wthread, SIGNAL( started() ),
2178 tworker, SLOT ( calc_simulation() ) );
2180 connect( tworker, SIGNAL( work_progress (
int,
int ) ),
2182 connect( tworker, SIGNAL( work_complete (
int ) ),
2187 DbgLv(1) <<
" +++End Of Thr-St loop";
2195 long dur_calc =
start_time.msecsTo( QDateTime::currentDateTime() );
2196 DbgLv(0) << dur_calc <<
"Msecs. for calculations using"
2203 DbgLv(1) <<
" afrsa done M N" << nscan << nconc;
2214 rmsd = sqrt( rmsd );
2215 le_rmsd ->setText( QString::number( rmsd ) );
2243 QApplication::restoreOverrideCursor();
2255 int nfi = files.size();
2268 part = file.split(
"." );
2269 test = part[ 0 ] + part[ 3 ] + part[ 4 ] + part[ 5 ];
2272 for (
int ii = 1; ii < nfi; ii++ )
2277 part = file.split(
"." );
2278 test = part[ 0 ] + part[ 3 ] + part[ 4 ] + part[ 5 ];
2280 if ( QString::compare( test, ptest ) != 0 )
2282 ofiles.append( pfile );
2287 ofiles.append( file );
2296 le_sedcoeff->setText( QString::number(
model.
components[ index ].s ) );
2297 le_difcoeff->setText( QString::number(
model.
components[ index ].D ) );
2298 le_partconc->setText(
2300 le_moweight->setText(
2315 for (
int jj = 1; jj < ssize; jj++ )
2317 if ( xv == sx[ jj ] )
2322 if ( xv < sx[ jj ] )
2325 double dx = sx[ jj ] - sx[ ii ];
2326 double dy = sy[ jj ] - sy[ ii ];
2327 return ( sy[ ii ] + ( xv - sx[ ii ] ) * dy / dx );
2334 double dx = sx[ jj ] - sx[ ii ];
2335 double dy = sy[ jj ] - sy[ ii ];
2336 return ( sy[ ii ] + ( xv - sx[ ii ] ) * dy / dx );
2347 ts <<
" </body>\n</html>\n";
2358 for (
int jj = nn - 5; jj < nn + 6; jj++ )
2361 return ( bl / 11.0 );
2368 QString title = stitle;
2376 title = tr(
"2-Dimensional Spectrum Analysis" );
2381 title = tr(
"Genetic Algorithm Analysis" );
2385 title = tr(
"C(s) Analysis" );
2389 title = tr(
"Finite Element Analysis" );
2393 title = tr(
"Parametrically Constrained Spectrum Analysis\n" );
2395 if ( stitle.contains(
"-SL" ) )
2396 title += tr(
"(Straight Line)" );
2398 else if ( stitle.contains(
"-IS" ) )
2399 title += tr(
"(Increasing Sigmoid)" );
2401 else if ( stitle.contains(
"-DS" ) )
2402 title += tr(
"(Decreasing Sigmoid)" );
2404 else if ( stitle.contains(
"-HL" ) )
2405 title += tr(
"(Horizontal Line)" );
2411 title = tr(
"2-Dimensional Spectrum Analysis" );
2416 title = title +
" (RA)";
2419 title = title +
" (Menisc.)";
2422 title = title +
" (Global)";
2425 title = title +
" (S.Glob.)";
2428 title = title +
" (MC)";
2430 if ( width > title.length() )
2432 int lent = title.length();
2433 int lenl = ( width - lent ) / 2;
2434 int lenr = width - lent - lenl;
2435 title = QString(
" " ).repeated( lenl ) + title
2436 + QString(
" " ).repeated( lenr );
2449 QVector< double > vecxx( dsize );
2450 QVector< double > vecsx( ssize );
2451 QVector< double > vecsy( ssize );
2452 double* xx = vecxx.data();
2453 double* sx = vecsx.data();
2454 double* sy = vecsy.data();
2464 bool matchd = ( dsize == ssize );
2467 QVector< double > resscan;
2470 resscan.resize( dsize );
2472 for (
int jj = 0; jj < dsize; jj++ )
2477 for (
int jj = 0; jj < ssize; jj++ )
2480 if ( sx[ jj ] != xx[ jj ] ) matchd =
false;
2483 for (
int ii = 0; ii <
scanCount; ii++ )
2489 for (
int jj = 0; jj < ssize; jj++ )
2494 for (
int jj = 0; jj < dsize; jj++ )
2503 yval =
edata->
value( ii, jj ) - sval - rnoi - tnoi;
2513 resscan[ jj ] = yval;
2516 resids.append( resscan );
2519 rmsd /= (double)( kpts );
2521 rmsd = sqrt( rmsd );
2522 le_rmsd ->setText( QString::number( rmsd ) );
2540 return ( QString(
" " ).leftJustified( spaces,
' ' ) );
2546 return(
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td></tr>\n" );
2551 const QString& s3 )
const
2553 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>" + s3
2559 const QString& s3,
const QString& s4,
2560 const QString& s5 )
const
2562 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>" + s3
2563 +
"</td><td>" + s4 +
"</td><td>" + s5 +
"</td></tr>\n" );
2568 const QString& s3,
const QString& s4,
2569 const QString& s5,
const QString& s6,
2570 const QString& s7 )
const
2572 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>"
2573 + s3 +
"</td><td>" + s4 +
"</td><td>" + s5 +
"</td><td>"
2574 + s6 +
"</td><td>" + s7 +
"</td></tr>\n" );
2581 QString s = QString(
"<?xml version=\"1.0\"?>\n" );
2582 s +=
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n";
2583 s +=
" \"http://www.w3.org/TR/xhtml1/DTD"
2584 "/xhtml1-strict.dtd\">\n";
2585 s +=
"<html xmlns=\"http://www.w3.org/1999/xhtml\""
2586 " xml:lang=\"en\" lang=\"en\">\n";
2588 s +=
" <title> " + title +
" </title>\n";
2589 s +=
" <meta http-equiv=\"Content-Type\" content="
2590 "\"text/html; charset=iso-8859-1\"/>\n";
2591 s +=
" <style type=\"text/css\" >\n";
2592 s +=
" td { padding-right: 1em; }\n";
2593 s +=
" body { background-color: white; }\n";
2595 s +=
" </head>\n <body>\n";
2596 s +=
" <h1>" + head1 +
"</h1>\n";
2597 s +=
indent( 4 ) + tr(
"<h2>Data Report for Run \"" ) + edata->
runID;
2598 s +=
"\",<br/>\n" +
indent( 4 ) +
" " + tr(
" Cell " ) + edata->
cell;
2599 s += tr(
", Channel " ) + edata->
channel;
2600 s += tr(
", Wavelength " ) + edata->
wavelength;
2601 s +=
",<br/>\n" +
indent( 4 ) +
" " + tr(
" Edited Dataset " );
2602 s += edata->
editID +
"</h2>\n";
2613 QString dataType = tr(
"Absorbance" );
2614 if ( d->
dataType ==
"RI" ) dataType = tr(
"Intensity" );
2615 if ( d->
dataType ==
"WI" ) dataType = tr(
"Intensity" );
2616 if ( d->
dataType ==
"IP" ) dataType = tr(
"Interference" );
2617 if ( d->
dataType ==
"FI" ) dataType = tr(
"Fluourescence" );
2620 "\n" +
indent( 4 ) + tr(
"<h3>Detailed Run Information:</h3>\n" )
2621 +
indent( 4 ) +
"<table>\n"
2625 QString::number( (
int)d->
scanData[ 0 ].rpm ) +
" rpm" );
2629 double maxTemp = -1.0e99;
2630 double minTemp = 1.0e99;
2632 for (
int i = 0; i < d->
scanData.size(); i++ )
2634 double t = d->
scanData[ i ].temperature;
2636 maxTemp =
max( maxTemp, t );
2637 minTemp =
min( minTemp, t );
2640 QString average = QString::number( sum / d->
scanData.size(),
'f', 1 );
2642 s +=
table_row( tr(
"Average Temperature:" ), average +
" " +
MLDEGC );
2645 s +=
table_row( tr(
"Temperature Variation:" ), tr(
"Within tolerance" ) );
2647 s +=
table_row( tr(
"Temperature Variation:" ),
2648 tr(
"(!) OUTSIDE TOLERANCE (!)" ) );
2652 int minutes = (int)tcorrec / 60;
2653 int seconds = (int)tcorrec % 60;
2655 QString m = ( minutes == 1 ) ? tr(
" minute " ) : tr(
" minutes " );
2656 QString sec = ( seconds == 1 ) ? tr(
" second" ) : tr(
" seconds" );
2657 s +=
table_row( tr(
"Time Correction:" ),
2658 QString::number( minutes ) + m +
2659 QString::number( seconds ) + sec );
2661 double duration =
rawList.last().scanData.last().seconds;
2663 int hours = (int) duration / 3600;
2664 minutes = (int) duration / 60 - hours * 60;
2665 seconds = (int) duration % 60;
2668 h = ( hours == 1 ) ? tr(
" hour " ) : tr(
" hours " );
2669 m = ( minutes == 1 ) ? tr(
" minute " ) : tr(
" minutes " );
2670 sec = ( seconds == 1 ) ? tr(
" second " ) : tr(
" seconds " );
2673 QString::number( hours ) + h +
2674 QString::number( minutes ) + m +
2675 QString::number( seconds ) + sec );
2679 table_row( tr(
"Baseline " ) + dataType +
":",
2680 QString::number( baseline,
'f', 6 ) +
" OD" ) +
2682 QString::number( d->
meniscus,
'f', 3 ) +
" cm" );
2684 int rrx = d->
xvalues.size() - 1;
2685 double left = d->
xvalues[ 0 ];
2686 double right = d->
xvalues[ rrx ];
2688 s +=
table_row( tr(
"Edited Data starts at: " ),
2689 QString::number( left,
'f', 3 ) +
" cm" ) +
2690 table_row( tr(
"Edited Data stops at: " ),
2691 QString::number( right,
'f', 3 ) +
" cm" );
2692 s +=
indent( 4 ) +
"</table>\n";
2700 double avgTemp =
le_temp ->text().section(
" ", 0, 0 ).toDouble();
2710 QString s =
"\n" +
indent( 4 ) + tr(
"<h3>Hydrodynamic Settings:</h3>\n" )
2711 +
indent( 4 ) +
"<table>\n";
2713 s +=
table_row( tr(
"Viscosity corrected:" ),
2714 QString::number( solution.
viscosity,
'f', 5 ) ) +
2715 table_row( tr(
"Viscosity (absolute):" ),
2718 QString::number( solution.
density,
'f', 6 ) +
" g/ccm" ) +
2720 QString::number( solution.
density_tb,
'f', 6 ) +
" g/ccm" ) +
2722 QString::number( solution.
vbar,
'f', 6 ) +
" ccm/g" ) +
2724 QString::number( solution.
vbar20,
'f', 6 ) +
" ccm/g" ) +
2726 QString::number( solution.
buoyancyw,
'f', 6 ) ) +
2728 QString::number( solution.
buoyancyb,
'f', 6 ) ) +
2729 table_row( tr(
"Correction Factor (s):" ),
2731 table_row( tr(
"Correction Factor (D):" ),
2733 indent( 4 ) +
"</table>\n";
2745 QString s =
"\n" +
indent( 4 ) + tr(
"<h3>Scan Information:</h3>\n" )
2746 +
indent( 4 ) +
"<table>\n";
2748 s +=
table_row( tr(
"Scan" ), tr(
"Corrected Time" ),
2749 tr(
"Plateau Concentration" ) );
2751 for (
int i = 0; i < d->
scanData.size(); i++ )
2757 double od = d->
scanData[ i ].plateau;
2758 int time = (int)( d->
scanData[ i ].seconds - time_correction );
2760 s1 = s1.sprintf(
"%4d", i + 1 );
2761 s2 = s2.sprintf(
"%4d min %2d sec", time / 60, time % 60 );
2762 s3 = s3.sprintf(
"%.6f OD", od );
2767 s +=
indent( 4 ) +
"</table>\n";
2777 double rmsd_m = ( vari_m == 0.0 ) ? 0.0 : sqrt( vari_m );
2782 QString msim =
adv_vals[
"modelsim" ];
2787 if ( msim ==
"model" )
2789 msim =
"<b> ( single iteration )</b>";
2793 msim =
"<b> ( " + msim +
" )</b>";
2801 msim =
"<b> ( single iteration )</b>";
2805 .section(
".", -2, -2 ).section(
"_", 1, -1 );
2806 if ( mdla.isEmpty() )
2809 QString mstr =
"\n" +
indent( 4 )
2810 + tr(
"<h3>Data Analysis Settings:</h3>\n" )
2811 +
indent( 4 ) +
"<table>\n";
2813 mstr +=
table_row( tr(
"Model Analysis:" ), mdla + msim );
2814 mstr +=
table_row( tr(
"Number of Components:" ),
2815 QString::number( ncomp ) );
2816 mstr +=
table_row( tr(
"Residual RMS Deviation:" ),
2818 mstr +=
table_row( tr(
"Model-reported RMSD:" ),
2819 ( rmsd_m > 0.0 ) ? QString::number( rmsd_m ) :
"(none)" );
2821 double sum_mw = 0.0;
2827 double mink = 1e+99;
2828 double maxk = -1e+99;
2829 double minv = 1e+99;
2830 double maxv = -1e+99;
2832 for (
int ii = 0; ii < ncomp; ii++ )
2841 sum_v += ( vval * conc );
2842 sum_k += ( kval * conc );
2843 mink = qMin( kval, mink );
2844 maxk = qMax( kval, maxk );
2845 minv = qMin( vval, minv );
2846 maxv = qMax( vval, maxv );
2849 mstr +=
table_row( tr(
"Weight Average s20,W:" ),
2850 QString().sprintf(
"%6.4e", ( sum_s / sum_c ) ) );
2851 mstr +=
table_row( tr(
"Weight Average D20,W:" ),
2852 QString().sprintf(
"%6.4e", ( sum_D / sum_c ) ) );
2853 mstr +=
table_row( tr(
"W.A. Molecular Weight:" ),
2854 QString().sprintf(
"%6.4e", ( sum_mw / sum_c ) ) );
2856 mstr +=
table_row( tr(
"Weight Average f/f0:" ),
2857 QString::number( ( sum_k / sum_c ) ) );
2859 mstr +=
table_row( tr(
"Weight Average vbar20:" ),
2860 QString::number( ( sum_v / sum_c ) ) );
2861 mstr +=
table_row( tr(
"Total Concentration:" ),
2862 QString().sprintf(
"%6.4e", sum_c ) );
2865 mstr +=
table_row( tr(
"Constant vbar20:" ),
2866 QString::number( minv ) );
2868 mstr +=
table_row( tr(
"Constant f/f0:" ),
2869 QString::number( mink ) );
2870 mstr +=
indent( 4 ) +
"</table>\n";
2872 mstr +=
"\n" +
indent( 4 ) + tr(
"<h3>Distribution Information:</h3>\n" );
2873 mstr +=
indent( 4 ) +
"<table>\n";
2877 mstr +=
table_row( tr(
"Molec. Wt." ), tr(
"S Apparent" ),
2878 tr(
"S 20,W" ), tr(
"D Apparent" ),
2879 tr(
"D 20,W" ), tr(
"f / f0" ),
2880 tr(
"Concentration" ) );
2882 for (
int ii = 0; ii < ncomp; ii++ )
2885 double perc = 100.0 * conc / sum_c;
2887 QString().sprintf(
"%10.4e",
2889 QString().sprintf(
"%10.4e",
2890 model .components[ ii ].s ),
2891 QString().sprintf(
"%10.4e",
2893 QString().sprintf(
"%10.4e",
2894 model .components[ ii ].D ),
2895 QString().sprintf(
"%10.4e",
2897 QString().sprintf(
"%10.4e",
2899 QString().sprintf(
"%10.4e (%5.2f %%)", conc, perc ) );
2905 mstr +=
table_row( tr(
"Molec. Wt." ), tr(
"S Apparent" ),
2906 tr(
"S 20,W" ), tr(
"D Apparent" ),
2907 tr(
"D 20,W" ), tr(
"Vbar20" ),
2908 tr(
"Concentration" ) );
2910 for (
int ii = 0; ii < ncomp; ii++ )
2913 double perc = 100.0 * conc / sum_c;
2915 QString().sprintf(
"%10.4e",
2917 QString().sprintf(
"%10.4e",
2918 model .components[ ii ].s ),
2919 QString().sprintf(
"%10.4e",
2921 QString().sprintf(
"%10.4e",
2922 model .components[ ii ].D ),
2923 QString().sprintf(
"%10.4e",
2925 QString().sprintf(
"%10.4e",
2927 QString().sprintf(
"%10.4e (%5.2f %%)", conc, perc ) );
2933 mstr +=
table_row( tr(
"Molec. Wt." ), tr(
"S Apparent" ),
2934 tr(
"S 20,W" ), tr(
"D 20,W" ),
2935 tr(
"f / f0" ), tr(
"Vbar20" ),
2936 tr(
"Concentration" ) );
2938 for (
int ii = 0; ii < ncomp; ii++ )
2941 double perc = 100.0 * conc / sum_c;
2943 QString().sprintf(
"%10.4e",
2945 QString().sprintf(
"%10.4e",
2946 model .components[ ii ].s ),
2947 QString().sprintf(
"%10.4e",
2949 QString().sprintf(
"%10.4e",
2951 QString().sprintf(
"%10.4e",
2953 QString().sprintf(
"%10.4e",
2955 QString().sprintf(
"%10.4e (%5.2f %%)", conc, perc ) );
2963 mstr += tr(
"<h3>Reversible Associations Information:</h3>\n" );
2964 mstr +=
indent( 4 ) +
"<table>\n";
2965 mstr +=
table_row( tr(
"Reactant 1" ), tr(
"Reactant 2" ),
2966 tr(
"Product" ), tr(
"K_dissociation" ),
2967 tr(
"k_off Rate" ) );
2972 double k_d = as1.
k_d;
2973 double k_off = as1.
k_off;
2974 QString reac1 = tr(
"component %1" ).arg( as1.
rcomps[ 0 ] + 1 );
2975 QString reac2 = tr(
"(none)" );
2976 QString prod = tr(
"component %1" ).arg( as1.
rcomps[ 1 ] + 1 );
2977 if ( as1.
rcomps.size() > 2 )
2980 prod = tr(
"component %1" ).arg( as1.
rcomps[ 2 ] + 1 );
2984 QString().sprintf(
"%10.4e", k_d ),
2985 QString().sprintf(
"%10.4e", k_off ) );
2989 mstr +=
indent( 4 ) +
"</table>\n";
2993 QVector< double > rstats;
2994 QVector< QVector< double > > mstats;
2996 int ncomp =
imodels[ 0 ].components .size();
2997 int nreac =
imodels[ 0 ].associations.size();
3007 mstr += tr(
"<h3>Discrete Model GA-MC Summary Statistics:</h3>\n" );
3008 mstr +=
indent( 4 ) +
"<table>\n";
3009 mstr +=
table_row( tr(
"Component" ), tr(
"Attribute" ),
3010 tr(
"Mean_Value" ), tr(
"95%_Confidence(low)" ),
3011 tr(
"95%_Confidence(high)" ) );
3013 QString fixd = tr(
"(Fixed)" );
3017 atitl << tr(
"Concentration" )
3019 << tr(
"Molecular Weight" )
3020 << tr(
"Sedimentation Coefficient" )
3021 << tr(
"Diffusion Coefficient" )
3022 << tr(
"Frictional Ratio" );
3023 rtitl << tr(
"K_dissociation" )
3024 << tr(
"K_off Rate" );
3027 mstr +=
table_row( tr(
"(All)" ), tr(
"RMSD" ),
3028 QString().sprintf(
"%10.4e", rstats[ 2 ] ),
3029 QString().sprintf(
"%10.4e", rstats[ 9 ] ),
3030 QString().sprintf(
"%10.4e", rstats[ 10 ] ) );
3033 for (
int ii = 0; ii < ncomp; ii++ )
3035 QString compnum = QString().sprintf(
"%2d", ii + 1 );
3036 for (
int jj = 0; jj < 6; jj++ )
3038 bool is_fixed = ( mstats[ kd ][ 0 ] == mstats[ kd ][ 1 ] );
3039 QString strclo = is_fixed ? fixd :
3040 QString().sprintf(
"%10.4e", mstats[ kd ][ 9 ] );
3041 QString strchi = is_fixed ? blnk :
3042 QString().sprintf(
"%10.4e", mstats[ kd ][ 10 ] );
3043 mstr +=
table_row( compnum, atitl[ jj ],
3044 QString().sprintf(
"%10.4e", mstats[ kd ][ 2 ] ),
3050 mstr +=
indent( 4 ) +
"</table>\n";
3051 mstr +=
indent( 4 ) +
"<table>\n";
3052 mstr +=
table_row( tr(
"Reaction" ), tr(
"Attribute" ),
3053 tr(
"Mean_Value" ), tr(
"95%_Confidence(low)" ),
3054 tr(
"95%_Confidence(high)" ) );
3056 for (
int ii = 0; ii < nreac; ii++ )
3058 QString reacnum = QString().sprintf(
"%2d", ii + 1 );
3059 bool is_fixed = ( mstats[ kd ][ 0 ] == mstats[ kd ][ 1 ] );
3060 QString strclo = is_fixed ? fixd :
3061 QString().sprintf(
"%10.4e", mstats[ kd ][ 9 ] );
3062 QString strchi = is_fixed ? blnk :
3063 QString().sprintf(
"%10.4e", mstats[ kd ][ 10 ] );
3064 mstr +=
table_row( reacnum, tr(
"K_dissociation" ),
3065 QString().sprintf(
"%10.4e", mstats[ kd ][ 2 ] ),
3068 is_fixed = ( mstats[ kd ][ 0 ] == mstats[ kd ][ 1 ] );
3069 strclo = is_fixed ? fixd :
3070 QString().sprintf(
"%10.4e", mstats[ kd ][ 9 ] );
3071 strchi = is_fixed ? blnk :
3072 QString().sprintf(
"%10.4e", mstats[ kd ][ 10 ] );
3073 mstr +=
table_row( reacnum, tr(
"K_off Rate" ),
3074 QString().sprintf(
"%10.4e", mstats[ kd ][ 2 ] ),
3079 mstr +=
indent( 4 ) +
"</table>\n";
3083 mstr += tr(
"<h3>Discrete Model GA-MC Detailed Statistics:</h3>\n" );
3090 mstr +=
indent( 4 ) + tr(
"<h4>Details for MC Iteration RMSDs:</h4>\n" );
3091 mstr +=
indent( 4 ) +
"<table>\n";
3093 QString().sprintf(
"%10.4e", rstats[ 0 ] ) );
3095 QString().sprintf(
"%10.4e", rstats[ 1 ] ) );
3097 QString().sprintf(
"%10.4e", rstats[ 2 ] ) );
3099 QString().sprintf(
"%10.4e", rstats[ 3 ] ) );
3101 QString().sprintf(
"%10.4e", rstats[ 4 ] ) );
3103 QString().sprintf(
"%10.4e", rstats[ 5 ] ) );
3105 QString().sprintf(
"%10.4e", rstats[ 6 ] ) );
3107 QString().sprintf(
"%10.4e", rstats[ 7 ] ) );
3108 mstr +=
table_row( tr(
"Mode Center:" ),
3109 QString().sprintf(
"%10.4e", rstats[ 8 ] ) );
3110 mstr +=
table_row( tr(
"95% Confidence Interval Low:" ),
3111 QString().sprintf(
"%10.4e", rstats[ 9 ] ) );
3112 mstr +=
table_row( tr(
"95% Confidence Interval High:" ),
3113 QString().sprintf(
"%10.4e", rstats[ 10 ] ) );
3114 mstr +=
table_row( tr(
"99% Confidence Interval Low:" ),
3115 QString().sprintf(
"%10.4e", rstats[ 11 ] ) );
3116 mstr +=
table_row( tr(
"99% Confidence Interval High:" ),
3117 QString().sprintf(
"%10.4e", rstats[ 12 ] ) );
3118 mstr +=
table_row( tr(
"Standard Deviation:" ),
3119 QString().sprintf(
"%10.4e", rstats[ 13 ] ) );
3120 mstr +=
table_row( tr(
"Standard Error:" ),
3121 QString().sprintf(
"%10.4e", rstats[ 14 ] ) );
3123 QString().sprintf(
"%10.4e", rstats[ 15 ] ) );
3124 mstr +=
table_row( tr(
"Correlation Coefficient:" ),
3125 QString().sprintf(
"%10.4e", rstats[ 16 ] ) );
3126 mstr +=
table_row( tr(
"Number of Bins:" ),
3127 QString().sprintf(
"%10.0f", rstats[ 17 ] ) );
3128 mstr +=
table_row( tr(
"Distribution Area:" ),
3129 QString().sprintf(
"%10.4e", rstats[ 18 ] ) );
3130 mstr +=
table_row( tr(
"95% Confidence Limit Low:" ),
3131 QString().sprintf(
"%10.4e", rstats[ 19 ] ) );
3132 mstr +=
table_row( tr(
"95% Confidence Limit High:" ),
3133 QString().sprintf(
"%10.4e", rstats[ 20 ] ) );
3134 mstr +=
table_row( tr(
"99% Confidence Limit Low:" ),
3135 QString().sprintf(
"%10.4e", rstats[ 21 ] ) );
3136 mstr +=
table_row( tr(
"99% Confidence Limit High:" ),
3137 QString().sprintf(
"%10.4e", rstats[ 22 ] ) );
3138 mstr +=
indent( 4 ) +
"</table>\n";
3141 for ( kd = 0; kd < ntatt; kd++ )
3143 QString compnum = tr(
"Component %1 " ).arg( icomp );
3144 QString reacnum = tr(
"Reaction %1 " ).arg( ireac );
3145 QString attrib = compnum + atitl[ kk ];
3146 mstr +=
indent( 4 ) +
"<h4>" + tr(
"Details for " );
3148 if ( icomp <= ncomp )
3150 if (
imodels[ 0 ].is_product( icomp - 1 ) && kk == 0 )
3151 mstr += compnum + tr(
"(Product) Total Concentration" )
3154 mstr += compnum + atitl[ kk ] +
":</h4>\n";
3158 mstr += reacnum + rtitl[ kk ] +
":</h4>\n";
3161 mstr +=
indent( 4 ) +
"<table>\n";
3162 bool is_fixed = ( mstats[ kd ][ 0 ] == mstats[ kd ][ 1 ] );
3167 QString().sprintf(
"%10.4e", mstats[ kd ][ 0 ] ) );
3169 QString().sprintf(
"%10.4e", mstats[ kd ][ 1 ] ) );
3171 QString().sprintf(
"%10.4e", mstats[ kd ][ 2 ] ) );
3172 mstr +=
table_row( tr(
"Median (Fixed)" ),
3173 QString().sprintf(
"%10.4e", mstats[ kd ][ 3 ] ) );
3179 QString().sprintf(
"%10.4e", mstats[ kd ][ 0 ] ) );
3181 QString().sprintf(
"%10.4e", mstats[ kd ][ 1 ] ) );
3183 QString().sprintf(
"%10.4e", mstats[ kd ][ 2 ] ) );
3185 QString().sprintf(
"%10.4e", mstats[ kd ][ 3 ] ) );
3187 QString().sprintf(
"%10.4e", mstats[ kd ][ 4 ] ) );
3189 QString().sprintf(
"%10.4e", mstats[ kd ][ 5 ] ) );
3191 QString().sprintf(
"%10.4e", mstats[ kd ][ 6 ] ) );
3193 QString().sprintf(
"%10.4e", mstats[ kd ][ 7 ] ) );
3194 mstr +=
table_row( tr(
"Mode Center:" ),
3195 QString().sprintf(
"%10.4e", mstats[ kd ][ 8 ] ) );
3196 mstr +=
table_row( tr(
"95% Confidence Interval Low:" ),
3197 QString().sprintf(
"%10.4e", mstats[ kd ][ 9 ] ) );
3198 mstr +=
table_row( tr(
"95% Confidence Interval High:" ),
3199 QString().sprintf(
"%10.4e", mstats[ kd ][ 10 ] ) );
3200 mstr +=
table_row( tr(
"99% Confidence Interval Low:" ),
3201 QString().sprintf(
"%10.4e", mstats[ kd ][ 11 ] ) );
3202 mstr +=
table_row( tr(
"99% Confidence Interval High:" ),
3203 QString().sprintf(
"%10.4e", mstats[ kd ][ 12 ] ) );
3204 mstr +=
table_row( tr(
"Standard Deviation:" ),
3205 QString().sprintf(
"%10.4e", mstats[ kd ][ 13 ] ) );
3206 mstr +=
table_row( tr(
"Standard Error:" ),
3207 QString().sprintf(
"%10.4e", mstats[ kd ][ 14 ] ) );
3209 QString().sprintf(
"%10.4e", mstats[ kd ][ 15 ] ) );
3210 mstr +=
table_row( tr(
"Correlation Coefficient:" ),
3211 QString().sprintf(
"%10.4e", mstats[ kd ][ 16 ] ) );
3212 mstr +=
table_row( tr(
"Number of Bins:" ),
3213 QString().sprintf(
"%10.0f", mstats[ kd ][ 17 ] ) );
3214 mstr +=
table_row( tr(
"Distribution Area:" ),
3215 QString().sprintf(
"%10.4e", mstats[ kd ][ 18 ] ) );
3216 mstr +=
table_row( tr(
"95% Confidence Limit Low:" ),
3217 QString().sprintf(
"%10.4e", mstats[ kd ][ 19 ] ) );
3218 mstr +=
table_row( tr(
"95% Confidence Limit High:" ),
3219 QString().sprintf(
"%10.4e", mstats[ kd ][ 20 ] ) );
3220 mstr +=
table_row( tr(
"99% Confidence Limit Low:" ),
3221 QString().sprintf(
"%10.4e", mstats[ kd ][ 21 ] ) );
3222 mstr +=
table_row( tr(
"99% Confidence Limit High:" ),
3223 QString().sprintf(
"%10.4e", mstats[ kd ][ 22 ] ) );
3226 mstr +=
indent( 4 ) +
"</table>\n";
3228 if ( (++kk) >= kdmax )
3232 if ( icomp > ncomp )
3234 ireac = icomp - ncomp;
3247 if ( filename.contains(
".svg" ) )
3250 QMessageBox::warning(
this, tr(
"File Write Error" ),
3251 tr(
"Unable to write file" ) + filename );
3254 else if ( filename.endsWith(
"rbitmap.png" ) )
3268 rbmapd->activateWindow();
3271 QPixmap pixmap = QPixmap::grabWidget(
rbmapd, 0, 0,
3274 if ( ! pixmap.save( filename ) )
3275 QMessageBox::warning(
this, tr(
"File Write Error" ),
3276 tr(
"Unable to write file" ) + filename );
3279 else if ( filename.endsWith(
"3dplot.png" ) )
3289 #if defined(Q_WS_WIN) || defined(Q_WS_MAC)
3291 bool ok = widgw->
save_plot( filename, QString(
"png" ) );
3293 QGLWidget* dataw =
eplotcd->data_3dplot();
3294 QPixmap pixmap = dataw->renderPixmap( dataw->width(), dataw->height(),
3296 bool ok = pixmap.save( filename );
3300 QMessageBox::warning(
this, tr(
"File Write Error" ),
3301 tr(
"Unable to write file" ) + filename );
3304 else if ( filename.endsWith(
".png" ) )
3307 QMessageBox::warning(
this, tr(
"File Write Error" ),
3308 tr(
"Unable to write file" ) + filename );
3315 QDir folder( baseDir );
3317 if ( folder.exists( subdir ) )
return true;
3319 if ( folder.mkdir( subdir ) )
return true;
3321 QMessageBox::warning(
this,
3323 tr(
"Could not create the directory:\n" ) + baseDir +
"/" + subdir );
3341 te_desc->setText(
"<b>" + message +
" ...</b>" );
3366 QStringList query(
"get_experiment_info_by_runID" );
3372 expID = db.value( 1 ).toString().toInt();
3379 connect( soluInfo, SIGNAL( updateSolutionGuiSelection(
US_Solution ) ),
3391 QString sbufID = QString::number( bufID );
3395 QString svbar =
le_vbar ->text();
3398 QString errmsg =
"";
3406 bdens, bvisc, bcmpr, bmanu, errmsg );
3412 bdens, bvisc, bcmpr, bmanu, errmsg );
3418 svbar = QString::number(
vbar );
3419 manual = ( !bmanu.isEmpty() && bmanu ==
"1" );
3439 int totalScans = d->
scanData.size();
3443 ct_from->setMaxValue( totalScans );
3444 ct_to ->setMaxValue( totalScans );
3446 if (
ct_to->value() != 0 )
3447 ct_to ->setValue( 0 );
3466 le_solution ->setText( tr(
"(Experiment's solution)" ) );
3469 le_vbar ->setText( QString::number(
vbar,
'f', 5 ) );
3471 ct_to ->disconnect();
3473 ct_to ->setValue( 0 );
3475 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
3478 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
3506 pb_view ->setEnabled(
false );
3507 pb_save ->setEnabled(
false );
3513 le_id ->setText(
"" );
3521 const char* dptyp[] =
3523 "s20,w distribution",
3525 "D20,w distribution",
3534 const int ndptyp =
sizeof( dptyp ) /
sizeof( dptyp[0] );
3539 for (
int ii = 0; ii < ndptyp; ii++ )
3541 if ( curtxt == QString( dptyp[ ii ] ) )
3562 query <<
"get_editID" << edata->
editGUID;
3565 int idEdit = db.value( 0 ).toString().toInt();
3568 QString pfdir = files[ 0 ].left( files[ 0 ].lastIndexOf(
"/" ) );
3577 qDebug() <<
"*ERROR* saveFileDocuments, status" << st;
3586 for (
int ii = 0; ii <
nthread; ii++ )
3589 DbgLv(1) <<
"THR PROGR thr icomp" << thr << icomp <<
"kcomp" << kcomp;
3596 DbgLv(1) <<
"THR COMPL thr" << thr <<
"thrdone" <<
thrdone;
3606 for (
int kk = 0; kk <
nthread; kk++ )
3607 conc +=
tsimdats[ kk ].value( ii, jj );
3625 QFile mdt_f( mdtFile );
3626 if ( ! mdt_f.open( QIODevice::WriteOnly | QIODevice::Text ) )
3630 for (
int ii = 0; ii < ncomp; ii++ )
3637 QTextStream ts( &mdt_f );
3638 const QString dquote(
"\"" );
3639 const QString comma(
"," );
3640 const QString endln(
"\n" );
3643 ts << dquote +
"Molec.Weight" + dquote + comma
3644 + dquote +
"S_Apparent" + dquote + comma
3645 + dquote +
"S_20_W" + dquote + comma
3646 + dquote +
"D_Apparent" + dquote + comma
3647 + dquote +
"D_20_W" + dquote + comma
3648 + dquote +
"f/f0" + dquote + comma
3649 + dquote +
"Vbar20" + dquote + comma
3650 + dquote +
"Concentration" + dquote + comma
3651 + dquote +
"Conc.Percent" + dquote + endln;
3653 for (
int ii = 0; ii < ncomp; ii++ )
3656 double perc = 100.0 * conc / sum_c;
3657 ts << dquote + QString().sprintf(
"%10.4e",
3659 dquote + QString().sprintf(
"%10.4e",
3660 model .components[ ii ].s ) + dquote + comma +
3661 dquote + QString().sprintf(
"%10.4e",
3663 dquote + QString().sprintf(
"%10.4e",
3664 model .components[ ii ].D ) + dquote + comma +
3665 dquote + QString().sprintf(
"%10.4e",
3667 dquote + QString().sprintf(
"%10.4e",
3669 dquote + QString().sprintf(
"%10.4e",
3671 dquote + QString().sprintf(
"%10.4e",
3672 conc ) + dquote + comma +
3673 dquote + QString().sprintf(
"%5.2f %%",
3674 perc ) + dquote + endln;
3682 ts << dquote +
"Reaction" + dquote + comma
3683 + dquote +
"K_dissociation" + dquote + comma
3684 + dquote +
"k_off_Rate" + dquote + endln;
3686 for (
int ii = 0; ii < nreac; ii++ )
3690 ts << dquote + QString().sprintf(
"%4d", ii ) + dquote + comma
3691 + dquote + QString().sprintf(
"%10.4e", k_d ) + dquote + comma
3692 + dquote + QString().sprintf(
"%10.4e", k_off ) + dquote + endln;
3701 if ( fname.contains(
".svg" ) )
3702 flist << QString( fname ).section(
".", 0, -2 ) +
".png";
3730 int mc_iter = (int)
ct_model->value() + 1;
3750 else if (
rb_mean ->isChecked() )
3758 else if (
rb_mode ->isChecked() )