3 #include <QApplication>
19 #include "qwt_legend.h"
22 int main(
int argc,
char* argv[] )
24 QApplication application( argc, argv );
32 return application.exec();
41 setWindowTitle( tr(
"Combined Discrete Distributions:" ) );
46 QBoxLayout* mainLayout =
new QHBoxLayout(
this );
47 QGridLayout* leftLayout =
new QGridLayout;
48 QVBoxLayout* rightLayout =
new QVBoxLayout;
49 mainLayout ->setSpacing ( 2 );
50 mainLayout ->setContentsMargins( 2, 2, 2, 2 );
51 leftLayout ->setSpacing ( 0 );
52 leftLayout ->setContentsMargins( 0, 1, 0, 1 );
53 rightLayout->setSpacing ( 0 );
54 rightLayout->setContentsMargins( 0, 1, 0, 1 );
58 QPushButton* pb_loadda =
us_pushbutton( tr(
"Select Run ID(s)" ) );
69 QLabel* lb_distrtype =
us_banner( tr(
"Select Distribution Type(s):" ) );
70 QLabel* lb_plottype =
us_banner( tr(
"Plot Type and Control:" ) );
71 QLabel* lb_runinfo =
us_banner( tr(
"Information for this Run:" ) );
72 QLabel* lb_runid =
us_label ( tr(
"Current Run ID:" ) );
73 QLabel* lb_svproj =
us_label ( tr(
"Save Plot under Project:" ) );
74 QLabel* lb_runids =
us_banner( tr(
"Run IDs:" ) );
75 QLabel* lb_models =
us_banner( tr(
"Distributions:" ) );
125 ck_ga ->setFont( cfont );
158 QButtonGroup* sel_plt =
new QButtonGroup(
this );
172 tr(
"Use model descriptions for list and legend" ),
176 QFontMetrics fmet( sfont );
177 int fwid = fmet.maxWidth();
184 int csizw = fwid * 5;
201 leftLayout->addLayout(
dkdb_cntrls, row++, 0, 1, 8 );
202 leftLayout->addWidget( pb_loadda, row, 0, 1, 4 );
203 leftLayout->addWidget(
pb_saveda, row++, 4, 1, 4 );
204 leftLayout->addWidget(
pb_resetd, row, 0, 1, 2 );
205 leftLayout->addWidget(
pb_resetp, row, 2, 1, 2 );
206 leftLayout->addWidget( pb_help, row, 4, 1, 2 );
207 leftLayout->addWidget( pb_close, row++, 6, 1, 2 );
208 leftLayout->addWidget( lb_distrtype, row++, 0, 1, 8 );
209 leftLayout->addLayout( lo_2dsa, row, 0, 1, 2 );
210 leftLayout->addLayout( lo_2dsafm, row, 2, 1, 2 );
211 leftLayout->addLayout( lo_2dsamc, row, 4, 1, 2 );
212 leftLayout->addLayout( lo_2dsacg, row++, 6, 1, 2 );
213 leftLayout->addLayout( lo_ga, row, 0, 1, 2 );
214 leftLayout->addLayout( lo_gamc, row, 2, 1, 4 );
215 leftLayout->addLayout( lo_dtall, row++, 6, 1, 2 );
216 leftLayout->addLayout( lo_pcsais, row, 0, 1, 2 );
217 leftLayout->addLayout( lo_pcsasl, row, 2, 1, 2 );
218 leftLayout->addLayout( lo_pcsads, row, 4, 1, 2 );
219 leftLayout->addLayout( lo_pcsahl, row++, 6, 1, 2 );
220 leftLayout->addLayout( lo_pcsaismc, row, 0, 1, 2 );
221 leftLayout->addLayout( lo_pcsaslmc, row, 2, 1, 2 );
222 leftLayout->addLayout( lo_pcsadsmc, row, 4, 1, 2 );
223 leftLayout->addLayout( lo_pcsahlmc, row++, 6, 1, 2 );
224 leftLayout->addLayout( lo_dmga, row, 0, 1, 2 );
225 leftLayout->addLayout( lo_dmgamc, row, 2, 1, 2 );
226 leftLayout->addLayout( lo_dmgara, row, 4, 1, 2 );
227 leftLayout->addLayout( lo_dmgaramc, row++, 6, 1, 2 );
228 leftLayout->addLayout( lo_2dsacgmc, row, 0, 1, 2 );
229 leftLayout->addLayout( lo_2dsamw, row, 2, 1, 2 );
230 leftLayout->addLayout( lo_2dsamcmw, row++, 4, 1, 4 );
231 leftLayout->addLayout( lo_2dsagl, row, 0, 1, 2 );
232 leftLayout->addLayout( lo_2dsaglmc, row++, 2, 1, 6 );
233 leftLayout->addLayout( lo_gamw, row, 0, 1, 2 );
234 leftLayout->addLayout( lo_gamcmw, row, 2, 1, 2 );
235 leftLayout->addLayout( lo_gagl, row, 4, 1, 2 );
236 leftLayout->addLayout( lo_gaglmc, row++, 6, 1, 2 );
237 leftLayout->addLayout( lo_pcsaistr, row, 0, 1, 2 );
238 leftLayout->addLayout( lo_pcsasltr, row, 2, 1, 2 );
239 leftLayout->addLayout( lo_pcsadstr, row, 4, 1, 2 );
240 leftLayout->addLayout( lo_pcsahltr, row++, 6, 1, 2 );
241 leftLayout->addLayout( lo_pcsa2o, row, 0, 1, 2 );
242 leftLayout->addLayout( lo_pcsa2omc, row, 2, 1, 2 );
243 leftLayout->addLayout( lo_pcsa2otr, row++, 4, 1, 4 );
244 leftLayout->addLayout( lo_dmgagl, row, 0, 1, 2 );
245 leftLayout->addLayout( lo_dmgaglmc, row++, 2, 1, 6 );
247 leftLayout->addWidget( lb_plottype, row++, 0, 1, 8 );
248 leftLayout->addLayout( lo_pltsw, row, 0, 1, 2 );
249 leftLayout->addLayout( lo_pltMW, row, 2, 1, 2 );
250 leftLayout->addLayout( lo_pltDw, row, 4, 1, 2 );
251 leftLayout->addLayout( lo_pltff0, row++, 6, 1, 2 );
252 leftLayout->addLayout( lo_pltvb, row, 0, 1, 8 );
253 leftLayout->addLayout( lo_pltMWl, row++, 2, 1, 8 );
255 leftLayout->addWidget(
lb_sigma, row, 0, 1, 5 );
256 leftLayout->addWidget(
ct_sigma, row++, 5, 1, 3 );
257 leftLayout->addWidget(
lb_plxmin, row, 0, 1, 2 );
258 leftLayout->addWidget(
le_plxmin, row, 2, 1, 2 );
259 leftLayout->addWidget(
lb_plxmax, row, 4, 1, 2 );
260 leftLayout->addWidget(
le_plxmax, row++, 6, 1, 2 );
262 leftLayout->addWidget( lb_runinfo, row++, 0, 1, 8 );
263 leftLayout->addWidget( lb_runid, row, 0, 1, 3 );
264 leftLayout->addWidget(
le_runid, row++, 3, 1, 5 );
265 leftLayout->addWidget( lb_svproj, row, 0, 1, 3 );
266 leftLayout->addWidget(
cmb_svproj, row++, 3, 1, 5 );
267 leftLayout->addWidget( lb_runids, row++, 0, 1, 8 );
268 leftLayout->addWidget(
lw_runids, row, 0, 1, 8 );
270 leftLayout->addLayout( lo_mdltype, row++, 0, 1, 8 );
271 leftLayout->addWidget( lb_models, row++, 0, 1, 8 );
273 leftLayout->addWidget(
lw_models, row, 0, 5, 8 );
275 leftLayout->setRowStretch( row, 1 );
276 leftLayout->addWidget(
te_status, row++, 0, 1, 8 );
281 connect( pb_loadda, SIGNAL( clicked() ),
282 this, SLOT(
load() ) );
284 this, SLOT(
save() ) );
289 connect( pb_help, SIGNAL( clicked() ),
290 this, SLOT(
help() ) );
291 connect( pb_close, SIGNAL( clicked() ),
292 this, SLOT( close() ) );
294 connect(
ck_2dsa, SIGNAL( stateChanged (
int ) ),
296 connect(
ck_2dsamc, SIGNAL( stateChanged (
int ) ),
298 connect(
ck_2dsamw, SIGNAL( stateChanged (
int ) ),
300 connect(
ck_2dsamcmw, SIGNAL( stateChanged (
int ) ),
302 connect(
ck_2dsagl, SIGNAL( stateChanged (
int ) ),
304 connect(
ck_2dsaglmc, SIGNAL( stateChanged (
int ) ),
306 connect(
ck_2dsacg, SIGNAL( stateChanged (
int ) ),
308 connect(
ck_2dsacgmc, SIGNAL( stateChanged (
int ) ),
310 connect(
ck_2dsafm, SIGNAL( stateChanged (
int ) ),
312 connect(
ck_ga, SIGNAL( stateChanged (
int ) ),
314 connect(
ck_gamc, SIGNAL( stateChanged (
int ) ),
316 connect(
ck_gamw, SIGNAL( stateChanged (
int ) ),
318 connect(
ck_gamcmw, SIGNAL( stateChanged (
int ) ),
320 connect(
ck_gagl, SIGNAL( stateChanged (
int ) ),
322 connect(
ck_gaglmc, SIGNAL( stateChanged (
int ) ),
324 connect(
ck_pcsais, SIGNAL( stateChanged (
int ) ),
326 connect(
ck_pcsasl, SIGNAL( stateChanged (
int ) ),
328 connect(
ck_pcsads, SIGNAL( stateChanged (
int ) ),
330 connect(
ck_pcsahl, SIGNAL( stateChanged (
int ) ),
332 connect(
ck_pcsaismc, SIGNAL( stateChanged (
int ) ),
334 connect(
ck_pcsaslmc, SIGNAL( stateChanged (
int ) ),
336 connect(
ck_pcsadsmc, SIGNAL( stateChanged (
int ) ),
338 connect(
ck_pcsahlmc, SIGNAL( stateChanged (
int ) ),
340 connect(
ck_pcsaistr, SIGNAL( stateChanged (
int ) ),
342 connect(
ck_pcsasltr, SIGNAL( stateChanged (
int ) ),
344 connect(
ck_pcsadstr, SIGNAL( stateChanged (
int ) ),
346 connect(
ck_pcsahltr, SIGNAL( stateChanged (
int ) ),
348 connect(
ck_pcsa2o, SIGNAL( stateChanged (
int ) ),
350 connect(
ck_pcsa2omc, SIGNAL( stateChanged (
int ) ),
352 connect(
ck_pcsa2otr, SIGNAL( stateChanged (
int ) ),
354 connect(
ck_dtall, SIGNAL( stateChanged (
int ) ),
357 connect(
rb_pltsw, SIGNAL( toggled (
bool ) ),
359 connect(
rb_pltMW, SIGNAL( toggled (
bool ) ),
361 connect(
rb_pltDw, SIGNAL( toggled (
bool ) ),
363 connect(
rb_pltff0, SIGNAL( toggled (
bool ) ),
365 connect(
rb_pltvb, SIGNAL( toggled (
bool ) ),
367 connect(
rb_pltMWl, SIGNAL( toggled (
bool ) ),
370 connect(
ct_sigma, SIGNAL( valueChanged(
double ) ),
372 connect(
le_plxmin, SIGNAL( editingFinished( ) ),
374 connect(
le_plxmax, SIGNAL( editingFinished( ) ),
377 connect(
ck_mdltype, SIGNAL( stateChanged(
int ) ),
380 connect(
lw_runids, SIGNAL( currentRowChanged(
int ) ),
382 connect(
lw_models, SIGNAL( currentRowChanged(
int ) ),
386 tr(
"Discrete s20,W Distributions" ),
387 tr(
"Sedimentation Coefficient x 1e+13 (corr. for 20,W)" ),
388 tr(
"Signal Concentration" ) );
391 data_plot1->setAxisScale( QwtPlot::xBottom, 1.0, 10.0 );
392 data_plot1->setAxisScale( QwtPlot::yLeft, 0.0, 100.0 );
394 grid->enableXMin(
true );
395 grid->enableYMin(
true );
399 QwtLegend *legend =
new QwtLegend;
400 legend->setFrameStyle( QFrame::Box | QFrame::Sunken );
401 legend->setFont( sfont );
402 data_plot1->insertLegend( legend, QwtPlot::BottomLegend );
404 rightLayout->addLayout( plot );
406 mainLayout ->addLayout( leftLayout );
407 mainLayout ->addLayout( rightLayout );
408 mainLayout ->setStretchFactor( leftLayout, 2 );
409 mainLayout ->setStretchFactor( rightLayout, 3 );
411 le_runid ->setText(
"(current run ID)" );
412 cmb_svproj ->addItem(
"(project name for plot save)" );
415 int hh = lb_svproj->height();
416 int ww = lb_svproj->width() / 6;
421 for (
int ii = 0; ii < 8; ii++ )
422 leftLayout ->setColumnMinimumWidth( ii, ww );
423 leftLayout ->setColumnStretch ( 0, 1 );
424 leftLayout ->setColumnStretch ( 1, 1 );
425 te_status ->setMaximumHeight( ( hh * 3 ) / 2 );
437 te_status->setText( tr(
"Building a list of selectable run IDs..." ) );
438 qApp->processEvents();
442 connect( &srdiag, SIGNAL( changed(
bool ) ),
446 int nrunids = runids.count();
448 if ( nrunids < 1 )
return;
450 te_status->setText( tr(
"Updating the distributions list..." ) );
455 DbgLv(1) <<
"Selected runIDs[0]" << runids[0] <<
"count" << nrunids;
457 for(
int ii=0;ii<
aDescrs.count();ii++)
459 QString mrun=
aDescrs[ii].section(
"\t",0,0);
460 QString mgid=
aDescrs[ii].section(
"\t",1,1).left(9)+
"...";
461 QString mdes=
aDescrs[ii].section(
"\t",2,2);
462 QString ddes=
aDescrs[ii].section(
"\t",3,3);
463 bool iter=mdes.contains(
"-MC_");
464 if(iter&&!mdes.contains(
"_mcN"))
continue;
465 mdes=
"..."+mdes.section(
".",1,-1);
466 DbgLv(1) <<
" ii" << ii <<
"mrun" << mrun <<
"mgid" << mgid
467 <<
"mdes" << mdes <<
"iter" << iter <<
"ddes" << ddes;
471 te_status->setText( tr(
"Added: %1 run(s), %2 implied total models." )
472 .arg( nrunids ).arg(
distros.count() ) );
483 for (
int ii = 0; ii < nrunids; ii++ )
494 for (
int ii = 0; ii <
distros.count(); ii++ )
496 QString method =
distros[ ii ].mdescr.section(
".", -1, -1 )
497 .section(
"_", -3, -3 );
498 if ( ! methods.contains( method ) )
502 bool hv_2dsa = methods.contains(
"2DSA" );
503 bool hv_2dsamc = methods.contains(
"2DSA-MC" );
504 bool hv_2dsamw = methods.contains(
"2DSA-MW" );
505 bool hv_2dsamcmw = methods.contains(
"2DSA-MC-MW" );
506 bool hv_2dsagl = methods.contains(
"2DSA-GL" );
507 bool hv_2dsaglmc = methods.contains(
"2DSA-GL-MC" );
508 bool hv_2dsacg = methods.contains(
"2DSA-CG" );
509 bool hv_2dsacgmc = methods.contains(
"2DSA-CG-MC" );
510 bool hv_2dsafm = methods.contains(
"2DSA-FM" );
511 bool hv_ga = methods.contains(
"GA" );
512 bool hv_gamc = methods.contains(
"GA-MC" );
513 bool hv_gamw = methods.contains(
"GA-MW" );
514 bool hv_gamcmw = methods.contains(
"GA-MC-MW" );
515 bool hv_gagl = methods.contains(
"GA-GL" );
516 bool hv_gaglmc = methods.contains(
"GA-GL-MC" );
517 bool hv_pcsais = methods.contains(
"PCSA-IS" );
518 bool hv_pcsasl = methods.contains(
"PCSA-SL" );
519 bool hv_pcsads = methods.contains(
"PCSA-DS" );
520 bool hv_pcsahl = methods.contains(
"PCSA-HL" );
521 bool hv_pcsaismc = methods.contains(
"PCSA-IS-MC" );
522 bool hv_pcsaslmc = methods.contains(
"PCSA-SL-MC" );
523 bool hv_pcsadsmc = methods.contains(
"PCSA-DS-MC" );
524 bool hv_pcsahlmc = methods.contains(
"PCSA-HL-MC" );
525 bool hv_pcsaistr = methods.contains(
"PCSA-IS-TR" );
526 bool hv_pcsasltr = methods.contains(
"PCSA-SL-TR" );
527 bool hv_pcsadstr = methods.contains(
"PCSA-DS-TR" );
528 bool hv_pcsahltr = methods.contains(
"PCSA-HL-TR" );
529 bool hv_pcsa2o = methods.contains(
"PCSA-2O" );
530 bool hv_pcsa2omc = methods.contains(
"PCSA-2O-MC" );
531 bool hv_pcsa2otr = methods.contains(
"PCSA-2O-TR" );
532 bool hv_dmga = methods.contains(
"DMGA" );
533 bool hv_dmgamc = methods.contains(
"DMGA-MC" );
534 bool hv_dmgara = methods.contains(
"DMGA-RA" );
535 bool hv_dmgaramc = methods.contains(
"DMGA-RA-MC" );
536 bool hv_dmgagl = methods.contains(
"DMGA-GL" );
537 bool hv_dmgaglmc = methods.contains(
"DMGA-GL-MC" );
538 bool hv_dtall = methods.size() > 0;
540 ck_2dsa ->setEnabled( hv_2dsa );
549 ck_ga ->setEnabled( hv_ga );
550 ck_gamc ->setEnabled( hv_gamc );
551 ck_gamw ->setEnabled( hv_gamw );
553 ck_gagl ->setEnabled( hv_gagl );
570 ck_dmga ->setEnabled( hv_dmga );
578 ck_2dsa ->setChecked( hv_2dsa );
587 ck_ga ->setChecked( hv_ga );
588 ck_gamc ->setChecked( hv_gamc );
589 ck_gamw ->setChecked( hv_gamw );
591 ck_gagl ->setChecked( hv_gagl );
608 ck_dmga ->setChecked( hv_dmga );
633 DbgLv(1) <<
"main size" << size();
663 QString titleY = tr(
"Signal Concentration" );
664 DbgLv(1) <<
"pDa: titleY" << titleY;
670 titleP = tr(
"Discrete s20,W Distributions" );
671 titleX = tr(
"Sedimentation Coefficient x 1.e+13 (20,W)" );
675 titleP = tr(
"Discrete Molecular Weight Distributions" );
676 titleX = tr(
"Molecular Weight (Dalton)" );
680 titleP = tr(
"Discrete D20,W Distributions" );
681 titleX = tr(
"Diffusion Coefficient (20,W)" );
685 titleP = tr(
"Discrete Frictional Ratio Distributions" );
686 titleX = tr(
"Frictional Ratio (f/f0)" );
690 titleP = tr(
"Discrete Vbar Distributions" );
691 titleX = tr(
"Vbar (Specific Density)" );
695 titleP = tr(
"Discrete Log of Molecular Weight Distributions" );
696 titleX = tr(
"Molecular Weight (Log, Dalton)" );
698 DbgLv(1) <<
"pDa: titleP" << titleP;
699 DbgLv(1) <<
"pDa: titleX" << titleX;
701 data_plot1->setAxisTitle( QwtPlot::xBottom, titleX );
702 data_plot1->setAxisTitle( QwtPlot::yLeft, titleY );
703 double plxmin = 1e+30;
704 double plxmax = -1e+30;
706 for (
int ii = 0; ii <
pdistrs.size(); ii++ )
711 for (
int jj = 0; jj <
pdistrs[ ii ].xvals.size(); jj++ )
713 plxmin = qMin( plxmin,
pdistrs[ ii ].xvals[ jj ] );
714 plxmax = qMax( plxmax,
pdistrs[ ii ].xvals[ jj ] );
720 double plxinc = ( plxmax - plxmin ) / 299.0;
721 int rpwr = qRound( log10( plxinc ) );
722 plxinc = pow( 10.0, rpwr - 3 );
723 plxmin = (double)qFloor( plxmin / plxinc ) * plxinc;
724 plxmax = (double)qRound( plxmax / plxinc ) * plxinc;
727 le_plxmin->setText( QString::number( plxmin ) );
728 le_plxmax->setText( QString::number( plxmax ) );
729 connect(
le_plxmin, SIGNAL( editingFinished( ) ),
731 connect(
le_plxmax, SIGNAL( editingFinished( ) ),
739 int ndispt = ddesc.
xvals.size();
740 double* xx = ddesc.
xvals.data();
741 double* yy = ddesc.
yvals.data();
742 QVector< double > xenv;
743 QVector< double > yenv;
744 DbgLv(1) <<
"pDi: ndispt" << ndispt <<
"ID" << distrID.left(20);
750 data_curv->setPen ( QPen( QBrush( ddesc.
color ), 2.0, Qt::SolidLine ) );
751 data_curv->setStyle( QwtPlotCurve::Lines );
760 data_curv->setPen ( QPen( QBrush( ddesc.
color ), 3.0, Qt::SolidLine ) );
761 data_curv->setStyle( QwtPlotCurve::Sticks );
764 data_curv->setData ( xx, yy, ndispt );
765 data_curv->setItemAttribute( QwtPlotItem::Legend,
true );
767 double minx =
le_plxmin->text().toDouble();
768 double maxx =
le_plxmax->text().toDouble();
770 data_plot1->setAxisAutoScale( QwtPlot::xBottom );
772 data_plot1->setAxisScale( QwtPlot::xBottom, minx, maxx );
773 data_plot1->setAxisAutoScale( QwtPlot::yLeft );
774 data_plot1->enableAxis ( QwtPlot::xBottom,
true );
775 data_plot1->enableAxis ( QwtPlot::yLeft,
true );
795 QString
runID = ( oproj ==
"All" ) ?
pdistrs[ 0 ].runID : oproj;
797 QString mdescr =
pdistrs[ 0 ].mdescr;
798 QString annode = mdescr.section(
".", -1, -1 ).section(
"_", -3, -3 );
799 QString trnode =
"0Z9999";
800 QString sanode1 =
"combo-distrib-s";
801 QString sanode2 =
"combo-vcdat-s";
802 QString sanode3 =
"combo-listincl-s";
806 sanode1 =
"combo-distrib-mw";
807 sanode2 =
"combo-vcdat-mw";
808 sanode3 =
"combo-listincl-mw";
810 else if (
xtype == 2 )
812 sanode1 =
"combo-distrib-d";
813 sanode2 =
"combo-vcdat-d";
814 sanode3 =
"combo-listincl-d";
816 else if (
xtype == 3 )
818 sanode1 =
"combo-distrib-ff0";
819 sanode2 =
"combo-vcdat-ff0";
820 sanode3 =
"combo-listincl-ff0";
822 else if (
xtype == 4 )
824 sanode1 =
"combo-distrib-vbar";
825 sanode2 =
"combo-vcdat-vbar";
826 sanode3 =
"combo-listincl-vbar";
828 else if (
xtype == 5 )
830 sanode1 =
"combo-distrib-mwl";
831 sanode2 =
"combo-vcdat-mwl";
832 sanode3 =
"combo-listincl-mwl";
834 QString fnamsvg = annode +
"." + trnode +
"." + sanode1 +
".svgz";
835 QString fnampng = annode +
"." + trnode +
"." + sanode1 +
".png";
837 QString fnamdat = annode +
"." + trnode +
"." + sanode2 +
".csv";
838 QString fnamlst = annode +
"." + trnode +
"." + sanode3 +
".rpt";
839 QString plotFile = fdir +
"/" + fnamsvg;
840 QString dataFile = fdir +
"/" + fnamdat;
841 QString listFile = fdir +
"/" + fnamlst;
844 QString svmsg = tr(
"Saved:\n " ) + fnampng +
"\n "
848 QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
851 for (
int ii = 0; ii <
pdistrs.size(); ii++ )
853 QString prun =
pdistrs[ ii ].runID;
854 if ( oproj ==
"All" )
856 if ( ! prunids.contains( prun ) )
863 else if ( prun == runID )
872 int nruns = prunids.size();
874 while( iruns < nruns )
876 if ( ! QFile( fdir ).exists() )
878 QDir().mkpath( fdir );
884 svmsg += tr(
"in directory:" ) +
"\n " + fdir +
"\n";
893 QString trfirst =
pdistrs[ 0 ].mdescr.section(
".", -2, -2 );
894 QString trlast =
pdistrs[ kl ].mdescr.section(
".", -2, -2 );
895 QString trdesc =
"Combined Analyses (" + trfirst
896 +
"..." + trlast +
")";
905 query <<
"get_experiment_info_by_runID" << runID << invID;
908 QString expID = db.value( 1 ).toString();
909 DbgLv(1) <<
"SV: runID expID" << runID << expID;
913 query <<
"get_rawDataIDs" << expID;
917 rawID = db.value( 0 ).toString();
918 QString efname = db.value( 2 ).toString();
919 DbgLv(1) <<
"SV: rawID" << rawID <<
"efname" << efname <<
"trip1" << trip1;
921 if ( efname.contains( trip1 ) )
926 query <<
"get_editedDataIDs" << rawID;
930 QString aeditID = db.value( 0 ).toString();
931 QString efname = db.value( 2 ).toString();
932 if ( eeditID.isEmpty() )
934 DbgLv(1) <<
"SV: editID" << eeditID <<
"raw exp trip1 fname"
935 << rawID << expID << trip1 << efname;
936 if ( efname.contains( trip1 ) )
939 DbgLv(1) <<
"SV: Name-Trip MATCH: editID" << editID;
943 if ( ! editID.isEmpty() )
945 idEdit = editID.toInt();
949 idEdit = eeditID.toInt();
951 DbgLv(1) <<
"SV: editID idEdit" << editID << idEdit <<
" eeditID" << eeditID;
955 rfiles << fnamsvg << fnampng << fnamdat << fnamlst;
959 DbgLv(1) <<
"SV:runID" << runID <<
"idEdit" << idEdit
960 <<
"fnamlst" << fnamlst <<
"trdesc" << trdesc;
961 if ( iruns == ( nruns - 1 ) )
964 svmsg += tr(
"\nThe files were also saved to the database" );
966 svmsg += tr(
"\n*ERROR* in saving files to the database" );
970 if ( ++iruns >= nruns )
break;
972 runID = prunids[ iruns ];
974 plotFile = fdir +
"/" + fnamsvg;
975 dataFile = fdir +
"/" + fnamdat;
976 listFile = fdir +
"/" + fnamlst;
979 QApplication::restoreOverrideCursor();
982 QMessageBox::information(
this, tr(
"Combo Distro Plot File Save" ), svmsg );
988 DbgLv(1) <<
"RunIDSel:row" << row;
989 if ( row < 0 )
return;
992 QListWidgetItem* item =
lw_runids->item( row );
993 runID = item->text();
998 bool mfilter = !
ck_dtall->isChecked();
1003 if (
ck_2dsa ->isChecked() ) methods <<
"2DSA";
1004 if (
ck_2dsamc ->isChecked() ) methods <<
"2DSA-MC";
1005 if (
ck_2dsamw ->isChecked() ) methods <<
"2DSA-MW";
1006 if (
ck_2dsamcmw->isChecked() ) methods <<
"2DSA-MC-MW";
1007 if (
ck_2dsagl ->isChecked() ) methods <<
"2DSA-GL";
1008 if (
ck_2dsaglmc->isChecked() ) methods <<
"2DSA-GL-MC";
1009 if (
ck_2dsacg ->isChecked() ) methods <<
"2DSA-CG";
1010 if (
ck_2dsacgmc->isChecked() ) methods <<
"2DSA-CG-MC";
1011 if (
ck_2dsafm ->isChecked() ) methods <<
"2DSA-FM";
1012 if (
ck_ga ->isChecked() ) methods <<
"GA";
1013 if (
ck_gamc ->isChecked() ) methods <<
"GA-MC";
1014 if (
ck_gamw ->isChecked() ) methods <<
"GA-MW";
1015 if (
ck_gamcmw ->isChecked() ) methods <<
"GA-MC-MW";
1016 if (
ck_gagl ->isChecked() ) methods <<
"GA-GL";
1017 if (
ck_gaglmc ->isChecked() ) methods <<
"GA-GL-MC";
1018 if (
ck_pcsais ->isChecked() ) methods <<
"PCSA-IS";
1019 if (
ck_pcsasl ->isChecked() ) methods <<
"PCSA-SL";
1020 if (
ck_pcsads ->isChecked() ) methods <<
"PCSA-DS";
1021 if (
ck_pcsahl ->isChecked() ) methods <<
"PCSA-HL";
1022 if (
ck_pcsaismc->isChecked() ) methods <<
"PCSA-IS-MC";
1023 if (
ck_pcsaslmc->isChecked() ) methods <<
"PCSA-SL-MC";
1024 if (
ck_pcsadsmc->isChecked() ) methods <<
"PCSA-DS-MC";
1025 if (
ck_pcsahlmc->isChecked() ) methods <<
"PCSA-HL-MC";
1026 if (
ck_pcsaistr->isChecked() ) methods <<
"PCSA-IS-TR";
1027 if (
ck_pcsasltr->isChecked() ) methods <<
"PCSA-SL-TR";
1028 if (
ck_pcsadstr->isChecked() ) methods <<
"PCSA-DS-TR";
1029 if (
ck_pcsahltr->isChecked() ) methods <<
"PCSA-HL-TR";
1030 if (
ck_pcsa2o ->isChecked() ) methods <<
"PCSA-2O";
1031 if (
ck_pcsa2omc->isChecked() ) methods <<
"PCSA-2O-MC";
1032 if (
ck_pcsa2otr->isChecked() ) methods <<
"PCSA-2O-TR";
1033 if (
ck_dmga ->isChecked() ) methods <<
"DMGA";
1034 if (
ck_dmgamc ->isChecked() ) methods <<
"DMGA-MC";
1035 if (
ck_dmgara ->isChecked() ) methods <<
"DMGA-RA";
1036 if (
ck_dmgaramc->isChecked() ) methods <<
"DMGA-RA-MC";
1037 if (
ck_dmgagl ->isChecked() ) methods <<
"DMGA-GL";
1038 if (
ck_dmgaglmc->isChecked() ) methods <<
"DMGA-GL-MC";
1042 QString grunID =
"global-" +
runID;
1044 for (
int ii = 0; ii <
distros.size(); ii++ )
1046 DbgLv(1) <<
"RunIDSel: ii runID" << ii <<
distros[ii].runID;
1050 QString mdesc =
distros[ ii ].mdescr;
1051 QString ddesc =
distros[ ii ].ddescr;
1055 QString meth = mdesc.section(
".", -1, -1 ).section(
"_", -3, -3 );
1056 DbgLv(1) <<
"RunIDSel: meth" << meth;
1057 if ( ! methods.contains( meth ) )
continue;
1060 DbgLv(1) <<
"RunIDSel: added: ddesc" << ddesc;
1074 DbgLv(1) <<
"ModelSel:row" << row;
1075 if ( row < 0 )
return;
1076 QListWidgetItem* item =
lw_models ->item( row );
1077 QString distrID = item->text();
1079 DbgLv(1) <<
"ModelSel: model" << distrID <<
"mdx" << mdx;
1082 if ( !
pdisIDs.contains( distrID ) )
1093 QMessageBox::critical(
this, tr(
"Zero-Components Model" ),
1094 tr(
"*ERROR* The selected model has zero components.\n"
1095 "This selection is ignored" ) );
1105 te_status->setText( tr(
"Count of plotted distributions: %1." )
1114 int ncolors =
colors.size();
1115 int color_index = distx;
1117 while ( color_index >= ncolors )
1118 color_index -= ncolors;
1120 DbgLv(1) <<
"sC: color_index" << color_index;
1131 colors << QColor( 255, 0, 0 );
1132 colors << QColor( 0, 255, 0 );
1133 colors << QColor( 0, 0, 255 );
1134 colors << QColor( 255, 255, 0 );
1135 colors << QColor( 255, 0, 255 );
1136 colors << QColor( 0, 255, 255 );
1137 colors << QColor( 122, 0, 255 );
1138 colors << QColor( 0, 255, 122 );
1139 colors << QColor( 0, 122, 255 );
1140 colors << QColor( 255, 122, 0 );
1141 colors << QColor( 122, 255, 0 );
1142 colors << QColor( 80, 0, 255 );
1143 colors << QColor( 255, 0, 80 );
1144 colors << QColor( 80, 0, 255 );
1145 colors << QColor( 255, 0, 80 );
1146 colors << QColor( 0, 255, 80 );
1147 colors << QColor( 0, 80, 255 );
1148 colors << QColor( 80, 255, 0 );
1149 colors << QColor( 255, 80, 40 );
1150 colors << QColor( 40, 255, 40 );
1151 colors << QColor( 40, 40, 255 );
1158 const int mxrch = 30;
1161 QString
runID = mdescr.section(
".", 0, -3 );
1162 runID = runID.length() <= mxrch ?
1163 runID : runID.left( mxrch ) +
"(++)";
1164 QString
triple = mdescr.section(
".", -2, -2 );
1165 QString iterID = mdescr.section(
".", -1, -1 );
1166 QString andate = iterID.section(
"_", 1, 1 );
1167 QString method = iterID.section(
"_", 2, 2 );
1168 iterID = ( method !=
"2DSA-FM" )
1169 ? iterID.section(
"_", -2, -2 )
1170 : iterID.section(
"_", -1, -1 );
1174 distrID = runID +
"." + triple +
"." + andate +
"_" + method
1179 distrID = runID +
" (" + triple +
", " + method +
") " + ddescr;
1182 for (
int ii = 0; ii <
distros.size(); ii++ )
1184 if ( mdescr ==
distros[ ii ].mdescr )
1191 distrID +=
"[" + QString::number( mdx ) +
"]";
1199 DbgLv(1) <<
"Upd_Dk_Db isDB" << isDB;
1207 if ( ddesc.
xvals.size() > 0 &&
1213 QVector< double > mxvals;
1214 QVector< double > myvals;
1215 QString mdescr = ddesc.
mdescr;
1216 ddesc.
iters = mdescr.contains(
"-MC_" ) ? 1 : 0;
1217 DbgLv(1) <<
"FID: mdescr" << mdescr <<
"iters" << ddesc.
iters;
1222 DbgLv(1) <<
"FID: ncomps" << ncomps;
1230 DbgLv(1) <<
"FID: (2)ncomps" << ncomps;
1232 DbgLv(1) <<
"FID: (3)ncomps" << ncomps;
1235 for (
int jj = 0; jj < ncomps; jj++ )
1251 DbgLv(1) <<
"FID: xtype" <<
xtype <<
"mxval.size" << mxvals.size();
1252 ddesc.
xvals.fill( 0.0, ncomps );
1253 ddesc.
yvals.fill( 0.0, ncomps );
1256 double xval = mxvals[ 0 ];
1257 double yval = myvals[ 0 ];
1258 ddesc.
xvals[ 0 ] = xval;
1259 ddesc.
yvals[ 0 ] = yval;
1262 for (
int jj = 1; jj < ncomps; jj++ )
1266 xval = mxvals[ jj ];
1267 yval = myvals[ jj ];
1272 ddesc.
xvals[ kk ] = ( xvpr + xval ) * 0.5;
1273 ddesc.
yvals[ kk ] = yval;
1279 ddesc.
xvals[ nn ] = xval;
1280 ddesc.
yvals[ nn++ ] = yval;
1287 for (
int jj = 0; jj < nn; jj++ )
1289 if ( ddesc.
yvals[ jj ] != 0.0 )
1296 ddesc.
xvals.resize( kk );
1297 ddesc.
yvals.resize( kk );
1310 QFile(
dat1File ).copy( dataFile );
1311 QFile(
lis1File ).copy( listFile );
1321 QFile dfile( dataFile );
1323 if ( ! dfile.open( QIODevice::WriteOnly | QIODevice::Text ) )
1325 qDebug() <<
"***Error opening output file" << dataFile;
1329 QTextStream tsd( &dfile );
1331 QVector< QVector< double > > peyvals;
1332 QVector< double > xenvs;
1333 QVector< double > yenvs;
1334 QVector< double >* xvals;
1335 QVector< double >* yvals;
1337 int lplot = nplots - 1;
1339 int nenvvl = arrsize;
1344 for (
int ii = 0; ii < nplots; ii++ )
1347 maxnvl = qMax( maxnvl,
pdistrs[ ii ].xvals.size() );
1348 QString mdescr =
pdistrs[ ii ].mdescr;
1349 QString mdtrip = mdescr.section(
".", -2, -2 );
1350 QString mditer = mdescr.section(
".", -1, -1 );
1351 QString mdmeth = mditer.section(
"_", 2, 2 );
1352 QString pd =
"\"" + mdtrip +
"." + mdmeth +
".";
1356 DbgLv(1) <<
"WrDa: plot" << ii <<
"pd" << pd;
1358 line += pd +
"raw-x\"," + pd +
"raw-y\",";
1367 line +=
"\"all.smooth-x\",";
1369 for (
int ii = 0; ii < nplots; ii++ )
1371 QString mdescr =
pdistrs[ ii ].mdescr;
1372 QString mdtrip = mdescr.section(
".", -2, -2 );
1373 QString mditer = mdescr.section(
".", -1, -1 );
1374 QString mdmeth = mditer.section(
"_", 2, 2 );
1375 QString pd =
"\"" + mdtrip +
"." + mdmeth +
".";
1376 line += pd +
"smooth-y\"";
1377 line += ( ( ii < lplot ) ?
"," :
"\n" );
1382 DbgLv(1) <<
"WrDa: maxnvl" << maxnvl <<
"nplots" << nplots;
1383 char valfm1[] =
"\"%.5f\",\"%.5f\"";
1384 char valfm2[] =
"\"%.4e\",\"%.5f\"";
1385 char valfx1[] =
"\"%.5f\"";
1386 char valfy1[] =
"\"%.5f\"";
1387 char valfx2[] =
"\"%.4e\"";
1388 char valfy2[] =
"\"%.5f\"";
1389 QString dummy_pair(
"\"\",\"\"," );
1390 QString dummy_valu(
"\"\"" );
1391 char* valfmt = valfm1;
1392 char* valfmx = valfx1;
1393 char* valfmy = valfy1;
1394 maxnvl = qMax( maxnvl, nenvvl );
1402 for (
int jj = 0; jj < maxnvl; jj++ )
1407 for (
int ii = 0; ii < nplots; ii++ )
1413 if ( jj < xvals->size() )
1414 line += QString().sprintf(
1415 valfmt, xvals->at( jj ), yvals->at( jj ) ) +
",";
1424 line += QString().sprintf( valfmx, xenvs[ jj ] ) +
",";
1426 line += dummy_valu +
",";
1428 for (
int ii = 0; ii < nplots; ii++ )
1431 line += QString().sprintf( valfmy, peyvals[ ii ][ jj ] );
1435 line += ( ii < lplot ) ?
"," :
"\n";
1445 QFile lfile( listFile );
1446 if ( ! lfile.open( QIODevice::WriteOnly | QIODevice::Text ) )
1448 qDebug() <<
"***Error opening output file" << listFile;
1451 QTextStream tsl( &lfile );
1453 for (
int ii = 0; ii < nplots; ii++ )
1455 line = pdlong[ ii ] +
"\n";
1466 QStringList& files,
US_DB2* db,
int& idEdit, QString& trdesc )
1468 DbgLv(1) <<
"rDFF: runID fdir files0" << runID << fdir << files[0];
1469 DbgLv(1) <<
"rDFF: idEdit trdesc" << idEdit << trdesc;
1474 for (
int ii = 0; ii < files.size(); ii++ )
1476 QString fname = files[ ii ];
1485 int status = freport.
readDB( runID, db );
1486 DbgLv(1) <<
"DFF:report readDB status" << status <<
"ID" << freport.
ID;
1487 DbgLv(1) <<
"DFF: report triples size" << freport.
triples.size();
1488 for (
int ii = 0; ii < freport.
triples.size(); ii++ )
1490 int ndoc = freport.
triples[ii].docs.size();
1491 DbgLv(1) <<
"DFF: triple" << ii <<
"docssize" << ndoc
1492 <<
"ID" << freport.
triples[ii].tripleID
1493 <<
"triple" << freport.
triples[ii].triple;
1497 DbgLv(1) <<
"DFF: doc" << 0
1498 <<
"ID" << freport.
triples[ii].docs[0].documentID
1499 <<
"label" << freport.
triples[ii].docs[0].label;
1500 DbgLv(1) <<
"DFF: doc" << jj
1501 <<
"ID" << freport.
triples[ii].docs[jj].documentID
1502 <<
"label" << freport.
triples[ii].docs[jj].label;
1505 QString fname = files[0];
1506 QString tripl(
"0/Z/9999" );
1508 DbgLv(1) <<
"DFF:triple" << tripl <<
"ndx" << ndx;
1511 int ndoc = freport.
triples[ndx].docs.size();
1512 DbgLv(1) <<
"DFF: triple" << ndx <<
"docs size" << ndoc
1513 <<
"ID" << freport.
triples[ndx].tripleID
1514 <<
"triple" << freport.
triples[ndx].triple;
1517 DbgLv(1) <<
"DFF: doc" << 0
1518 <<
"ID" << freport.
triples[ndx].docs[0].documentID
1519 <<
"label" << freport.
triples[ndx].docs[0].label;
1521 DbgLv(1) <<
"DFF: doc" << jj
1522 <<
"ID" << freport.
triples[ndx].docs[jj].documentID
1523 <<
"label" << freport.
triples[ndx].docs[jj].label;
1537 for (
int ii = 0; ii <
distros.count(); ii++ )
1555 for (
int ii = 0; ii <
distros.count(); ii++ )
1557 if ( mguid ==
distros[ ii ].mGUID )
1572 for (
int ii = first; ii <
distros.count(); ii++ )
1589 for (
int ii = 0; ii <
aDescrs.count(); ii++ )
1591 QString mrun =
aDescrs[ii].section(
"\t", 0, 0 );
1592 QString mgid =
aDescrs[ii].section(
"\t", 1, 1 );
1593 QString mdes =
aDescrs[ii].section(
"\t", 2, 2 );
1594 QString ddes =
aDescrs[ii].section(
"\t", 3, 3 );
1601 dd.
iters = mdes.contains(
"-MC_" ) ? 1 : 0;
1602 if ( dd.
iters != 0 && ! mdes.contains(
"_mcN" ) )
continue;
1619 if ( state == Qt::Unchecked )
1628 if ( state == Qt::Checked )
1680 if ( ! on_state )
return;
1682 DbgLv(1) <<
"changedPlotX" << on_state;
1683 bool x_is_sw =
rb_pltsw ->isChecked();
1684 bool x_is_MW =
rb_pltMW ->isChecked();
1685 bool x_is_Dw =
rb_pltDw ->isChecked();
1687 bool x_is_vb =
rb_pltvb ->isChecked();
1693 DbgLv(1) <<
" PX=Sed.Coeff";
1699 DbgLv(1) <<
" PX=Molec.Wt.";
1705 DbgLv(1) <<
" PX=Diff.Coeff";
1709 else if ( x_is_ff0 )
1711 DbgLv(1) <<
" PX=f/f0";
1717 DbgLv(1) <<
" PX=Vbar";
1721 else if ( x_is_MWl )
1723 DbgLv(1) <<
" PX=Molec.Wt.log";
1730 QList< DistrDesc > wdistros;
1734 for (
int ii = 0; ii < npdis; ii++ )
1751 for (
int ii = 0; ii < npdis; ii++ )
1753 pddist = &wdistros[ ii ];
1764 connect(
le_plxmin, SIGNAL( editingFinished( ) ),
1766 connect(
le_plxmax, SIGNAL( editingFinished( ) ),
1787 double dd = ( aa != 0.0 ) ? aa : ( bb != 0.0 ? bb : 1.0 );
1788 return ( ( qAbs( aa - bb ) / dd ) <= eps );
1793 QVector< double >& xvals, QVector< double >& yvals,
1794 QVector< double >& xenvs, QVector< double >& yenvs )
1797 int vCount = xvals.size();
1798 double min_xval = 1.0e+50;
1799 double max_xval = -min_xval;
1800 double con_sum = 0.0;
1801 double env_sum = 0.0;
1802 double* xv = xvals.data();
1803 double* yv = yvals.data();
1805 for (
int jj = 0; jj < vCount; jj++ )
1807 max_xval = qMax( max_xval, xv[ jj ] );
1808 min_xval = qMin( min_xval, xv[ jj ] );
1809 con_sum += yv[ jj ];
1813 bool min_neg = ( min_xval < 0.0 );
1814 double rng_xval = max_xval - min_xval;
1815 double xval_pad = rng_xval * 0.1;
1816 min_xval = min_xval - xval_pad;
1817 min_xval = min_neg ? min_xval : qMax( 0.0, min_xval );
1819 max_xval = max_xval + xval_pad;
1820 double minx =
le_plxmin->text().toDouble();
1821 double maxx =
le_plxmax->text().toDouble();
1822 min_xval = ( minx != 0.0 ) ? minx : min_xval;
1823 max_xval = ( maxx != 0.0 ) ? maxx : max_xval;
1824 rng_xval = max_xval - min_xval;
1827 xenvs.fill( 0.0, arrsize );
1828 yenvs.fill( 0.0, arrsize );
1829 double* xe = xenvs.data();
1830 double* ye = yenvs.data();
1831 double xinc = rng_xval / (double)( arrsize - 1 );
1832 DbgLv(1) <<
"ED: rng_xval arrsize xinc" << rng_xval << arrsize << xinc;
1834 for (
int jj = 0; jj < arrsize; jj++ )
1836 xe[ jj ] = min_xval + xinc * (double)( jj );
1841 double pisqr = sqrt( M_PI * 2.0 );
1843 sigma = qMax( 0.0001, sigma );
1844 double xterm = 1.0 / ( sigma * rng_xval );
1845 double zterm = 1.0 / ( sigma * pisqr );
1847 for (
int kk = 0; kk < arrsize; kk++ )
1849 double xval_env = xe[ kk ];
1850 double yval_env = 0.0;
1852 for (
int jj = 0; jj < vCount; jj++ )
1854 double xval_sol = xv[ jj ];
1855 double yval_sol = yv[ jj ];
1857 double xdiff =
sq( ( xval_sol - xval_env ) * xterm );
1858 double yfac = exp( -0.5 * xdiff ) * zterm;
1859 yval_env += ( yfac * yval_sol );
1862 ye[ kk ] = yval_env;
1863 env_sum += ye[ kk ];
1866 double scale = con_sum / env_sum;
1867 DbgLv(1) <<
"ED: csum esum scale " << con_sum << env_sum << scale;
1872 for (
int kk = 0; kk < arrsize; kk++ )
1875 if(ye[kk]>yemx) { yemx=ye[kk]; xemx=xe[kk]; }
1878 DbgLv(1) <<
"ED: Final esum" << env_sum <<
"csum" << con_sum
1879 <<
"xemx yemx" << xemx << yemx
1880 <<
"sigma vcount" << sigma << vCount;
1898 connect(
le_plxmin, SIGNAL( editingFinished( ) ),
1900 connect(
le_plxmax, SIGNAL( editingFinished( ) ),