3 #include <QApplication>
19 int main(
int argc,
char* argv[] )
21 QApplication application( argc, argv );
29 return application.exec();
35 return ( solu1.
s < solu2.
s ) ||
36 ( ( solu1.
s == solu2.
s ) && ( solu1.
k < solu2.
k ) );
46 setWindowTitle( tr(
"Genetic Algorithm Initialization Control Window" ) );
50 QHBoxLayout*
main =
new QHBoxLayout(
this );
51 QVBoxLayout* left =
new QVBoxLayout();
52 QVBoxLayout* rght =
new QVBoxLayout();
53 QGridLayout* spec =
new QGridLayout();
54 main->setSpacing ( 2 );
55 main->setContentsMargins( 2, 2, 2, 2 );
56 left->setSpacing ( 0 );
57 left->setContentsMargins( 0, 1, 0, 1 );
58 spec->setSpacing ( 1 );
59 spec->setContentsMargins( 0, 0, 0, 0 );
60 rght->setSpacing ( 0 );
61 rght->setContentsMargins( 0, 1, 0, 1 );
72 lb_nisols->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
77 connect(
ct_nisols, SIGNAL( valueChanged(
double ) ),
81 lb_wxbuck->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
85 connect(
ct_wxbuck, SIGNAL( valueChanged(
double ) ),
89 lb_hybuck->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
93 connect(
ct_hybuck, SIGNAL( valueChanged(
double ) ),
99 lb_resolu->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
103 connect(
ct_resolu, SIGNAL( valueChanged(
double ) ),
107 lb_xreso->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
111 connect(
ct_xreso, SIGNAL( valueChanged(
double ) ),
115 lb_yreso->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
119 connect(
ct_yreso, SIGNAL( valueChanged(
double ) ),
123 lb_zfloor->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
127 connect(
ct_zfloor, SIGNAL( valueChanged(
double ) ),
131 lb_autlim->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
138 lb_plxmin->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
142 connect(
ct_plxmin, SIGNAL( valueChanged(
double ) ),
148 connect(
ct_plxmax, SIGNAL( valueChanged(
double ) ),
152 lb_plymin->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
156 connect(
ct_plymin, SIGNAL( valueChanged(
double ) ),
160 lb_plymax->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
165 connect(
ct_plymax, SIGNAL( valueChanged(
double ) ),
170 connect(
lw_sbin_data, SIGNAL( clicked(
const QModelIndex& ) ),
172 connect(
lw_sbin_data, SIGNAL( doubleClicked(
const QModelIndex& ) ),
174 connect(
lw_sbin_data, SIGNAL( currentRowChanged(
int ) ),
180 QLabel* lb_x_axis =
us_label( tr(
"Plot X:" ) );
181 QLabel* lb_y_axis =
us_label( tr(
"Plot Y:" ) );
208 rb_x_s ->setChecked(
true );
209 rb_y_s ->setEnabled(
false );
212 rb_x_s ->setToolTip( tr(
"Set X axis to Sedimentation Coefficient" ) );
213 rb_x_ff0 ->setToolTip( tr(
"Set X axis to Frictional Ratio" ) );
214 rb_x_mw ->setToolTip( tr(
"Set X axis to Molecular Weight" ) );
215 rb_x_vbar->setToolTip( tr(
"Set X axis to Partial Specific Volume" ) );
216 rb_x_D ->setToolTip( tr(
"Set X axis to Diffusion Coefficient" ) );
217 rb_x_f ->setToolTip( tr(
"Set X axis to Frictional Coefficient" ) );
218 rb_y_s ->setToolTip( tr(
"Set Y axis to Sedimentation Coefficient" ) );
219 rb_y_ff0 ->setToolTip( tr(
"Set Y axis to Frictional Ratio" ) );
220 rb_y_mw ->setToolTip( tr(
"Set Y axis to Molecular Weight" ) );
221 rb_y_vbar->setToolTip( tr(
"Set Y axis to Partial Specific Volume" ) );
222 rb_y_D ->setToolTip( tr(
"Set Y axis to Diffusion Coefficient" ) );
223 rb_y_f ->setToolTip( tr(
"Set Y axis to Frictional Coefficient" ) );
224 connect(
bg_x_axis, SIGNAL( buttonReleased(
int ) ),
226 connect(
bg_y_axis, SIGNAL( buttonReleased(
int ) ),
290 connect(
pb_reset, SIGNAL( clicked() ),
291 this, SLOT(
reset() ) );
295 connect(
pb_view, SIGNAL( clicked() ),
296 this, SLOT(
view() ) );
300 connect(
pb_save, SIGNAL( clicked() ),
301 this, SLOT(
save() ) );
305 connect(
pb_help, SIGNAL( clicked() ),
306 this, SLOT(
help() ) );
310 connect(
pb_close, SIGNAL( clicked() ),
311 this, SLOT( close() ) );
314 te_status->setTextBackgroundColor( Qt::white );
317 stcmline = tr(
"Color Map: the default w-cyan-magenta-red-black" );
318 stdiline = tr(
"The distribution was loaded from the file:" );
320 stfxline = tr(
"Components fixed attribute is \"vbar\"." );
321 stnpline = tr(
"The number of distribution points is 0." );
326 spec->addWidget(
lb_info1, s_row++, 0, 1, 8 );
327 spec->addWidget(
lb_nisols, s_row, 0, 1, 4 );
328 spec->addWidget(
ct_nisols, s_row++, 4, 1, 4 );
329 spec->addWidget(
lb_wxbuck, s_row, 0, 1, 4 );
330 spec->addWidget(
ct_wxbuck, s_row++, 4, 1, 4 );
331 spec->addWidget(
lb_hybuck, s_row, 0, 1, 4 );
332 spec->addWidget(
ct_hybuck, s_row++, 4, 1, 4 );
333 spec->addWidget(
lb_info2, s_row++, 0, 1, 8 );
334 spec->addWidget(
lb_resolu, s_row, 0, 1, 4 );
335 spec->addWidget(
ct_resolu, s_row++, 4, 1, 4 );
336 spec->addWidget(
lb_xreso, s_row, 0, 1, 4 );
337 spec->addWidget(
ct_xreso, s_row++, 4, 1, 4 );
338 spec->addWidget(
lb_yreso, s_row, 0, 1, 4 );
339 spec->addWidget(
ct_yreso, s_row++, 4, 1, 4 );
340 spec->addWidget(
lb_zfloor, s_row, 0, 1, 4 );
341 spec->addWidget(
ct_zfloor, s_row++, 4, 1, 4 );
342 spec->addWidget(
lb_autlim, s_row, 0, 1, 4 );
343 spec->addWidget(
ck_autlim, s_row++, 4, 1, 4 );
344 spec->addWidget(
lb_plxmin, s_row, 0, 1, 4 );
345 spec->addWidget(
ct_plxmin, s_row++, 4, 1, 4 );
346 spec->addWidget(
lb_plxmax, s_row, 0, 1, 4 );
347 spec->addWidget(
ct_plxmax, s_row++, 4, 1, 4 );
348 spec->addWidget(
lb_plymin, s_row, 0, 1, 4 );
349 spec->addWidget(
ct_plymin, s_row++, 4, 1, 4 );
350 spec->addWidget(
lb_plymax, s_row, 0, 1, 4 );
351 spec->addWidget(
ct_plymax, s_row++, 4, 1, 4 );
353 spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
354 spec->addLayout( gl_x_s, s_row, 2, 1, 1 );
355 spec->addLayout( gl_x_ff0, s_row, 3, 1, 1 );
356 spec->addLayout( gl_x_mw, s_row, 4, 1, 1 );
357 spec->addLayout( gl_x_vbar, s_row, 5, 1, 1 );
358 spec->addLayout( gl_x_D, s_row, 6, 1, 1 );
359 spec->addLayout( gl_x_f, s_row++, 7, 1, 1 );
360 spec->addWidget( lb_y_axis, s_row, 0, 1, 2 );
361 spec->addLayout( gl_y_s, s_row, 2, 1, 1 );
362 spec->addLayout( gl_y_ff0, s_row, 3, 1, 1 );
363 spec->addLayout( gl_y_mw, s_row, 4, 1, 1 );
364 spec->addLayout( gl_y_vbar, s_row, 5, 1, 1 );
365 spec->addLayout( gl_y_D, s_row, 6, 1, 1 );
366 spec->addLayout( gl_y_f, s_row++, 7, 1, 1 );
368 spec->addWidget(
pb_prefilt, s_row, 0, 1, 4 );
369 spec->addWidget(
le_prefilt, s_row++, 4, 1, 4 );
370 spec->addWidget(
pb_lddistr, s_row, 0, 1, 4 );
371 spec->addWidget(
ck_1dplot, s_row++, 4, 1, 4 );
372 spec->addWidget(
pb_ldcolor, s_row, 0, 1, 4 );
373 spec->addWidget(
ck_2dplot, s_row++, 4, 1, 4 );
374 spec->addWidget(
pb_refresh, s_row, 0, 1, 4 );
375 spec->addWidget(
ck_3dplot, s_row++, 4, 1, 4 );
376 spec->addWidget(
pb_mandrsb, s_row, 0, 1, 4 );
377 spec->addWidget(
pb_ckovrlp, s_row++, 4, 1, 4 );
378 spec->addWidget(
pb_autassb, s_row, 0, 1, 4 );
379 spec->addWidget(
pb_resetsb, s_row++, 4, 1, 4 );
380 spec->addWidget(
pb_reset, s_row, 0, 1, 4 );
381 spec->addWidget(
pb_save, s_row++, 4, 1, 4 );
382 spec->addWidget(
pb_view, s_row, 0, 1, 4 );
383 spec->addWidget(
pb_help, s_row, 4, 1, 2 );
384 spec->addWidget(
pb_close, s_row++, 6, 1, 2 );
385 spec->addWidget(
te_status, s_row++, 0, 6, 8 );
388 xa_title = tr(
"Sedimentation Coefficient corrected for water at 20" )
390 ya_title = tr(
"Frictional Ratio f/f0" );
394 rght->addLayout( plot );
395 QBoxLayout* txed =
new QHBoxLayout;
398 "Please load a sedimentation coefficient or molecular weight"
399 " distribution to initialize the genetic algorithm s-value or mw-value"
400 " range. The distribution should have a good resolution over the"
401 " sedimentation or weight coefficients. This distribution will be "
402 " used to initialize all experiments used in the run, so the"
403 " distribution taken from the experiment with the highest speed is"
404 " probably the most appropriate distribution. You can use a distribution"
405 " from the van Holde - Weischet method, the C(s) method, or 2-D Spectrum"
406 " Analysis. You may also load a Monte Carlo distribution." ) );
409 rght->addLayout( txed );
410 rght->setStretchFactor( plot, 4 );
411 rght->setStretchFactor( txed, 1 );
416 data_plot->enableAxis( QwtPlot::xBottom,
true );
417 data_plot->enableAxis( QwtPlot::yLeft,
true );
418 data_plot->enableAxis( QwtPlot::yRight,
true );
419 data_plot->setAxisScale( QwtPlot::xBottom, 1.0, 40.0 );
420 data_plot->setAxisScale( QwtPlot::yLeft, 1.0, 4.0 );
422 data_plot->setCanvasBackground( Qt::darkBlue );
425 left->addLayout( spec );
427 main->addLayout( left );
428 main->addLayout( rght );
429 main->setStretchFactor( left, 3 );
430 main->setStretchFactor( spec, 3 );
431 main->setStretchFactor( rght, 5 );
483 ct_xreso->setRange( 10.0, 1000.0, 1.0 );
506 ct_plxmin->setRange( -10.0, 10000.0, 0.01 );
509 ct_plxmax->setRange( 0.0, 10000.0, 0.01 );
514 colormap =
new QwtLinearColorMap( Qt::white, Qt::black );
515 colormap->addColorStop( 0.10, Qt::cyan );
516 colormap->addColorStop( 0.50, Qt::magenta );
517 colormap->addColorStop( 0.80, Qt::red );
518 cmapname = tr(
"Default Color Map: w-cyan-magenta-red-black" );
537 DbgLv(1) <<
"SAVE novlps" << novlps;
541 QString msg = ( novlps == 1 ) ?
542 tr(
"There is one case of overlap between bins.\n" ) :
543 tr(
"%1 pairs of bins overlap one another.\n" ).arg( novlps );
544 QMessageBox::warning(
this,
545 tr(
"Bin Overlaps" ),
546 msg + tr(
"You must correct this condition so that\n"
547 "no bins overlap, before you can save GA data." ) );
553 QMessageBox::information(
this,
554 tr(
"No Files Output" ),
555 tr(
"No files will be saved, since neither X,Y nor fixed attribute"
557 "To output a gadistro file, insure that one of X,Y,fixed"
562 QString runid =
run_name.section(
".", 0, -2 );
563 if ( runid.startsWith(
"Global-" ) )
564 runid = runid.mid( 7 );
565 QString trpid =
run_name.section(
".", -1, -1 );
567 QString fndat =
"gainit." + trpid +
".gadistro.dat";
568 QString fnsta =
"gainit." + trpid +
".sol_integ.stats";
569 QString fname = fdir +
"/" + fndat;
571 QString fnst2 =
method +
"." + trpid +
".statistics.rpt";
572 QString fnam2 = fdir2 +
"/" + fnst2;
576 if ( ! dirp.exists( fdir ) )
579 if ( ! dirp.exists( fdir2 ) )
580 dirp.mkpath( fdir2 );
593 QString msg = tr(
"Saved:\n " ) + fndat +
"\n";
598 DbgLv(1) <<
"SAVE call buildMC";
601 fname = fdir +
"/" + fnsta;
603 DbgLv(1) <<
"SAVE call reportMC";
608 QFile( fnam2 ).remove();
609 QFile( fname ).copy( fnam2 );
612 msg +=
" " + fnsta +
"\n";
613 msg += tr(
"in directory:\n " ) + fdir + tr(
"\n\nand\n" );
614 msg +=
" " + fnst2 +
"\n";
615 msg += tr(
"in directory:\n " ) + fdir2;
627 int idEdit = db.value( 0 ).toString().toInt();
629 freport.
runID = runid;
635 msg += tr(
"\n\nThe report file was also saved to the database" );
637 msg += tr(
"\n\n*ERROR* attempting save of report to database." );
643 DbgLv(1) <<
"SAVE fnst2" << fnst2;
644 msg += tr(
"in directory:\n " ) + fdir;
647 QMessageBox::information(
this, tr(
"Distro/Stats File Save" ), msg );
653 QColor cblack( Qt::black );
654 QColor cwhite( Qt::white );
661 QColor bg =
data_plot->canvasBackground();
662 int csum = bg.red() + bg.green() + bg.blue();
663 pickpen =
new QPen( ( csum > 600 ) ? cblack : cwhite );
667 pick->setRubberBand( QwtPicker::RectRubberBand );
668 pick->setSelectionFlags( QwtPicker::RectSelection
669 | QwtPicker::DragSelection );
672 connect(
pick, SIGNAL( mouseDown(
const QwtDoublePoint& ) ),
674 connect(
pick, SIGNAL( mouseUp(
const QwtDoublePoint& ) ),
675 this, SLOT(
getMouseUp(
const QwtDoublePoint& ) ) );
683 int rpwr = qRound( log10(
wxbuck ) );
684 double rmax = pow( 10.0, rpwr + 3 );
685 double rinc = pow( 10.0, rpwr - 3 );
689 rpwr = qRound( log10(
hybuck ) );
690 rmax = pow( 10.0, rpwr + 3 );
691 rinc = pow( 10.0, rpwr - 3 );
694 connect(
ct_wxbuck, SIGNAL( valueChanged(
double ) ),
696 connect(
ct_hybuck, SIGNAL( valueChanged(
double ) ),
709 QMessageBox::information(
this,
710 tr(
"No Bins Overlap" ),
711 tr(
"No bin overlaps were found, so you"
712 " may proceed to saving this GA data"
713 " or viewing statistics."
714 "\n\n*NOTE*: Bins will now be re-sorted." ) );
723 QString msg = ( novlps == 1 ) ?
724 tr(
"There is one case of overlap between bins.\n" ) :
725 tr(
"%1 pairs of bins overlap one another.\n" ).arg( novlps );
726 QMessageBox::warning(
this,
727 tr(
"Bin Overlaps" ),
728 msg + tr(
"You must correct this condition so that no\n"
729 "bins overlap, before you can save GA data." ) );
751 for (
int jj = 0; jj <
nibuks; jj++ )
821 data_plot->setCanvasBackground( Qt::black );
822 pick->setTrackerPen( QColor( Qt::white ) );
825 QVector< double > xvec( dsize );
826 QVector< double > yvec( dsize );
827 double* x = xvec.data();
828 double* y = yvec.data();
829 double sval =
sdistro->at( 0 ).s;
832 double cval =
sdistro->at( 0 ).c;
839 for (
int jj = 1; jj < dsize; jj++ )
849 x[ nn - 1 ] = ( svpr + sval ) * 0.5;
859 smin = ( smin < sval ) ? smin : sval;
860 smax = ( smax > sval ) ? smax : sval;
861 cmin = ( cmin < cval ) ? cmin : cval;
862 cmax = ( cmax > cval ) ? cmax : cval;
873 double rdif = ( smax - smin ) / 20.0;
876 rdif = ( cmax - cmin ) / 20.0;
879 smin = ( smin > 0.0 ) ? smin : 0.0;
880 cmin = ( cmin > 0.0 ) ? cmin : 0.0;
883 data_grid->enableYMin(
true );
884 data_grid->enableY(
true );
890 data_curv->setData( x, y, nn );
891 data_curv->setPen( QPen( Qt::yellow, 3, Qt::SolidLine ) );
892 data_curv->setStyle( QwtPlotCurve::Sticks );
894 data_plot->setAxisAutoScale( QwtPlot::xBottom );
895 data_plot->setAxisAutoScale( QwtPlot::yLeft );
896 data_plot->enableAxis( QwtPlot::yRight,
false );
898 data_plot->setAxisTitle( QwtPlot::yLeft, tr(
"Partial Concentration" ) );
899 data_plot->setAxisScale( QwtPlot::xBottom, smin, smax );
900 data_plot->setAxisScale( QwtPlot::yLeft, cmin, cmax );
914 data_plot->setCanvasBackground( Qt::black );
915 pick->setTrackerPen( QColor( Qt::white ) );
918 double* x =
new double[ dsize ];
919 double* y =
new double[ dsize ];
920 double smin = 1.0e30;
921 double smax = -1.0e30;
922 double kmin = 1.0e30;
923 double kmax = -1.0e30;
925 for (
int jj = 0; jj < dsize; jj++ )
927 double sval =
sdistro->at( jj ).s;
928 double kval =
sdistro->at( jj ).k;
931 smin = qMin( smin, sval );
932 smax = qMax( smax, sval );
933 kmin = qMin( kmin, kval );
934 kmax = qMax( kmax, kval );
945 double rdif = ( smax - smin ) / 20.0;
948 rdif = ( kmax - kmin ) / 20.0;
951 smin = ( smin > 0.0 ) ? smin : 0.0;
952 kmin = ( kmin > 0.0 ) ? kmin : 0.0;
955 data_grid->enableYMin(
true );
956 data_grid->enableY(
true );
964 symbol.setStyle( QwtSymbol::Ellipse );
965 symbol.setPen( QPen( Qt::red ) );
966 symbol.setBrush( QBrush( Qt::yellow ) );
967 if ( dsize < 100 && dsize > 50 )
969 else if ( dsize < 50 && dsize > 20 )
970 symbol.setSize( 10 );
971 else if ( dsize < 21 )
972 symbol.setSize( 12 );
973 else if ( dsize > 100 )
976 data_curv->setStyle( QwtPlotCurve::NoCurve );
977 data_curv->setSymbol( symbol );
978 data_curv->setData( x, y, dsize );
982 data_plot->setAxisAutoScale( QwtPlot::xBottom );
983 data_plot->setAxisAutoScale( QwtPlot::yLeft );
984 data_plot->enableAxis( QwtPlot::yRight,
false );
987 data_plot->setAxisTitle( QwtPlot::yRight, tr(
"Partial Concentration" ) );
988 data_plot->axisTitle( QwtPlot::yRight ).setFont(
989 data_plot->axisTitle( QwtPlot::yLeft ).font() );
990 data_plot->setAxisScale( QwtPlot::xBottom, smin, smax );
991 data_plot->setAxisScale( QwtPlot::yLeft, kmin, kmax );
1007 int csum = bg.red() + bg.green() + bg.blue();
1008 pick->setTrackerPen( QPen( ( csum > 600 ) ? QColor( Qt::black ) :
1009 QColor( Qt::white ) ) );
1021 QwtDoubleRect drect;
1024 drect = QwtDoubleRect( 0.0, 0.0, 0.0, 0.0 );
1027 double zmin =
sdistro->at( 0 ).c;
1032 for (
int jj = 0; jj <
sdistro->size(); jj++ )
1034 zmin = qMin( zmin,
sdistro->at( jj ).c );
1035 zmax = qMax( zmax,
sdistro->at( jj ).c );
1047 QwtScaleWidget *rightAxis =
data_plot->axisWidget( QwtPlot::yRight );
1048 rightAxis->setColorBarEnabled(
true );
1052 data_plot->setAxisTitle( QwtPlot::yRight, tr(
"Partial Concentration" ) );
1053 data_plot->axisTitle( QwtPlot::yRight ).setFont(
1054 data_plot->axisTitle( QwtPlot::yLeft ).font() );
1055 data_plot->setAxisScale( QwtPlot::yRight,
1056 spec_dat.
range().minValue(), spec_dat.
range().maxValue() );
1057 data_plot->enableAxis( QwtPlot::yRight );
1061 data_plot->setAxisAutoScale( QwtPlot::yLeft );
1062 data_plot->setAxisAutoScale( QwtPlot::xBottom );
1131 double rinc = pow( 10.0, qRound( log10( dval ) ) - 2.0 );
1151 double rinc = pow( 10.0, qRound( log10( dval ) ) - 2.0 );
1173 double rmax =
wxbuck * 10.0;
1174 double rinc = pow( 10.0, (
double)( (
int)( log10( rmax ) - 3.0 ) ) );
1179 connect(
ct_wxbuck, SIGNAL( valueChanged(
double ) ),
1196 connect(
ck_2dplot, SIGNAL( clicked() ),
1198 connect(
ck_3dplot, SIGNAL( clicked() ),
1221 connect(
ck_1dplot, SIGNAL( clicked() ),
1223 connect(
ck_3dplot, SIGNAL( clicked() ),
1246 connect(
ck_1dplot, SIGNAL( clicked() ),
1248 connect(
ck_2dplot, SIGNAL( clicked() ),
1250 connect(
ck_3dplot, SIGNAL( clicked() ),
1267 double smin = 1e+39;
1268 double smax = 1e-39;
1269 double kmin = 1e+39;
1270 double kmax = 1e-39;
1271 double wmin = 1e+39;
1272 double wmax = 1e-39;
1273 double vmin = 1e+39;
1274 double vmax = 1e-39;
1275 double dmin = 1e+39;
1276 double dmax = 1e-39;
1277 double fmin = 1e+39;
1278 double fmax = 1e-39;
1280 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
1282 dialog.move( this->pos() + QPoint( 200, 200 ) );
1284 connect( &dialog, SIGNAL( changed(
bool ) ),
1286 QApplication::restoreOverrideCursor();
1292 if ( dialog.exec() != QDialog::Accepted )
1296 DbgLv(1) <<
"LOAD ACCEPT Description:\n " << mdesc;
1297 sep = mdesc.left( 1 );
1298 mfnam = mdesc.section( sep, 2, 2 );
1299 aiters = mdesc.section( sep, 6, 6 );
1301 if ( mfnam.isEmpty() )
1303 mfnam =
"db ID " + mdesc.section( sep, 4, 4 );
1308 mfnam = QFileInfo( mfnam ).baseName();
1313 DbgLv(0) <<
" NO Model components";
1320 DbgLv(0) <<
"*** Unable to recalculate coefficient values ***";
1324 mdesc = mdesc.section( sep, 1, 1 );
1326 method = mdesc.contains(
"-CG" )
1328 run_name = mdesc.section(
".", 0, -3 );
1329 QString asys = mdesc.section(
".", -2, -2 );
1331 + asys.section(
"_", 3, 4 );
1335 int jj = mdesc.indexOf(
".model" );
1336 mdesc = ( jj < 1 ) ? mdesc : mdesc.left( jj );
1357 for (
int jj = 0; jj < model.
components.size(); jj++ )
1363 sol_sk.
c = model.
components[ jj ].signal_concentration;
1382 sol_xy.
si = sol_sk.
s;
1383 sol_xy.
ki = sol_sk.
k;
1385 smin = qMin( smin, sol_sk.
s );
1386 smax = qMax( smax, sol_sk.
s );
1387 kmin = qMin( kmin, sol_sk.
k );
1388 kmax = qMax( kmax, sol_sk.
k );
1389 wmin = qMin( wmin, sol_sk.
w );
1390 wmax = qMax( wmax, sol_sk.
w );
1391 vmin = qMin( vmin, sol_sk.
v );
1392 vmax = qMax( vmax, sol_sk.
v );
1393 dmin = qMin( dmin, sol_sk.
d );
1394 dmax = qMax( dmax, sol_sk.
d );
1395 fmin = qMin( fmin, sol_sk.
f );
1396 fmax = qMax( fmax, sol_sk.
f );
1411 for (
int jj=0;jj<
sk_distro.size();jj++ ) {
1447 attrs <<
"s" <<
"f/f0" <<
"MW" <<
"vbar" <<
"D" <<
"f";
1448 QString s_attr = attrs[
attr_z ];
1472 s_attr =
"\"" + s_attr +
"\".";
1473 dfilname =
"(" + mfnam +
") " + mdesc;
1475 stfxline = tr(
"The components fixed attribute is " ) + s_attr;
1476 stnpline = tr(
"The number of distribution points is %1" )
1503 QString filter = tr(
"Color Map files (*cm-*.xml);;" )
1504 + tr(
"Any XML files (*.xml);;" )
1505 + tr(
"Any files (*)" );
1508 QString fname = QFileDialog::getOpenFileName(
this,
1509 tr(
"Load Color Map File" ),
1512 if ( fname.isEmpty() )
1516 QList< QColor > cmcolor;
1517 QList< double > cmvalue;
1520 colormap =
new QwtLinearColorMap( cmcolor.first(), cmcolor.last() );
1522 for (
int jj = 1; jj < cmvalue.size() - 1; jj++ )
1524 colormap->addColorStop( cmvalue.at( jj ), cmcolor.at( jj ) );
1526 QFileInfo fi( fname );
1527 cmapname = tr(
"Color Map: " ) + fi.baseName();
1539 double smin = 1.0e30;
1540 double smax = -1.0e30;
1541 double kmin = 1.0e30;
1542 double kmax = -1.0e30;
1555 for (
int jj = 0; jj <
sdistro->size(); jj++ )
1557 double sval =
sdistro->at( jj ).s;
1558 double kval =
sdistro->at( jj ).k;
1559 smin = qMin( smin, sval );
1560 smax = qMax( smax, sval );
1561 kmin = qMin( kmin, kval );
1562 kmax = qMax( kmax, kval );
1564 DbgLv(1) <<
"SL: distr skmin,max" << smin << smax << kmin << kmax;
1567 sinc = ( smax - smin ) / 10.0;
1568 kinc = ( kmax - kmin ) / 10.0;
1569 DbgLv(1) <<
"SL: adj sinc kinc" << sinc << kinc;
1570 sinc = ( sinc == 0.0 ||
sdistro->size() == 1 ) ? ( smin * 0.05 ) : sinc;
1571 kinc = ( kinc == 0.0 ||
sdistro->size() == 1 ) ? ( kmin * 0.05 ) : kinc;
1572 DbgLv(1) <<
"SL: adj sinc kinc" << sinc << kinc;
1578 DbgLv(1) <<
"SL: adj smin,max" << smin << smax
1579 <<
"kmin,max" << kmin << kmax;
1583 sinc = pow( 10.0, qFloor( log10( smax ) ) - 3.0 );
1584 kinc = pow( 10.0, qFloor( log10( kmax ) ) - 3.0 );
1585 DbgLv(1) <<
"SL: aut min,inc" << smax << sinc << kmax << kinc;
1598 smin = qFloor( smin / sinc ) * sinc;
1599 smax = qFloor( smax / sinc ) * sinc + sinc;
1600 smin = (
attr_x !=
ATTR_S ) ? qMax( smin, 0.0 ) : smin;
1601 smin = (
attr_x ==
ATTR_K ) ? qMax( smin, 0.8 ) : smin;
1602 kmin = qFloor( kmin / kinc ) * kinc;
1603 kmax = qFloor( kmax / kinc ) * kinc + kinc;
1604 kmin = (
attr_y !=
ATTR_S ) ? qMax( kmin, 0.0 ) : kmin;
1605 kmin = (
attr_y ==
ATTR_K ) ? qMax( kmin, 0.8 ) : kmin;
1606 DbgLv(1) <<
"SL: auto smin,max,inc" << smin << smax << sinc
1607 <<
"kmin,max,inc" << kmin << kmax << kinc;
1632 int spwr = qRound( log10(
wxbuck ) );
1633 int kpwr = qRound( log10(
hybuck ) );
1634 smax = pow( 10.0, spwr + 3 );
1635 kmax = pow( 10.0, kpwr + 3 );
1636 sinc = pow( 10.0, spwr - 3 );
1637 kinc = pow( 10.0, kpwr - 3 );
1644 connect(
ct_wxbuck, SIGNAL( valueChanged(
double ) ),
1646 connect(
ct_hybuck, SIGNAL( valueChanged(
double ) ),
1651 "Now either auto-assign the solute bins, or manually select bins"
1652 " by clicking on a bin vertex, then moving and releasing on the"
1653 " other vertex. If you auto-assign the bins you should first"
1654 " select the number of solute bins you want to use. UltraScan will"
1655 " space the bins proportional to the integral value of each peak,"
1656 " such that each bin contains the same integral value."
1657 " You can select each solute bin from the listbox on the left and"
1658 " modify its size by first changing the bucket dimensions with the"
1659 " respective counters, then double-click on the listbox item."
1660 " You may remove a bin by right-mouse-button clicking on the listbox"
1661 " item and responding/defaulting Yes in the resulting dialog." );
1665 "\n\nNO SAVE ENABLED: None of X or Y or the fixed-attribute is VBAR." );
1669 "\n\nNO AUTOASSIGN ENABLED: Distribution is from a Monte-Carlo." );
1678 stnpline = tr(
"The number of distribution points is %1." )
1688 int sizi = listsols.size();
1703 QList< S_Solute > reduced;
1704 sol1 = listsols.at( 0 );
1705 reduced.append( sol1 );
1709 for (
int jj = 1; jj < sizi; jj++ )
1711 sol2 = listsols.at( jj );
1713 if ( sol1.
s != sol2.
s || sol1.
k != sol2.
k )
1715 reduced.append( sol2 );
1721 DbgLv(1) <<
"DUP: sval svpr jj" << sol1.
s << sol2.
s << jj;
1722 kdup =
max( kdup, ++jdup );
1723 qreal f = (qreal)( jdup + 1 );
1725 sol2.
s = ( sol1.
s * jdup + sol2.
s ) / f;
1726 sol2.
k = ( sol1.
k * jdup + sol2.
k ) / f;
1727 reduced.replace( reduced.size() - 1, sol2 );
1733 if ( reduced.size() < sizi )
1749 QPen penCR( QColor( Qt::red ), 1, Qt::SolidLine );
1750 QPen penCY( QColor( Qt::yellow), 1, Qt::SolidLine );
1751 QPen penCB( QColor( Qt::blue), 1, Qt::SolidLine );
1757 QColor bg =
data_plot->canvasBackground();
1758 int csum = bg.red() + bg.green() + bg.blue();
1759 pbukpen = ( csum > 600 ) ? penCB : penCY;
1818 if ( tx[0] > tx[1] )
1824 if ( ty[0] > ty[1] )
1831 QRectF bucr( QPointF( tx[0], ty[1] ), QPointF( tx[1], ty[0] ) );
1832 QPointF tpt( ( tx[0] + tx[1] ) / 2.0, ( ty[0] + ty[1] ) / 2.0 );
1833 QPointF& bucp = tpt;
1862 QPointF pt1, QPointF pt2 )
1882 bc1->setStyle( QwtPlotCurve::Lines );
1883 bc1->setData( tx, ty, 5 );
1915 QString msg = tr(
"Are you sure you want to delete solute bin %1 ?" )
1917 msgBox.setWindowTitle( tr(
"GA_Init Solute Bin Delete" ) );
1918 msgBox.setText( msg );
1919 msgBox.setStandardButtons( QMessageBox::No | QMessageBox::Yes );
1920 msgBox.setDefaultButton( QMessageBox::Yes );
1921 if ( msgBox.exec() == QMessageBox::Yes )
1925 connect(
lw_sbin_data, SIGNAL( clicked(
const QModelIndex& ) ),
1927 connect(
lw_sbin_data, SIGNAL( doubleClicked(
const QModelIndex& ) ),
1929 connect(
lw_sbin_data, SIGNAL( currentRowChanged(
int ) ),
1932 int rx = qMin( sx, (
nibuks - 1 ) );
1941 else if ( global && sx !=
sxset )
1965 QPointF ptl = rect.topLeft();
1966 QPointF pbr = rect.bottomRight();
1967 pt0 = QPointF( ( ptl.x() + pbr.x() ) / 2.0,
1968 ( ptl.y() + pbr.y() ) / 2.0 );
1971 qreal x1 = pt0.x() -
wxbuck / 2.0;
1972 qreal y1 = pt0.y() +
hybuck / 2.0;
1973 qreal x2 = pt0.x() +
wxbuck / 2.0;
1974 qreal y2 = pt0.y() -
hybuck / 2.0;
1975 QPointF pt1( x1, y1 );
1976 QPointF pt2( x2, y2 );
1977 QRectF brect( pt1, pt2 );
2014 QString ctext = QString(
"bucket border %1" ).arg( sx );
2015 QwtPlotItemList ilist =
data_plot->itemList();
2017 for (
int jj = 0; jj < ilist.size(); jj++ )
2019 QwtPlotCurve* bc1 = (QwtPlotCurve*)ilist.at( jj );
2021 if ( bc1->rtti() == QwtPlotItem::Rtti_PlotCurve )
2023 QString itext = bc1->title().text();
2025 if ( itext.compare( ctext ) == 0 )
2032 return (QwtPlotCurve*)NULL;
2039 for (
int jj = 0; jj <
nibuks; jj++ )
2067 e->type() == QEvent::ContextMenu )
2074 return US_Widgets::eventFilter( obj, e );
2097 DbgLv(1) <<
"rPAL:kibuks nibuks" << kibuks <<
nibuks;
2101 for (
int jj = 0; jj <
nibuks; jj++ )
2111 hlx = ( hlx >= 0 && hlx <
nibuks ) ? hlx : ( nibuks - 1 );
2112 DbgLv(1) <<
"rPAL: hlx" << hlx;
2120 qApp->processEvents();
2128 return ( qAbs( ( a - b ) / a ) <= eps );
2144 srdiag.move( this->pos() + QPoint( 200, 200 ) );
2145 connect( &srdiag, SIGNAL( dkdb_changed (
bool ) ),
2148 if ( srdiag.exec() == QDialog::Accepted )
2154 pfmsg = tr(
"(none chosen)" );
2156 else if ( nruns > 1 )
2157 pfmsg = tr(
"RunID prefilter - %1 run(s)" ).arg( nruns );
2160 pfmsg = tr(
"RunID prefilter - 1 run: " ) +
2161 QString(
pfilts[ 0 ] ).left( 8 ) +
"...";
2163 DbgLv(1) <<
"PreFilt: pfilts[0]" << ((nruns>0)?
pfilts[0]:
"(none)");
2171 QString runid =
run_name.section(
".", 0, -2 );
2172 if ( runid.startsWith(
"Global-" ) )
2173 runid = runid.mid( 7 );
2174 QString trpid =
run_name.section(
".", -1, -1 );
2176 QString fnsta =
"gainit." + trpid +
".sol_integ.stats";
2177 QString fname = fdir +
"/" + fnsta;
2178 DbgLv(1) <<
"VIEW fname" << fname;
2187 QFile filei( fname );
2188 if ( filei.open( QIODevice::ReadOnly | QIODevice::Text ) )
2190 DbgLv(1) <<
"VIEW OPENED";
2191 QTextStream ts( &filei );
2192 QString rtext = ts.readAll();
2196 eddiag->setWindowTitle( tr(
"Statistics File Contents" ) );
2197 eddiag->move( this->pos() + QPoint( 30, 30 ) );
2198 eddiag->resize( 760, 700 );
2200 eddiag->
e->setPlainText( rtext );
2201 DbgLv(1) <<
"VIEW eddiag SHOW";
2207 DbgLv(1) <<
"VIEW OPEN ERROR" << fname;
2208 QMessageBox::critical(
this, tr(
"File Read Error" ),
2209 tr(
"Unable to open file\n\"%1\"\nfor read" ).arg( fname ) );
2216 const QString xlabs[] = {
"s",
"f/f0",
"MW",
"vbar",
"D",
"f" };
2217 const double xvlos[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
2218 const double xvhis[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7 };
2219 const double xmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
2220 const double xmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
2221 const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
2225 QString xlab = xlabs[
attr_x ];
2226 double xmin = xmins[
attr_x ];
2227 double xmax = xmaxs[
attr_x ];
2228 double xinc = xincs[
attr_x ];
2229 lb_plxmin->setText( tr(
"Plot Limit " ) + xlab + tr(
" Minimum:" ) );
2230 lb_plxmax->setText( tr(
"Plot Limit " ) + xlab + tr(
" Maximum:" ) );
2231 lb_wxbuck->setText( tr(
"Width of " ) + xlab + tr(
" Bucket:" ) );
2232 ct_plxmin->setRange( xmin, xmax, xinc );
2233 ct_plxmax->setRange( xmin, xmax, xinc );
2254 const QString ylabs[] = {
"s",
"f/f0",
"MW",
"vbar",
"D",
"f" };
2255 const double yvlos[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
2256 const double yvhis[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7 };
2257 const double ymins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
2258 const double ymaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
2259 const double yincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
2263 QString ylab = ylabs[
attr_y ];
2264 double ymin = ymins[
attr_y ];
2265 double ymax = ymaxs[
attr_y ];
2266 double yinc = yincs[
attr_y ];
2267 lb_plymin->setText( tr(
"Plot Limit " ) + ylab + tr(
" Minimum:" ) );
2268 lb_plymax->setText( tr(
"Plot Limit " ) + ylab + tr(
" Maximum:" ) );
2269 lb_hybuck->setText( tr(
"Height of " ) + ylab + tr(
" Bucket:" ) );
2270 ct_plymin->setRange( ymin, ymax, yinc );
2271 ct_plymax->setRange( ymin, ymax, yinc );
2296 for (
int jj = 0; jj <
sk_distro.size(); jj++ )
2300 sol_xy.
si = sol_sk.
s;
2301 sol_xy.
ki = sol_sk.
k;
2328 a_title = tr(
"Sedimentation Coefficient (1e-13)"
2329 " for water at 20" ) +
DEGC;
2330 else if ( pltndx ==
ATTR_K )
2331 a_title = tr(
"Frictional Ratio f/f0" );
2332 else if ( pltndx ==
ATTR_W )
2333 a_title = tr(
"Molecular Weight (Dalton)" );
2334 else if ( pltndx ==
ATTR_V )
2335 a_title = tr(
"Vbar at 20" ) +
DEGC;
2336 else if ( pltndx ==
ATTR_D )
2337 a_title = tr(
"Diffusion Coefficient" );
2338 else if ( pltndx ==
ATTR_F )
2339 a_title = tr(
"Frictional Coefficient" );