us-commits
Threads by month
- ----- 2026 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- 6666 discussions
Author: alexey
Date: 2019-08-13 22:54:23 +0000 (Tue, 13 Aug 2019)
New Revision: 2810
Modified:
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
Log:
Autoflow's live_update:
* reset wavelengths && lambda range upon reattach.
* make sure ExpID is coupled to RunID in autoflow record when reattaching (maybe different when same protoocl re-launched manually from Optima bypassing us_Comproject)
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 20:56:22 UTC (rev 2809)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 22:54:23 UTC (rev 2810)
@@ -1163,6 +1163,11 @@
le_runID ->setText( runID );
//le_dbhost ->setText( xpnhost + ":" + xpnport + " (" + xpndesc + ")" ); //New
+ //Also clear Wavelengths && Lambda ranges:
+ cb_pltrec ->clear();
+ le_lrange ->setText("");
+
+
pb_loadXpn ->setEnabled( true );
pb_loadAUC ->setEnabled( true );
pb_details ->setEnabled( false );
@@ -1581,6 +1586,17 @@
msg_data_avail->accept();
//msg_data_avail->close();
//ok_msg_data->click();
+
+ //ALEXEY: make sure ExpID is coupled to the RunID which is already in the autoflow DB
+ if ( !runID_passed.isEmpty() || runID_passed != "NULL" )
+ {
+ if ( runID_passed.toInt() != RunID_to_retrieve.toInt() )
+ {
+ RunID_to_retrieve = runID_passed;
+ qDebug() << "Correcting RunID to : " << RunID_to_retrieve;
+ }
+ }
+
//ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
//Conditional: Do it ONLY once !!!
@@ -1984,7 +2000,7 @@
updateautoflow_record_atLiveUpdate();
//emit experiment_complete_auto( currentDir, ProtocolName, invID_passed, correctRadii ); // Updtade later: what should be passed with signal ??
- reset_auto();
+ //reset_auto();
emit experiment_complete_auto( details_at_live_update );
return;
@@ -2078,6 +2094,9 @@
//Query for Optima DB periodically, see if data available
void US_XpnDataViewer::check_for_data( QMap < QString, QString > & protocol_details)
{
+ //Also reset the panel before reattachement
+ reset_auto();
+
xpn_data->setEtimOffZero(); //ALEXEY: intialize etimoff to zero for the first time
experimentAborted = false;
@@ -2135,7 +2154,7 @@
timer_data_init->stop();
disconnect(timer_data_init, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
- reset_auto();
+ //reset_auto();
emit close_program();
}
@@ -2231,8 +2250,9 @@
timer_end_processes->stop();
disconnect(timer_end_processes, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
-
- reset_auto();
+
+ //ALEXEY: may not be needed
+ //reset_auto();
qDebug() << "LIVE UPDATE panel has been reset!";
qDebug() << "AFTER: " << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
@@ -2547,7 +2567,7 @@
export_auc_auto();
updateautoflow_record_atLiveUpdate();
- reset_auto();
+ //reset_auto();
emit experiment_complete_auto( details_at_live_update );
return;
}
@@ -3963,7 +3983,7 @@
// QMessageBox::information( this, mtitle_complete, message_done );
updateautoflow_record_atLiveUpdate();
- reset_auto();
+ //reset_auto();
in_reload_auto = false;
1
0
Aug. 13, 2019
Author: alexey
Date: 2019-08-13 20:56:22 +0000 (Tue, 13 Aug 2019)
New Revision: 2809
Modified:
trunk/programs/us_com_project/us_com_project_gui.cpp
trunk/programs/us_com_project/us_com_project_gui.h
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
Autoflow: proper closing/resetting lvie_update stage processes when clicking Manage Optima Runs; needs testing
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-13 20:56:22 UTC (rev 2809)
@@ -384,12 +384,16 @@
/*
1. Avaiting for run to be launched ("Back to Managing Optima Runs") -- SET
2. More complex: Back to Managing runs from active LIVE_UPDATE stage -- stop all timers and other processes...
- */
+ */
+
qDebug() << "Jumping from LIVE UPDATE.";
//2. Stop all timers/threads, reset GUI - when stopping fully working LIVE UPDATE
if ( !xpn_viewer_closed_soft )
- emit reset_live_update();
+ {
+ //emit reset_live_update();
+ epanObserv->sdiag->reset_liveupdate_panel_public();
+ }
}
if ( curr_panx == 3 )
Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_com_project/us_com_project_gui.h 2019-08-13 20:56:22 UTC (rev 2809)
@@ -172,9 +172,11 @@
US_ObservGui( QWidget* );
~US_ObservGui() {};
+ US_XpnDataViewer* sdiag;
+
private:
US_ComProjectMain* mainw; // Parent to all panels
- US_XpnDataViewer* sdiag;
+ //US_XpnDataViewer* sdiag;
int offset;
protected:
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp 2019-08-13 20:56:22 UTC (rev 2809)
@@ -244,7 +244,8 @@
in_reload_all_data = false;
in_reload_data_init = false;
in_reload_check_sysdata = false;
-
+ in_reload_end_processes = false;
+
ElapsedTimeOffset = 0;
//ALEXEY: new way
@@ -2141,7 +2142,15 @@
}
}
+
// Reset LIVE UPDATE panel && stop timers && quit threads
+void US_XpnDataViewer::reset_liveupdate_panel_public ( void )
+{
+ reset_liveupdate_panel();
+}
+
+
+// Reset LIVE UPDATE panel && stop timers && quit threads
void US_XpnDataViewer::reset_liveupdate_panel ( void )
{
//Quit sys_thread, emit finished() to stop timer_check_sysdata from withing thread
@@ -2195,17 +2204,44 @@
if ( !timer_data_reload->isActive() )
qDebug() << "QTimer timer_data_reload STOPPED by clickig Manage Optima runs !!! ";
/*************************************/
+
+ qDebug() << "BEFORE: " << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
- reset_auto();
+ //ALEXEY: should wait for execution of all below variables to be false (end of all timer functions) BEFORE reset_all();
+ // Introduce QTimer which checks for all abpve vartibales to be false (check all related functions to always reset them to false on completion)
+ // Put reset_auto() into the timer && and stop/disconnect timer from within connected SLOT.
+ timer_end_processes = new QTimer;
+ connect(timer_end_processes, SIGNAL(timeout()), this, SLOT( end_processes ( ) ));
+ timer_end_processes->start(2000); // 5 sec
+
+ //reset_auto();
+ //qApp->processEvents();
+}
- qDebug() << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
+//to end all existing update processes
+void US_XpnDataViewer::end_processes( void )
+{
+ if ( in_reload_end_processes ) // If already doing a reload,
+ return; // skip starting a new one
- in_reload_auto = false;
- in_reload_all_data = false;
- in_reload_data_init = false;
- in_reload_check_sysdata = false;
+ in_reload_end_processes = true; // Flag in the midst of a reload
- qApp->processEvents();
+ if ( !in_reload_auto && !in_reload_all_data && !in_reload_data_init && !in_reload_check_sysdata )
+ {
+
+ timer_end_processes->stop();
+ disconnect(timer_end_processes, SIGNAL(timeout()), 0, 0); //Disconnect timer from anything
+
+ reset_auto();
+ qDebug() << "LIVE UPDATE panel has been reset!";
+ qDebug() << "AFTER: " << in_reload_auto << ", " << in_reload_all_data << ", " << in_reload_data_init << ", " << in_reload_check_sysdata;
+
+ qApp->processEvents();
+
+ //in_reload_end_processes = false;
+ }
+ else
+ in_reload_end_processes = false;
}
@@ -3928,6 +3964,8 @@
updateautoflow_record_atLiveUpdate();
reset_auto();
+
+ in_reload_auto = false;
//emit experiment_complete_auto( currentDir, ProtocolName, invID_passed, correctRadii ); // Updtade later: what should be passed with signal ??
emit experiment_complete_auto( details_at_live_update );
Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-08-13 20:11:33 UTC (rev 2808)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h 2019-08-13 20:56:22 UTC (rev 2809)
@@ -95,6 +95,8 @@
// New constructor for automated read/upload/update
US_XpnDataViewer(QString auto_mode);
+ void reset_liveupdate_panel_public ( void );
+
private:
bool auto_mode_bool;
@@ -253,6 +255,7 @@
bool in_reload_data_init;
bool in_reload_all_data;
bool in_reload_check_sysdata;
+ bool in_reload_end_processes;
double last_xmin;
@@ -267,6 +270,8 @@
QTimer* timer_all_data_avail;
QTimer* timer_check_sysdata;
+ QTimer* timer_end_processes;
+
QElapsedTimer* elapsed_timer;
QTimer* timer_sys_thread;
@@ -308,6 +313,7 @@
//void retrieve_xpn_raw_auto ( QString & );
void retrieve_xpn_raw_auto ( void );
+ void end_processes ( void );
void reloadData_auto ( void );
int CheckExpComplete_auto( QString & );
void update_autoflow_runId_timeStarted( void );
1
0
Author: gegorbet
Date: 2019-08-13 20:11:33 +0000 (Tue, 13 Aug 2019)
New Revision: 2808
Modified:
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
trunk/programs/us_density_match/us_model_params.cpp
Log:
density_match initial computation code complete and all plots working
Modified: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp 2019-08-12 22:40:23 UTC (rev 2807)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-13 20:11:33 UTC (rev 2808)
@@ -47,12 +47,12 @@
// US_Density_Match class constructor
US_Density_Match::US_Density_Match() : US_Widgets()
{
+ dbg_level = US_Settings::us_debug();
+
// Set up the GUI
-
setWindowTitle( tr( "Density Matching" ) );
setPalette( US_GuiSettings::frameColor() );
-
// Primary layouts
QHBoxLayout* main = new QHBoxLayout( this );
QVBoxLayout* left = new QVBoxLayout();
@@ -64,25 +64,20 @@
spec->setSpacing ( 1 );
spec->setContentsMargins( 0, 0, 0, 0 );
- int s_row = 0;
- dbg_level = US_Settings::us_debug();
-DbgLv(1) << "MD: main: AA";
-// clean_etc_dir();
-
// Top banner
QLabel* lb_info1 = us_banner( tr( "Model Selection Controls" ) );
-
us_checkbox( tr( "Save Plot(s)" ), ck_savepl, false );
us_checkbox( tr( "Local Save Only" ), ck_locsave, true );
+ // Distribution information text box
te_distr_info = us_textedit();
- te_distr_info->setText ( tr( "Run: runID.triple (method)\n" )
+ te_distr_info->setText( tr( "Run: runID.triple (method)\n" )
+ tr( " analysisID" ) );
us_setReadOnly( te_distr_info, true );
+ // X axis radio buttons and button group
plot_x = 0;
-
QLabel* lb_x_axis = us_label( tr( "Plot X:" ) );
bg_x_axis = new QButtonGroup( this );
QGridLayout* gl_x_mass = us_radiobutton( tr( "m.mass" ), rb_x_mass, true );
@@ -97,13 +92,13 @@
bg_x_axis->addButton( rb_x_vbar, ATTR_V );
bg_x_axis->addButton( rb_x_s, ATTR_S );
bg_x_axis->addButton( rb_x_d, ATTR_D );
- rb_x_mass->setChecked( true );
rb_x_mass->setToolTip( tr( "Set X axis to Molar Mass" ) );
rb_x_ff0 ->setToolTip( tr( "Set X axis to Frictional Ratio" ) );
rb_x_rh ->setToolTip( tr( "Set X axis to Hydrodynamic Radius" ) );
rb_x_vbar->setToolTip( tr( "Set X axis to Partial Specific Volume" ) );
rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
rb_x_d ->setToolTip( tr( "Set X axis to Diffusion Coefficient" ) );
+ rb_x_s ->setChecked( true );
connect( bg_x_axis, SIGNAL( buttonReleased( int ) ),
this, SLOT ( select_x_axis ( int ) ) );
@@ -159,6 +154,7 @@
this, SLOT( close() ) );
// Order plot components on the left side
+ int s_row = 0;
spec->addWidget( lb_info1, s_row++, 0, 1, 8 );
spec->addLayout( dkdb_cntrls, s_row++, 0, 1, 8 );
spec->addWidget( le_prefilt, s_row++, 0, 1, 8 );
@@ -257,6 +253,7 @@
reset();
}
+// Reset information: clear prefilter and distributions
void US_Density_Match::reset( void )
{
DbgLv(1) << "MD: reset: AA";
@@ -274,6 +271,7 @@
le_prefilt->setText( tr( "(no prefilter)" ) );
}
+// Save plots and CSV files
void US_Density_Match::save( void )
{
#if 0
@@ -334,7 +332,7 @@
#endif
}
-// plot the data
+// Plot the data
void US_Density_Match::plot_data( void )
{
int syssiz = alldis.size();
@@ -345,7 +343,6 @@
DisSys* tsys = (DisSys*)&alldis.at( 0 );
plot_x = ( plot_x < 0 ) ? plot_x_select() : plot_x;
-
#if 0
auto_sxy=true;
if ( auto_sxy )
@@ -377,6 +374,7 @@
double* yy = v_bfracs.data();
double* xx = v_sedcs[ 0 ].data();
QString curvtitl( "curve" );
+ // Plot title
QString tstr = QString( tsys->run_name ).section( ".", 0, -2 );
DbgLv(1) << "DaPl: (1)tstr" << tstr;
DbgLv(1) << "DaPl: tstr len" << tstr.length();
@@ -389,6 +387,7 @@
tstr += "\n";
DbgLv(1) << "DaPl: (2)tstr" << tstr;
+ // X pointer, curve title, rest of plot title; based on plot type
if ( plot_x == ATTR_S )
{
xx = v_sedcs[ 0 ].data();
@@ -407,7 +406,7 @@
xx = v_vbars.data();
DbgLv(1) << "DaPl: v_vbars" << v_vbars;
curvtitl = tr( "Vbar_curve" );
- tstr += tr( "Specific Density" );
+ tstr += tr( "Partial Specific Density" );
}
else if ( plot_x == ATTR_D )
{
@@ -430,6 +429,7 @@
}
DbgLv(1) << "DaPl: (3)tstr" << tstr;
+ // Initial plot settings
dataPlotClear( data_plot );
data_plot->replot();
data_plot->setTitle( tstr );
@@ -451,8 +451,12 @@
if ( ncurvs == 1 )
{
// Plot a single line
+ data_plot->detachItems( QwtPlotItem::Rtti_PlotLegend, true );
+ QwtLegend *legend = new QwtLegend;
+ data_plot->insertLegend( legend, QwtPlot::BottomLegend );
QColor colr1( Qt::blue );
data_curv = us_curve( data_plot, curvtitl );
+ data_curv->setItemAttribute( QwtPlotItem::Legend, true );
data_curv->setPen ( QPen( QBrush( colr1 ), 3.0, Qt::SolidLine ) );
data_curv->setStyle( QwtPlotCurve::Lines );
@@ -495,6 +499,7 @@
data_plot->replot();
}
+// Plot data based on current plot type index
void US_Density_Match::plot_data( int cplx )
{
plot_x = cplx;
@@ -563,6 +568,7 @@
set_limits();
}
+// Load all the distributions (models)
void US_Density_Match::load_distro()
{
// Get a model description or set of descriptions for distribution data
@@ -582,6 +588,9 @@
need_save = false;
+ te_distr_info->setText(
+ QString( models[ 0 ].description ).section( ".", 0, -4 ) );
+
for ( int jj = 0; jj < models.count(); jj++ )
{ // Load each selected distribution model
load_distro( models[ jj ], mdescs[ jj ] );
@@ -592,15 +601,19 @@
pb_rmvdist->setEnabled( models.count() > 0 );
// Notify user of need to set D2O-percent, label, density model values
- QString qmsg = tr( "%1 models are loaded. In the dialog to follow,\n"
+ QString qmsg = tr( "%1 models are loaded.\n\nIn the dialog to follow,\n"
"you must set D2O Percent values for each,\n"
"then review and set Label and Density values for them.\n"
- "Begin with the model(s) with 0% D2O." )
+ "Begin with the model with 0% D2O." )
.arg( alldis.size() );
QMessageBox::warning( this, tr( "Model Parameters" ), qmsg );
// Set model distributions parameters
set_mparms();
+
+ // Plot S lines for all models
+ rb_x_s->setChecked( true );
+ select_x_axis( ATTR_S );
}
// Create distributions from a loaded model
@@ -630,7 +643,6 @@
.section( '_', 2, 2 );
}
tsys.editGUID = model.editGUID;
- tsys.plot_x = plot_x;
DbgLv(1) << "LD: method" << tsys.method << "mdesc" << mdesc;
if ( tsys.method == "Manual" || tsys.method == "CUSTOMGRID" )
@@ -702,8 +714,8 @@
<< bdens << soluID << tsys.bdensity;
- te_distr_info->setText( tr( "Run: " ) + tsys.run_name
- + " (" + tsys.method + ")\n " + tsys.analys_name );
+// te_distr_info->setText( tr( "Run: " ) + tsys.run_name
+// + " (" + tsys.method + ")\n " + tsys.analys_name );
int nsolmc = model.components.size();
// Read in and set distribution s,k,c,... values
@@ -737,9 +749,9 @@
DbgLv(1) << "LD: totconc" << tot_conc << "nsolin nsolnm" << nsolin << nsolnm;
for ( int jj = 0; jj < nsolnm; jj++ )
{
- sol_nm = wk_distro[ jj ];
- sol_nm.c /= tot_conc;
- tsys.nm_distro << sol_nm;
+ sol_nm = wk_distro[ jj ]; // Solute point
+ sol_nm.c /= tot_conc; // Normalized concentration
+ tsys.nm_distro << sol_nm; // Saved to "normalized" distro
if ( jj<3 || (jj+4)>nsolnm )
DbgLv(1) << "LD: jj" << jj << "soln s,d,c"
<< sol_nm.s << sol_nm.d << sol_nm.c;
@@ -748,16 +760,16 @@
// Create version of distribution with boundary fraction
- tsys.bo_distro.clear();
+ tsys.bo_distro.clear(); // Boundary distro
double sum_co = 0.0;
for ( int jj = 0; jj < nsolnm; jj++ )
{
- sol_nm = tsys.nm_distro[ jj ];
- sum_co += sol_nm.c;
- sol_bf = sol_nm;
- sol_bf.f = sum_co;
- tsys.bo_distro << sol_bf;
+ sol_nm = tsys.nm_distro[ jj ]; // Norm'd solute point
+ sum_co += sol_nm.c; // Concentration integration
+ sol_bf = sol_nm; // Boundary fraction solute point
+ sol_bf.f = sum_co; // With boundary fraction for "f"
+ tsys.bo_distro << sol_bf; // Save to boundary distro
if ( jj<3 || (jj+4)>nsolnm )
DbgLv(1) << "LD: jj" << jj << "solb s,d,c,f"
<< sol_bf.s << sol_bf.d << sol_bf.c << sol_bf.f;
@@ -786,6 +798,16 @@
else
pb_pltall->setText( tr( "Plot All Distros" ) );
#endif
+ pb_refresh->setEnabled( true );
+ pb_reset ->setEnabled( true );
+
+ // Update status text box
+ QString distripl = QString( model.description ).section( ".", -3, -3 );
+DbgLv(1) << "LD: model:" << model.description;
+ QString disdesc = tsys.label;
+ QString disinfo = te_distr_info->toPlainText() + "\n "
+ + distripl + " " + disdesc + tr( " loaded" );
+ te_distr_info->setText( disinfo );
DbgLv(1) << "LD: RETURN";
}
@@ -1029,21 +1051,19 @@
void US_Density_Match::set_mparms( void )
{
qDebug() << "mdlpar:Set Model Parameters";
+ // Open Model Parameters dialog
US_ModelParams mpdiag( alldis, this );
+ // Use parameters returned
if ( mpdiag.exec() == QDialog::Accepted )
{ // Redo text box summarizing models; calculate vectors
- QString dinfo;
QString mdesc = mdescs[ 0 ].section( mdescs[ 0 ].left( 1 ), 1, 1 );
-// int kk = mdesc.indexOf( "-run" );
-// mdesc = ( kk > 0 ) ? QString( mdesc ).mid( ( kk + 1 ) )
-// : mdesc;
mdesc = QString( mdesc ).left( 50 );
- dinfo = tr( "Run:\n " ) + mdesc + "...\n\n"
+ QString dinfo = tr( "Run:\n " ) + mdesc + "...\n\n"
+ tr( " D2O Percent Density Label MDescr.\n" );
for ( int jj = 0; jj < alldis.size(); jj++ )
- {
+ { // Compose and display a distribution line for distro info box
double d2opct = alldis[ jj ].d2opct;
double bdens = alldis[ jj ].bdensity;
QString mlab = alldis[ jj ].label;
@@ -1066,6 +1086,8 @@
void US_Density_Match::select_x_axis( int ival )
{
DbgLv(1) << "sel_x: ival" << ival;
+ plot_x = ival;
+
#if 0
const QString xlabs[] = { "mass", "f/f0", "rh", "vbar", "s" };
const double xvlos[] = { 2e+4, 1.0, 2e+4, 0.60, 1.0 };
@@ -1090,8 +1112,6 @@
const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
#endif
- plot_x = ival;
-
#if 0
lb_plt_smin->setText( tr( "Plot Limit " ) + xlabs[ plot_x ]
+ tr( " Minimum:" ) );
@@ -1108,12 +1128,12 @@
<< xvlos[plot_x] << xvhis[plot_x] << xmins[plot_x] << xmaxs[plot_x]
<< xincs[plot_x];
- build_bf_dists();
- build_bf_vects();
+ build_bf_dists(); // Build the boundary fraction distributions
+ build_bf_vects(); // Build the boundary fraction vectors
// set_limits();
- plot_data();
+ plot_data(); // Plot data
}
// Generate the BF version of the current distribution
@@ -1151,35 +1171,35 @@
// Interpolate values for current output fraction
j1 = j2 - 1;
S_Solute sol_bf = tsys->bo_distro[ j2 ];
- sol_bf.f = bfrac;
+ sol_bf.f = bfrac; // Boundary fraction
double x1 = tsys->bo_distro[ j1 ].f;
double x2 = tsys->bo_distro[ j2 ].f;
double xfrac = ( bfrac - x1 ) / ( x2 - x1 );
double y1 = tsys->bo_distro[ j1 ].s;
double y2 = tsys->bo_distro[ j2 ].s;
- sol_bf.s = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.s = y1 + ( y2 - y1 ) * xfrac; // Interpolated s
y1 = tsys->bo_distro[ j1 ].k;
y2 = tsys->bo_distro[ j2 ].k;
- sol_bf.k = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.k = y1 + ( y2 - y1 ) * xfrac; // Interpolated f/f0
y1 = tsys->bo_distro[ j1 ].c;
y2 = tsys->bo_distro[ j2 ].c;
- sol_bf.c = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.c = y1 + ( y2 - y1 ) * xfrac; // Interpolated concentration
y1 = tsys->bo_distro[ j1 ].w;
y2 = tsys->bo_distro[ j2 ].w;
- sol_bf.w = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.w = y1 + ( y2 - y1 ) * xfrac; // Interpolated wt
y1 = tsys->bo_distro[ j1 ].v;
y2 = tsys->bo_distro[ j2 ].v;
- sol_bf.v = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.v = y1 + ( y2 - y1 ) * xfrac; // Interpolated vbar
y1 = tsys->bo_distro[ j1 ].d;
y2 = tsys->bo_distro[ j2 ].d;
- sol_bf.d = y1 + ( y2 - y1 ) * xfrac;
+ sol_bf.d = y1 + ( y2 - y1 ) * xfrac; // Interpolated D
if (kk<3 || (kk+4)>nsolbf)
DbgLv(1) << "BldBf: kk bfrac" << kk << bfrac << "j1 j2" << j1 << j2
<< "x1 x2 y1 y2" << x1 << x2 << y1 << y2 << "d" << sol_bf.d;
- tsys->bf_distro << sol_bf;
- bfrac += bfincr;
+ tsys->bf_distro << sol_bf; // Solute point at boundary fraction
+ bfrac += bfincr; // Bump to next boundary fraction
}
DbgLv(1) << "BldBf: nsolbo nsolbf" << nsolbo << nsolbf;
@@ -1188,10 +1208,34 @@
// Generate the BF version of all distributions
void US_Density_Match::build_bf_dists()
{
- for ( int jj = 0; jj < alldis.size(); jj++ )
- {
+ bool diff_avg = true;
+ int ndists = alldis.size();
+ for ( int jj = 0; jj < ndists; jj++ )
+ { // Build bfrac distro for each model
build_bf_distro( jj );
}
+
+ if ( diff_avg )
+ { // Replace diffusion coefficients with weight averages
+ int npoints = alldis[ 0 ].bf_distro.size();
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ double dsum = 0.0;
+ double wsum = 0.0;
+ for ( int ii = 0; ii < ndists; ii++ )
+ { // Accumulate (weighted) sum and sum of weights
+// double dwt = alldis[ ii ].bf_distro[ jj ].c;
+ double dwt = 1.0;
+ dsum += ( alldis[ ii ].bf_distro[ jj ].d * dwt );
+ wsum += dwt;
+ }
+ double dval = dsum / wsum; // average diffusion coefficient
+ for ( int ii = 0; ii < ndists; ii++ )
+ { // Propagate to all models
+ alldis[ ii ].bf_distro[ jj ].d = dval;
+ }
+ }
+ }
}
// Generate the BF vectors
@@ -1210,7 +1254,7 @@
v_bfracs.clear();
v_bfracs.reserve( npoints );
for ( int jj = 0; jj < npoints; jj++ )
- {
+ { // Grab each fraction from 1st model's distro
v_bfracs << alldis[ 0 ].bf_distro[ jj ].f;
}
DbgLv(1) << "BldVc: bf 0 1 k n" << v_bfracs[0] << v_bfracs[1]
@@ -1225,7 +1269,7 @@
{
// Save density for each model distribution
double density = alldis[ ii ].bdensity;
- v_dens << density;
+ v_dens << density; // Vector of densities
v_sedcs[ ii ].clear();
v_difcs[ ii ].clear();
v_sedcs[ ii ].reserve( npoints );
@@ -1233,7 +1277,7 @@
// Build vectors of s and D for this model
for ( int jj = 0; jj < npoints; jj++ )
- {
+ { // Build s,D vectors for this model
v_sedcs[ ii ] << alldis[ ii ].bf_distro[ jj ].s;
v_difcs[ ii ] << alldis[ ii ].bf_distro[ jj ].d;
}
@@ -1251,11 +1295,11 @@
{
v_seds.clear();
for ( int ii = 0; ii < ndists; ii++ )
- {
+ { // Build sed coeffs vector across models
v_seds << alldis[ ii ].bf_distro[ jj ].s;
}
- double* xx = v_seds.data();
- double* yy = v_dens.data();
+ double* xx = v_seds.data(); // X is sed coeffs
+ double* yy = v_dens.data(); // Y is densities
double slope, intcept, sigma, corre;
US_Math2::linefit( &xx, &yy, &slope, &intcept, &sigma, &corre, ndists );
// Intercept is density value and vbar is its reciprocal
@@ -1276,23 +1320,63 @@
v_mmass.reserve( npoints );
for ( int jj = 0; jj < npoints; jj++ )
{
+ double sedco = alldis[ 0 ].bf_distro[ jj ].s * 1.0e-13;
+ double difco = alldis[ 0 ].bf_distro[ jj ].d * 1.0e-7;
+ double vbari = v_vbars[ jj ];
+ double mmass = sedco * R_GC * K20 / ( difco * ( 1.0 - vbari * DENS_20W ) );
+ mmass = qAbs( mmass );
+ v_mmass << mmass;
}
+DbgLv(1) << "BldVc: mm 0 1 k n" << v_mmass[0] << v_mmass[1]
+ << v_mmass[npoints-2] << v_mmass[npoints-1];
// Compute hydrodynamic radius values and build the vector
v_hrads.clear();
v_hrads.reserve( npoints );
for ( int jj = 0; jj < npoints; jj++ )
{
+ double difco = alldis[ 0 ].bf_distro[ jj ].d * 1.0e-7;
+ double frico = R_GC * K20 / ( difco * AVOGADRO );
+ double hyrad = frico / ( 6.0 * M_PI * VISC_20W );
+ v_hrads << hyrad;
}
// Compute frictional ratio values and build the vector
+ const double a_third = ( 1.0 / 3.0 );
v_frats.clear();
v_frats.reserve( npoints );
for ( int jj = 0; jj < npoints; jj++ )
{
+ double difco = alldis[ 0 ].bf_distro[ jj ].d * 1.0e-7;
+ double vbari = v_vbars[ jj ];
+ double rzero = pow( ( ( 0.75 / M_PI ) * vbari ), a_third );
+ double frico = R_GC * K20 / ( difco * AVOGADRO );
+ double fzero = 6.0 * M_PI * VISC_20W * rzero;
+ double frrat = frico / fzero;
+ v_frats << frrat;
}
#if 0
+
+*** Mi = si*R*T/(Di_avg*(1-vbari*rho))
+
+i = boundary fraction from 0 to 1
+
+Mi*vbari/N = Volume of moleculei
+
+V=4/3 * pi*r_0^3 (3/(4*pi) *v)^1/3 = r_0
+
+f_0i = 6 * pi * eta * r_0i
+
+fi = RT/(N*Di)
+
+*** fi/f_0i
+
+*** ri = fi/(6 * pi * eta) <-- hydrodynamic radius
+
+*** --> distributions to plot, let user choose which
+#endif
+#if 0
QVector< double > v_bfracs;
QVector< double > v_vbars;
QVector< double > v_mmass;
Modified: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h 2019-08-12 22:40:23 UTC (rev 2807)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-13 20:11:33 UTC (rev 2808)
@@ -24,17 +24,16 @@
QList< S_Solute > nm_distro; // Normalized concentration distro
QList< S_Solute > bo_distro; // Boundary distro w/ orig points
QList< S_Solute > bf_distro; // Boundary fractions distro
- QString run_name;
- QString analys_name;
- QString method;
- QString editGUID;
- QString solutionGUID;
- QString label;
- int distro_type;
- int plot_x;
- int solutionID;
- double d2opct;
- double bdensity;
+ QString run_name; // Distro run name
+ QString analys_name; // Distro analysis name
+ QString method; // Model method (e.g., "2DSA")
+ QString editGUID; // Associated edit GUID
+ QString solutionGUID; // Associated solution GUID
+ QString label; // Distro label (channel description)
+ int distro_type; // Distro type flag
+ int solutionID; // Associated solution db ID
+ double d2opct; // D2O percent for distro
+ double bdensity; // Distro buffer density
} DisSys;
//! \brief Less-than function for sorting distributions
@@ -67,16 +66,11 @@
US_Help showHelp;
QwtCounter* ct_resolu;
- QwtCounter* ct_xreso;
- QwtCounter* ct_yreso;
- QwtCounter* ct_zfloor;
QwtCounter* ct_plt_kmin;
QwtCounter* ct_plt_kmax;
QwtCounter* ct_plt_smin;
QwtCounter* ct_plt_smax;
QwtCounter* ct_plt_dlay;
- QwtCounter* ct_curr_distr;
- QwtCounter* ct_tolerance;
QwtCounter* ct_division;
QwtCounter* ct_smoothing;
QwtCounter* ct_boundaryPct;
@@ -88,8 +82,6 @@
US_Disk_DB_Controls* dkdb_cntrls;
- QPushButton* pb_pltall;
- QPushButton* pb_stopplt;
QPushButton* pb_refresh;
QPushButton* pb_reset;
QPushButton* pb_prefilt;
@@ -118,15 +110,15 @@
QButtonGroup* bg_x_axis;
- QVector< DisSys > alldis;
+ QVector< DisSys > alldis; // All distributions
- QVector< double > v_bfracs;
- QVector< double > v_vbars;
- QVector< double > v_mmass;
- QVector< double > v_hrads;
- QVector< double > v_frats;
- QVector< QVector< double > > v_sedcs;
- QVector< QVector< double > > v_difcs;
+ QVector< double > v_bfracs; // Boundary fraction vector
+ QVector< double > v_vbars; // Vector of vbars per fraction
+ QVector< double > v_mmass; // Vector of molar masses per fraction
+ QVector< double > v_hrads; // Vector of hydro radii per fraction
+ QVector< double > v_frats; // Vector of frict ratios per fraction
+ QVector< QVector< double > > v_sedcs; // Vector of sedi coeff vectors per distro
+ QVector< QVector< double > > v_difcs; // Vector of diff coeff vectors per distro
double resolu;
double plt_smin;
Modified: trunk/programs/us_density_match/us_model_params.cpp
===================================================================
--- trunk/programs/us_density_match/us_model_params.cpp 2019-08-12 22:40:23 UTC (rev 2807)
+++ trunk/programs/us_density_match/us_model_params.cpp 2019-08-13 20:11:33 UTC (rev 2808)
@@ -125,9 +125,9 @@
this, SLOT( compute_densities() ) );
QFont font( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() );
QFontMetrics fm( font );
- int fhigh = fm.lineSpacing();
+// int fhigh = fm.lineSpacing();
+// int lhigh = fhigh * 10 + 12;
int fwide = fm.width( QChar( '6' ) );
- int lhigh = fhigh * 10 + 12;
int lwide = fwide * ( maxdlen + 2 );
adjustSize();
1
0
Author: gegorbet
Date: 2019-08-12 22:40:23 +0000 (Mon, 12 Aug 2019)
New Revision: 2807
Modified:
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
Log:
density_match plotting added
Modified: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp 2019-08-11 22:59:54 UTC (rev 2806)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-12 22:40:23 UTC (rev 2807)
@@ -19,6 +19,7 @@
#include "us_passwd.h"
#include "us_report.h"
#include "us_constants.h"
+#include "qwt_legend.h"
#define DbgLv(a) if(dbg_level>=a)qDebug()
@@ -189,21 +190,27 @@
lb_division->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
ct_division = us_counter( 2, 0, 100, 50 );
- ct_division->setSingleStep( 1 );
- ct_division->setEnabled( true );
- connect( ct_division, SIGNAL( valueChanged( double ) ),
- this, SLOT( update_divis( double ) ) );
ct_boundaryPct = us_counter( 2, 10, 100, 1 );
ct_boundaryPos = us_counter( 2, 0, 100, 1 );
ct_smoothing = us_counter( 2, 1, 100, 1 );
- ct_boundaryPct->setSingleStep( 1 );
- ct_boundaryPos->setSingleStep( 1 );
- ct_smoothing ->setSingleStep( 1 );
+ ct_division ->setSingleStep( 1 );
+// ct_division->setEnabled( true );
+ ct_boundaryPct->setSingleStep( 1 );
+ ct_boundaryPos->setSingleStep( 1 );
+ ct_smoothing ->setSingleStep( 1 );
+ ct_division ->setValue( 50 );
ct_boundaryPct->setValue( 90 );
ct_boundaryPos->setValue( 5 );
ct_smoothing ->setValue( 1 );
+ connect( ct_division, SIGNAL( valueChanged( double ) ),
+ this, SLOT( update_divis( double ) ) );
+ connect( ct_boundaryPct, SIGNAL( valueChanged( double ) ),
+ this, SLOT( update_divis( double ) ) );
+ connect( ct_boundaryPos, SIGNAL( valueChanged( double ) ),
+ this, SLOT( update_divis( double ) ) );
+
spec->addWidget( lb_analysis , s_row++, 0, 1, 8 );
spec->addWidget( lb_division , s_row, 0, 1, 4 );
spec->addWidget( ct_division , s_row++, 4, 1, 4 );
@@ -245,10 +252,6 @@
main->setStretchFactor( plot, 5 );
mfilter = "";
- plt_zmin = 1e+8;
- plt_zmax = -1e+8;
- runsel = true;
- latest = true;
// Set up variables and initial state of GUI
reset();
@@ -263,64 +266,7 @@
need_save = false;
plot_x = ATTR_V;
-// resolu = 90.0;
-// ct_resolu->setRange( 1.0, 100.0 );
-// ct_resolu->setSingleStep( 1.0 );
-// ct_resolu->setValue( resolu );
-#if 0
- xreso = 300.0;
- yreso = 300.0;
- ct_xreso->setRange( 10.0, 1000.0 );
- ct_xreso->setSingleStep( 1.0 );
- ct_xreso->setValue( (double)xreso );
- ct_yreso->setRange( 10.0, 1000.0 );
- ct_yreso->setSingleStep( 1.0 );
- ct_yreso->setValue( (double)yreso );
-
- zfloor = 100.0;
- ct_zfloor->setRange( 50.0, 150.0 );
- ct_zfloor->setSingleStep( 1.0 );
- ct_zfloor->setValue( (double)zfloor );
-
- auto_sxy = true;
- ck_autosxy->setChecked( auto_sxy );
- auto_scz = true;
- ck_autoscz->setChecked( auto_scz );
- cont_loop = false;
- ck_conloop->setChecked( cont_loop );
- ck_savepl ->setChecked( false );
- ck_locsave->setChecked( true );
-
- plt_kmin = 0.8;
- plt_kmax = 4.2;
- ct_plt_kmin->setRange( 0.0, 50.0 );
- ct_plt_kmin->setSingleStep( 0.01 );
- ct_plt_kmin->setValue( plt_kmin );
- ct_plt_kmin->setEnabled( false );
- ct_plt_kmax->setRange( 1.0, 50.0 );
- ct_plt_kmax->setSingleStep( 0.01 );
- ct_plt_kmax->setValue( plt_kmax );
- ct_plt_kmax->setEnabled( false );
-
- plt_smin = 1.0;
- plt_smax = 10.0;
- ct_plt_smin->setRange( -10.0, 10000.0 );
- ct_plt_smin->setSingleStep( 0.01 );
- ct_plt_smin->setValue( plt_smin );
- ct_plt_smin->setEnabled( false );
- ct_plt_smax->setRange( 0.0, 10000.0 );
- ct_plt_smax->setSingleStep( 0.01 );
- ct_plt_smax->setValue( plt_smax );
- ct_plt_smax->setEnabled( false );
-
- curr_distr = 0;
- ct_curr_distr->setRange( 1.0, 1.0 );
- ct_curr_distr->setSingleStep( 1.0 );
- ct_curr_distr->setValue( curr_distr + 1 );
- ct_curr_distr->setEnabled( false );
-#endif
-
alldis.clear();
pfilts.clear();
pb_refresh->setEnabled( false );
@@ -330,102 +276,7 @@
void US_Density_Match::save( void )
{
-}
-
-// plot the data
-void US_Density_Match::plot_data( void )
-{
- int syssiz = alldis.size();
-
- if ( syssiz < 1 )
- return;
-
- if ( curr_distr < 0 || curr_distr >= syssiz )
- { // current distro index somehow out of valid range
- qDebug() << "curr_distr=" << curr_distr
- << " ( sys.size()=" << syssiz << " )";
- syssiz--;
- curr_distr = qBound( curr_distr, 0, syssiz );
- }
-
-// zpcent = ck_zpcent->isChecked();
-
- // Get current distro and (if need be) rebuild BF distro
- DisSys* tsys = (DisSys*)&alldis.at( curr_distr );
- QList< S_Solute >* sol_d = &tsys->in_distro;
-
- build_bf_distro();
-
- QString tstr = tsys->run_name + "\n" + tsys->analys_name
- + "\n" + tsys->method;
- data_plot->setTitle( tstr );
- data_plot->detachItems( QwtPlotItem::Rtti_PlotSpectrogram );
- QColor bg = QColor( Qt::white );
- data_plot->setCanvasBackground( bg );
- int csum = bg.red() + bg.green() + bg.blue();
- pick->setTrackerPen( QPen( csum > 600 ? QColor( Qt::black ) :
- QColor( Qt::white ) ) );
-
- QwtDoubleRect drect;
-
- if ( auto_sxy )
- drect = QwtDoubleRect( 0.0, 0.0, 0.0, 0.0 );
-
- else
- {
- drect = QwtDoubleRect( plt_smin, plt_kmin,
- ( plt_smax - plt_smin ), ( plt_kmax - plt_kmin ) );
- }
-
- plt_zmin = 1e+8;
- plt_zmax = -1e+8;
-
- if ( auto_scz )
- { // Find Z min,max for current distribution
- for ( int jj = 0; jj < sol_d->size(); jj++ )
- {
- double zval = sol_d->at( jj ).c;
- plt_zmin = qMin( plt_zmin, zval );
- plt_zmax = qMax( plt_zmax, zval );
- }
- }
- else
- { // Find Z min,max for all distributions
- for ( int ii = 0; ii < alldis.size(); ii++ )
- {
- DisSys* tsys = (DisSys*)&alldis.at( ii );
- QList< S_Solute >* sol_z = &tsys->in_distro;
-
- for ( int jj = 0; jj < sol_z->size(); jj++ )
- {
- double zval = sol_z->at( jj ).c;
- plt_zmin = qMin( plt_zmin, zval );
- plt_zmax = qMax( plt_zmax, zval );
- }
- }
- }
-
- // Set axis settings
- xa_title = anno_title( plot_x );
- ya_title = anno_title( ATTR_F );
- data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
- data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
-
- if ( auto_sxy )
- { // Auto scale x and y
- data_plot->setAxisAutoScale( QwtPlot::yLeft );
- data_plot->setAxisAutoScale( QwtPlot::xBottom );
- }
- else
- { // Manual limits on x and y
- double lStep = data_plot->axisStepSize( QwtPlot::yLeft );
- double bStep = data_plot->axisStepSize( QwtPlot::xBottom );
- data_plot->setAxisScale( QwtPlot::xBottom, plt_smin, plt_smax, bStep );
- data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax, lStep );
- }
-
- data_plot->replot();
-
+#if 0
//QString dtext = te_distr_info->toPlainText().section( "\n", 0, 1 );
QString dtext = tr( "Run: " ) + tsys->run_name
+ " (" + tsys->method + ")\n " + tsys->analys_name;
@@ -480,12 +331,175 @@
dtext = dtext + tr( "\n(no plot saved)" );
te_distr_info->setText( dtext );
+#endif
+}
+// plot the data
+void US_Density_Match::plot_data( void )
+{
+ int syssiz = alldis.size();
+
+ if ( syssiz < 1 )
+ return;
+
+ DisSys* tsys = (DisSys*)&alldis.at( 0 );
+ plot_x = ( plot_x < 0 ) ? plot_x_select() : plot_x;
+
+
+#if 0
+auto_sxy=true;
+ if ( auto_sxy )
+ { // Auto scale x and y
+ data_plot->setAxisAutoScale( QwtPlot::yLeft );
+ data_plot->setAxisAutoScale( QwtPlot::xBottom );
+ }
+ else
+ { // Manual limits on x and y
+ double lStep = data_plot->axisStepSize( QwtPlot::yLeft );
+ double bStep = data_plot->axisStepSize( QwtPlot::xBottom );
+ data_plot->setAxisScale( QwtPlot::xBottom, plt_smin, plt_smax, bStep );
+ data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax, lStep );
+ }
+#endif
+
+
+#if 0
+ QVector< double > v_bfracs;
+ QVector< double > v_vbars;
+ QVector< double > v_mmass;
+ QVector< double > v_hrads;
+ QVector< double > v_frats;
+ QVector< QVector< double > > v_sedcs;
+ QVector< QVector< double > > v_difcs;
+#endif
+ int npoint = v_bfracs.size();
+ int ncurvs = 1;
+ double* yy = v_bfracs.data();
+ double* xx = v_sedcs[ 0 ].data();
+ QString curvtitl( "curve" );
+ QString tstr = QString( tsys->run_name ).section( ".", 0, -2 );
+DbgLv(1) << "DaPl: (1)tstr" << tstr;
+DbgLv(1) << "DaPl: tstr len" << tstr.length();
+ if ( tstr.length() > 30 )
+ {
+ tstr = QString( tstr ).left( 15 ) + "..." +
+ QString( tstr ).right( 15 ) + "\n";
+ }
+ else
+ tstr += "\n";
+DbgLv(1) << "DaPl: (2)tstr" << tstr;
+
+ if ( plot_x == ATTR_S )
+ {
+ xx = v_sedcs[ 0 ].data();
+ ncurvs = v_sedcs.size();
+ curvtitl = alldis[ 0 ].label;
+ tstr += tr( "Sedimentation Coeffs. per Distribution" );
+ }
+ else if ( plot_x == ATTR_W )
+ {
+ xx = v_mmass.data();
+ curvtitl = tr( "Mmass_curve" );
+ tstr += tr( "Molar Mass" );
+ }
+ else if ( plot_x == ATTR_V )
+ {
+ xx = v_vbars.data();
+DbgLv(1) << "DaPl: v_vbars" << v_vbars;
+ curvtitl = tr( "Vbar_curve" );
+ tstr += tr( "Specific Density" );
+ }
+ else if ( plot_x == ATTR_D )
+ {
+ xx = v_difcs[ 0 ].data();
+ ncurvs = v_difcs.size();
+ curvtitl = alldis[ 0 ].label;
+ tstr += tr( "Diffusion Coeffs. per Distribution" );
+ }
+ else if ( plot_x == ATTR_R )
+ {
+ xx = v_hrads.data();
+ curvtitl = tr( "Rh_curve" );
+ tstr += tr( "Hydrodynamic Radius" );
+ }
+ else if ( plot_x == ATTR_K )
+ {
+ xx = v_frats.data();
+ curvtitl = tr( "Ff0_curve" );
+ tstr += tr( "Frictional Ratio" );
+ }
+DbgLv(1) << "DaPl: (3)tstr" << tstr;
+
+ dataPlotClear( data_plot );
+ data_plot->replot();
+ data_plot->setTitle( tstr );
+ QColor bg = QColor( Qt::white );
+ data_plot->setCanvasBackground( bg );
+ int csum = bg.red() + bg.green() + bg.blue();
+ pick->setTrackerPen( QPen( csum > 600 ? QColor( Qt::black ) :
+ QColor( Qt::white ) ) );
+
+ // Set axis settings
+ xa_title = anno_title( plot_x );
+ ya_title = anno_title( ATTR_F );
+ data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
+ data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
+ QwtPlotCurve* data_curv;
+ data_plot->setAxisAutoScale( QwtPlot::xBottom );
+ data_plot->setAxisScale ( QwtPlot::yLeft, 0.0, 1.0 );
+
+ if ( ncurvs == 1 )
+ {
+ // Plot a single line
+ QColor colr1( Qt::blue );
+ data_curv = us_curve( data_plot, curvtitl );
+ data_curv->setPen ( QPen( QBrush( colr1 ), 3.0, Qt::SolidLine ) );
+ data_curv->setStyle( QwtPlotCurve::Lines );
+
+DbgLv(1) << "DaPl: npoint" << npoint << "xx" << xx[0] << xx[npoint-1]
+ << "yy" << yy[0] << yy[npoint-1];
+ data_curv->setSamples( xx, yy, npoint );
+
+ data_plot->replot();
+ return;
+ }
+
+ // Plot multiple lines, one for each model
+ QFont sfont( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() - 1 );
+ QwtLegend *legend = new QwtLegend;
+ legend->setFrameStyle( QFrame::Box | QFrame::Sunken );
+ legend->setFont( sfont );
+ data_plot->insertLegend( legend, QwtPlot::BottomLegend );
+
+ QColor lncolrs[] = { QColor( Qt::blue ),
+ QColor( Qt::red ),
+ QColor( Qt::green ),
+ QColor( Qt::magenta ),
+ QColor( Qt::cyan ),
+ QColor( Qt::yellow ),
+ QColor( Qt::gray ),
+ QColor( Qt::black )
+ };
+
+ for ( int ii = 0; ii < ncurvs; ii++ )
+ { // Draw each model line
+ curvtitl = alldis[ ii ].label;
+ data_curv = us_curve( data_plot, curvtitl );
+ data_curv->setPen( QPen( QBrush( lncolrs[ ii ] ), 3.0, Qt::SolidLine ) );
+ xx = ( plot_x == ATTR_S ) ? v_sedcs[ ii ].data()
+ : v_difcs[ ii ].data();
+ data_curv->setStyle( QwtPlotCurve::Lines );
+ data_curv->setItemAttribute( QwtPlotItem::Legend, true );
+ data_curv->setSamples( xx, yy, npoint );
+ }
+ data_plot->replot();
}
-void US_Density_Match::plot_data( int )
+void US_Density_Match::plot_data( int cplx )
{
+ plot_x = cplx;
plot_data();
+ plot_x = plot_x_select();
}
void US_Density_Match::update_resolu( double dval )
@@ -775,20 +789,17 @@
DbgLv(1) << "LD: RETURN";
}
-// Start a loop of plotting all distros
-void US_Density_Match::plotall()
+// Determine type of plot currently selected
+int US_Density_Match::plot_x_select()
{
- pb_stopplt->setEnabled( true );
- curr_distr = 0;
- plot_data();
- patm_dlay = qRound( ct_plt_dlay->value() * 1000.0 );
-
- patm_id = startTimer( patm_dlay );
-
- if ( curr_distr == alldis.size() )
- curr_distr--;
-
-// need_save = ck_savepl->isChecked() && !cont_loop;
+ int plotx = ATTR_S;
+ plotx = rb_x_mass->isChecked() ? ATTR_W : plotx;
+ plotx = rb_x_ff0 ->isChecked() ? ATTR_K : plotx;
+ plotx = rb_x_rh ->isChecked() ? ATTR_R : plotx;
+ plotx = rb_x_vbar->isChecked() ? ATTR_V : plotx;
+ plotx = rb_x_s ->isChecked() ? ATTR_S : plotx;
+ plotx = rb_x_d ->isChecked() ? ATTR_D : plotx;
+ return plotx;
}
void US_Density_Match::set_limits()
@@ -1097,59 +1108,201 @@
<< xvlos[plot_x] << xvhis[plot_x] << xmins[plot_x] << xmaxs[plot_x]
<< xincs[plot_x];
- build_bf_distro();
+ build_bf_dists();
+ build_bf_vects();
// set_limits();
plot_data();
}
-// (Re-)generate the BF version of the current distribution
-void US_Density_Match::build_bf_distro()
+// Generate the BF version of the current distribution
+void US_Density_Match::build_bf_distro( int modx )
{
- if ( alldis.size() < 1 )
+ if ( alldis.size() <= modx )
return;
- DisSys* tsys = (DisSys*)&alldis.at( curr_distr );
- if ( tsys->plot_x == plot_x )
- return;
- tsys->nm_distro.clear();
- tsys->plot_x = plot_x;
- double tot_conc = 0.0;
- int nsolin = tsys->in_distro.size();
+ DisSys* tsys = (DisSys*)&alldis.at( modx );
+DbgLv(1) << "BldBf: modx" << modx;
- // Create solute list with specified x,y
- for ( int ii = 0; ii < nsolin; ii++ )
+ tsys->bf_distro.clear();
+ int nsolbo = tsys->bo_distro.size();
+ double bfrac = ct_boundaryPos->value() * 0.01;
+ double bfextn = ct_boundaryPct->value() * 0.01;
+ int ksolbf = (int)( ct_division ->value() );
+ int nsolbf = ksolbf + 1;
+ double bfincr = bfextn / (double)ksolbf;
+DbgLv(1) << "BldBf: bfrac bfextn bfincr" << bfrac << bfextn << bfincr
+ << "nsolbo nsolbf" << nsolbo << nsolbf << (bfextn/bfincr) << ksolbf;
+ int j2 = 1;
+ int j1 = 0;
+
+ // Create solute points with specified boundary fraction extent
+ for ( int kk = 0; kk < nsolbf; kk++ )
{
- S_Solute sol_in = tsys->in_distro[ ii ];
- S_Solute sol_nm = sol_in;
+ while ( j2 < nsolbo )
+ { // Position boundary fraction within input distribution
+ if ( bfrac <= tsys->bo_distro[ j2 ].f ||
+ j2 == ( nsolbo - 1 ) )
+ break;
+ j2++;
+ }
- sol_nm.s = ( plot_x == ATTR_S ) ? sol_in.s : sol_nm.s;
- sol_nm.s = ( plot_x == ATTR_K ) ? sol_in.k : sol_nm.s;
- sol_nm.s = ( plot_x == ATTR_W ) ? sol_in.w : sol_nm.s;
- sol_nm.s = ( plot_x == ATTR_V ) ? sol_in.v : sol_nm.s;
- sol_nm.s = ( plot_x == ATTR_D ) ? sol_in.d : sol_nm.s;
- sol_nm.s = ( plot_x == ATTR_F ) ? sol_in.f : sol_nm.s;
- tot_conc += sol_in.c;
- tsys->nm_distro << sol_nm;
+ // Interpolate values for current output fraction
+ j1 = j2 - 1;
+ S_Solute sol_bf = tsys->bo_distro[ j2 ];
+ sol_bf.f = bfrac;
+ double x1 = tsys->bo_distro[ j1 ].f;
+ double x2 = tsys->bo_distro[ j2 ].f;
+ double xfrac = ( bfrac - x1 ) / ( x2 - x1 );
+ double y1 = tsys->bo_distro[ j1 ].s;
+ double y2 = tsys->bo_distro[ j2 ].s;
+ sol_bf.s = y1 + ( y2 - y1 ) * xfrac;
+ y1 = tsys->bo_distro[ j1 ].k;
+ y2 = tsys->bo_distro[ j2 ].k;
+ sol_bf.k = y1 + ( y2 - y1 ) * xfrac;
+ y1 = tsys->bo_distro[ j1 ].c;
+ y2 = tsys->bo_distro[ j2 ].c;
+ sol_bf.c = y1 + ( y2 - y1 ) * xfrac;
+ y1 = tsys->bo_distro[ j1 ].w;
+ y2 = tsys->bo_distro[ j2 ].w;
+ sol_bf.w = y1 + ( y2 - y1 ) * xfrac;
+ y1 = tsys->bo_distro[ j1 ].v;
+ y2 = tsys->bo_distro[ j2 ].v;
+ sol_bf.v = y1 + ( y2 - y1 ) * xfrac;
+ y1 = tsys->bo_distro[ j1 ].d;
+ y2 = tsys->bo_distro[ j2 ].d;
+ sol_bf.d = y1 + ( y2 - y1 ) * xfrac;
+if (kk<3 || (kk+4)>nsolbf)
+ DbgLv(1) << "BldBf: kk bfrac" << kk << bfrac << "j1 j2" << j1 << j2
+ << "x1 x2 y1 y2" << x1 << x2 << y1 << y2 << "d" << sol_bf.d;
+
+
+ tsys->bf_distro << sol_bf;
+ bfrac += bfincr;
}
- // Sort and possibly reduce XY distro
- sort_distro( tsys->nm_distro, true );
+DbgLv(1) << "BldBf: nsolbo nsolbf" << nsolbo << nsolbf;
+}
- // Create Z-as-percentage version of xy distribution
- int nsolnm = tsys->nm_distro.size();
-DbgLv(1) << "Bld: nsolin nsolnm" << nsolin << nsolnm;
+// Generate the BF version of all distributions
+void US_Density_Match::build_bf_dists()
+{
+ for ( int jj = 0; jj < alldis.size(); jj++ )
+ {
+ build_bf_distro( jj );
+ }
+}
- for ( int ii = 0; ii < nsolnm; ii++ )
+// Generate the BF vectors
+void US_Density_Match::build_bf_vects()
+{
+ int nsmoo = (int)( ct_smoothing->value() );
+DbgLv(1) << "BldVc: nsmoo" << nsmoo;
+ QVector< double > v_dens;
+ QVector< double > v_seds;
+
+ // Build the boundary fractions (x) vector
+ int ndists = alldis.size();
+ if ( ndists < 1 )
+ return;
+ int npoints = alldis[ 0 ].bf_distro.size();
+ v_bfracs.clear();
+ v_bfracs.reserve( npoints );
+ for ( int jj = 0; jj < npoints; jj++ )
{
- S_Solute sol_nm = tsys->nm_distro[ ii ];
- sol_nm.c /= tot_conc;
+ v_bfracs << alldis[ 0 ].bf_distro[ jj ].f;
+ }
+DbgLv(1) << "BldVc: bf 0 1 k n" << v_bfracs[0] << v_bfracs[1]
+ << v_bfracs[npoints-2] << v_bfracs[npoints-1];
- tsys->nm_distro << sol_nm;
+ // Build sedimentation and diffusion vectors for each model
+ v_sedcs.clear();
+ v_sedcs.resize( ndists );
+ v_difcs.clear();
+ v_difcs.resize( ndists );
+ for ( int ii = 0; ii < ndists; ii++ )
+ {
+ // Save density for each model distribution
+ double density = alldis[ ii ].bdensity;
+ v_dens << density;
+ v_sedcs[ ii ].clear();
+ v_difcs[ ii ].clear();
+ v_sedcs[ ii ].reserve( npoints );
+ v_difcs[ ii ].reserve( npoints );
+
+ // Build vectors of s and D for this model
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ v_sedcs[ ii ] << alldis[ ii ].bf_distro[ jj ].s;
+ v_difcs[ ii ] << alldis[ ii ].bf_distro[ jj ].d;
+ }
+DbgLv(1) << "BldVc: ii" << ii << "se 0 1 k n" << v_sedcs[ii][0] << v_sedcs[ii][1]
+ << v_sedcs[ii][npoints-2] << v_sedcs[ii][npoints-1];
+DbgLv(1) << "BldVc: di 0 1 k n" << v_difcs[ii][0] << v_difcs[ii][1]
+ << v_difcs[ii][npoints-2] << v_difcs[ii][npoints-1];
}
+DbgLv(1) << "BldVc: vdens" << v_dens;
+
+ // Build vbars vector by fitting sedc,density across models at each bfrac
+ v_vbars.clear();
+ v_vbars.reserve( npoints );
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ v_seds.clear();
+ for ( int ii = 0; ii < ndists; ii++ )
+ {
+ v_seds << alldis[ ii ].bf_distro[ jj ].s;
+ }
+ double* xx = v_seds.data();
+ double* yy = v_dens.data();
+ double slope, intcept, sigma, corre;
+ US_Math2::linefit( &xx, &yy, &slope, &intcept, &sigma, &corre, ndists );
+ // Intercept is density value and vbar is its reciprocal
+ double vbari = ( intcept > 0.0 ) ? ( 1.0 / intcept ) : 1.0;
+if(jj==0) {
+DbgLv(1) << "BldVc: jj0: seds:" << v_seds;
+DbgLv(1) << "BldVc: jj0: dens:" << v_dens;
+DbgLv(1) << "BldVc: jj0: intcept vbari" << intcept << vbari;
}
+ v_vbars << vbari;
+ }
+DbgLv(1) << "BldVc: vb 0 1 k n" << v_vbars[0] << v_vbars[1]
+ << v_vbars[npoints-2] << v_vbars[npoints-1];
+
+ // Compute molar mass values and build the vector
+ v_mmass.clear();
+ v_mmass.reserve( npoints );
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ }
+
+ // Compute hydrodynamic radius values and build the vector
+ v_hrads.clear();
+ v_hrads.reserve( npoints );
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ }
+
+ // Compute frictional ratio values and build the vector
+ v_frats.clear();
+ v_frats.reserve( npoints );
+ for ( int jj = 0; jj < npoints; jj++ )
+ {
+ }
+
+#if 0
+ QVector< double > v_bfracs;
+ QVector< double > v_vbars;
+ QVector< double > v_mmass;
+ QVector< double > v_hrads;
+ QVector< double > v_frats;
+ QVector< QVector< double > > v_sedcs;
+ QVector< QVector< double > > v_difcs;
+#endif
+}
+
// Set annotation title for a plot index
QString US_Density_Match::anno_title( int pltndx )
{
@@ -1178,5 +1331,7 @@
void US_Density_Match::update_divis( double dval )
{
DbgLv(1) << "UpdDiv:" << dval;
+ build_bf_dists();
+ build_bf_vects();
}
Modified: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h 2019-08-11 22:59:54 UTC (rev 2806)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-12 22:40:23 UTC (rev 2807)
@@ -123,8 +123,8 @@
QVector< double > v_bfracs;
QVector< double > v_vbars;
QVector< double > v_mmass;
+ QVector< double > v_hrads;
QVector< double > v_frats;
- QVector< double > v_hrads;
QVector< QVector< double > > v_sedcs;
QVector< QVector< double > > v_difcs;
@@ -139,11 +139,8 @@
double k_range;
double xreso;
double yreso;
- double zfloor;
int curr_distr;
- int patm_id;
- int patm_dlay;
int dbg_level;
int plot_x;
@@ -180,7 +177,6 @@
void select_prefilt( void );
void load_distro( void );
void load_distro( US_Model, QString );
- void plotall( void );
void reset( void );
void save( void );
void set_limits ( void );
@@ -188,10 +184,13 @@
void remove_distro ( void );
void set_mparms ( void );
void select_x_axis ( int );
- void build_bf_distro( void );
+ void build_bf_distro( int );
+ void build_bf_dists ( void );
+ void build_bf_vects ( void );
+ int plot_x_select ( void );
QString anno_title ( int );
void help ( void )
- { showHelp.show_help( "pseudo3d_combine.html" ); };
+ { showHelp.show_help( "dens_match.html" ); };
};
#endif
1
0
Author: gegorbet
Date: 2019-08-11 22:59:54 +0000 (Sun, 11 Aug 2019)
New Revision: 2806
Added:
trunk/programs/us_density_match/us_model_params.cpp
trunk/programs/us_density_match/us_model_params.h
Modified:
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
trunk/programs/us_density_match/us_density_match.pro
trunk/programs/us_density_match/us_remove_models.cpp
trunk/programs/us_density_match/us_remove_models.h
Log:
more density_match progress, incl new us_model_parms dialog
Modified: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -4,6 +4,7 @@
#include "us_density_match.h"
#include "us_remove_models.h"
+#include "us_model_params.h"
#include "us_select_runs.h"
#include "us_model.h"
#include "us_license_t.h"
@@ -74,16 +75,6 @@
us_checkbox( tr( "Save Plot(s)" ), ck_savepl, false );
us_checkbox( tr( "Local Save Only" ), ck_locsave, true );
-#if 0
- QLabel* lb_curr_distr = us_label( tr( "Current Distro:" ) );
- lb_curr_distr->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
-
- ct_curr_distr = us_counter( 3, 0.0, 10.0, 0.0 );
- ct_curr_distr->setSingleStep( 1 );
- connect( ct_curr_distr, SIGNAL( valueChanged ( double ) ),
- this, SLOT( update_curr_distr( double ) ) );
-#endif
-
te_distr_info = us_textedit();
te_distr_info->setText ( tr( "Run: runID.triple (method)\n" )
+ tr( " analysisID" ) );
@@ -98,17 +89,20 @@
QGridLayout* gl_x_rh = us_radiobutton( tr( "Rh" ), rb_x_rh, false );
QGridLayout* gl_x_vbar = us_radiobutton( tr( "vbar"), rb_x_vbar, false );
QGridLayout* gl_x_s = us_radiobutton( tr( "s" ), rb_x_s, false );
+ QGridLayout* gl_x_d = us_radiobutton( tr( "D" ), rb_x_d, false );
bg_x_axis->addButton( rb_x_mass, ATTR_W );
bg_x_axis->addButton( rb_x_ff0, ATTR_K );
bg_x_axis->addButton( rb_x_rh, ATTR_R );
bg_x_axis->addButton( rb_x_vbar, ATTR_V );
bg_x_axis->addButton( rb_x_s, ATTR_S );
+ bg_x_axis->addButton( rb_x_d, ATTR_D );
rb_x_mass->setChecked( true );
rb_x_mass->setToolTip( tr( "Set X axis to Molar Mass" ) );
rb_x_ff0 ->setToolTip( tr( "Set X axis to Frictional Ratio" ) );
rb_x_rh ->setToolTip( tr( "Set X axis to Hydrodynamic Radius" ) );
rb_x_vbar->setToolTip( tr( "Set X axis to Partial Specific Volume" ) );
rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
+ rb_x_d ->setToolTip( tr( "Set X axis to Diffusion Coefficient" ) );
connect( bg_x_axis, SIGNAL( buttonReleased( int ) ),
this, SLOT ( select_x_axis ( int ) ) );
@@ -143,6 +137,16 @@
connect( pb_rmvdist, SIGNAL( clicked() ),
this, SLOT( remove_distro() ) );
+ pb_mdlpars = us_pushbutton( tr( "Set Model Parameters" ) );
+ pb_mdlpars->setEnabled( true );
+ connect( pb_mdlpars, SIGNAL( clicked() ),
+ this, SLOT( set_mparms() ) );
+
+ pb_save = us_pushbutton( tr( "Save" ) );
+ pb_save ->setEnabled( true );
+ connect( pb_save, SIGNAL( clicked() ),
+ this, SLOT( save() ) );
+
pb_help = us_pushbutton( tr( "Help" ) );
pb_help->setEnabled( true );
connect( pb_help, SIGNAL( clicked() ),
@@ -162,12 +166,15 @@
spec->addWidget( pb_rmvdist, s_row++, 4, 1, 4 );
spec->addWidget( pb_refresh, s_row, 0, 1, 4 );
spec->addWidget( pb_reset, s_row++, 4, 1, 4 );
+ spec->addWidget( pb_mdlpars, s_row, 0, 1, 4 );
+ spec->addWidget( pb_save, s_row++, 4, 1, 4 );
spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
spec->addLayout( gl_x_mass, s_row, 2, 1, 2 );
spec->addLayout( gl_x_ff0, s_row, 4, 1, 2 );
spec->addLayout( gl_x_rh, s_row++, 6, 1, 2 );
spec->addLayout( gl_x_vbar, s_row, 2, 1, 2 );
- spec->addLayout( gl_x_s, s_row++, 4, 1, 2 );
+ spec->addLayout( gl_x_s, s_row, 4, 1, 2 );
+ spec->addLayout( gl_x_d, s_row++, 6, 1, 2 );
spec->addWidget( ck_savepl, s_row, 0, 1, 4 );
spec->addWidget( ck_locsave, s_row++, 4, 1, 4 );
spec->addWidget( te_distr_info, s_row, 0, 2, 8 ); s_row += 2;
@@ -255,7 +262,7 @@
need_save = false;
- plot_x = ATTR_S;
+ plot_x = ATTR_V;
// resolu = 90.0;
// ct_resolu->setRange( 1.0, 100.0 );
// ct_resolu->setSingleStep( 1.0 );
@@ -316,12 +323,15 @@
alldis.clear();
pfilts.clear();
-// pb_pltall ->setEnabled( false );
pb_refresh->setEnabled( false );
pb_rmvdist->setEnabled( false );
le_prefilt->setText( tr( "(no prefilter)" ) );
}
+void US_Density_Match::save( void )
+{
+}
+
// plot the data
void US_Density_Match::plot_data( void )
{
@@ -543,7 +553,6 @@
{
// Get a model description or set of descriptions for distribution data
QList< US_Model > models;
- QStringList mdescs;
bool loadDB = dkdb_cntrls->db();
QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
@@ -568,7 +577,16 @@
need_save = ck_savepl->isChecked() && !cont_loop;
pb_rmvdist->setEnabled( models.count() > 0 );
- update_curr_distr( (double)alldis.size() );
+ // Notify user of need to set D2O-percent, label, density model values
+ QString qmsg = tr( "%1 models are loaded. In the dialog to follow,\n"
+ "you must set D2O Percent values for each,\n"
+ "then review and set Label and Density values for them.\n"
+ "Begin with the model(s) with 0% D2O." )
+ .arg( alldis.size() );
+ QMessageBox::warning( this, tr( "Model Parameters" ), qmsg );
+
+ // Set model distributions parameters
+ set_mparms();
}
// Create distributions from a loaded model
@@ -651,6 +669,8 @@
US_DataIO::loadData( edir, efname, edata );
DbgLv(1) << "LD: edata: desc run cell chan"
<< edata.description << edata.runID << edata.cell << edata.channel;
+ tsys.label = edata.description;
+ tsys.d2opct = -1.0;
// Now, get associated solution,buffer values
QString soluID;
@@ -663,8 +683,9 @@
DbgLv(1) << "LD: solvals CALL";
US_SolutionVals::values( dbP, &edata,
soluID, cvbar20, bdens, bvisc, cmprss, bmanu, errmsg );
-DbgLv(1) << "LD: solval: bdens soluID errmsg"
- << bdens << soluID << errmsg;
+ tsys.bdensity = bdens.toDouble();
+DbgLv(1) << "LD: solval: bdens soluID bdensity"
+ << bdens << soluID << tsys.bdensity;
te_distr_info->setText( tr( "Run: " ) + tsys.run_name
@@ -713,7 +734,7 @@
// Create version of distribution with boundary fraction
- wk_distro.clear();
+ tsys.bo_distro.clear();
double sum_co = 0.0;
for ( int jj = 0; jj < nsolnm; jj++ )
@@ -722,10 +743,10 @@
sum_co += sol_nm.c;
sol_bf = sol_nm;
sol_bf.f = sum_co;
- wk_distro << sol_bf;
+ tsys.bo_distro << sol_bf;
if ( jj<3 || (jj+4)>nsolnm )
DbgLv(1) << "LD: jj" << jj << "solb s,d,c,f"
- << sol_bf.d << sol_bf.d << sol_bf.c << sol_bf.f;
+ << sol_bf.s << sol_bf.d << sol_bf.c << sol_bf.f;
}
// Update current distribution record
@@ -767,7 +788,7 @@
if ( curr_distr == alldis.size() )
curr_distr--;
- need_save = ck_savepl->isChecked() && !cont_loop;
+// need_save = ck_savepl->isChecked() && !cont_loop;
}
void US_Density_Match::set_limits()
@@ -838,10 +859,12 @@
kmax = qFloor( kmax / kinc ) * kinc + kinc;
DbgLv(1) << "SL: setVal kmin kmax" << kmin << kmax;
+#if 0
ct_plt_smin->setValue( smin );
ct_plt_smax->setValue( smax );
ct_plt_kmin->setValue( kmin );
ct_plt_kmax->setValue( kmax );
+#endif
plt_smin = smin;
plt_smax = smax;
@@ -850,10 +873,12 @@
}
else
{
+#if 0
plt_smin = ct_plt_smin->value();
plt_smax = ct_plt_smax->value();
plt_kmin = ct_plt_kmin->value();
plt_kmax = ct_plt_kmax->value();
+#endif
}
DbgLv(1) << "SL: plt_smin _smax _kmin _kmax" << plt_smin << plt_smax
<< plt_kmin << plt_kmax;
@@ -967,7 +992,7 @@
// Remove distribution(s) from the models list
void US_Density_Match::remove_distro( void )
{
-qDebug() << "Remove Distros";
+qDebug() << "rmvdis:Remove Distros";
US_RemoveModels rmvd( alldis );
if ( rmvd.exec() == QDialog::Accepted )
@@ -981,15 +1006,51 @@
}
curr_distr = 0;
- ct_curr_distr->setRange( 1, jd );
- ct_curr_distr->setSingleStep( 1.0 );
- ct_curr_distr->setValue( 1 );
- ct_curr_distr->setEnabled( true );
+qDebug() << "rmvdis:Accepted";
}
+qDebug() << "rmvdis:plot_data";
plot_data();
+qDebug() << "rmvdis:DONE";
}
+// Set/modify model distribution parameters
+void US_Density_Match::set_mparms( void )
+{
+qDebug() << "mdlpar:Set Model Parameters";
+ US_ModelParams mpdiag( alldis, this );
+
+ if ( mpdiag.exec() == QDialog::Accepted )
+ { // Redo text box summarizing models; calculate vectors
+ QString dinfo;
+ QString mdesc = mdescs[ 0 ].section( mdescs[ 0 ].left( 1 ), 1, 1 );
+// int kk = mdesc.indexOf( "-run" );
+// mdesc = ( kk > 0 ) ? QString( mdesc ).mid( ( kk + 1 ) )
+// : mdesc;
+ mdesc = QString( mdesc ).left( 50 );
+ dinfo = tr( "Run:\n " ) + mdesc + "...\n\n"
+ + tr( " D2O Percent Density Label MDescr.\n" );
+
+ for ( int jj = 0; jj < alldis.size(); jj++ )
+ {
+ double d2opct = alldis[ jj ].d2opct;
+ double bdens = alldis[ jj ].bdensity;
+ QString mlab = alldis[ jj ].label;
+ mdesc = mdescs[ jj ].section( mdescs[ jj ].left( 1 ), 1, 1 );
+ mdesc = alldis[ jj ].run_name;
+ int kk = mdesc.indexOf( "-run" );
+ mdesc = ( kk > 0 )
+ ? "..." + QString( mdesc ).mid( ( kk + 1 ), 20 )
+ + "..."
+ : mdesc;
+ dinfo += QString().sprintf( "%.1f %f ", d2opct, bdens )
+ + mlab + " " + mdesc + "\n";
+ }
+
+ te_distr_info->setText( dinfo );
+ }
+}
+
// Select coordinate for horizontal axis
void US_Density_Match::select_x_axis( int ival )
{
@@ -1038,7 +1099,7 @@
build_bf_distro();
- set_limits();
+// set_limits();
plot_data();
}
Modified: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -6,24 +6,23 @@
#include "us_help.h"
#include "us_editor.h"
#include "us_model_loader.h"
+#include "us_solute.h"
+#include "us_spectrodata.h"
#include "us_plot.h"
-#include "us_colorgradIO.h"
-#include "us_spectrodata.h"
#include "qwt_plot_marker.h"
-#include "qwt_plot_spectrogram.h"
#include "qwt_plot_layout.h"
#include "qwt_plot_zoomer.h"
#include "qwt_plot_panner.h"
#include "qwt_scale_widget.h"
#include "qwt_scale_draw.h"
-#include "qwt_color_map.h"
//!< \brief Distribution structure
typedef struct distro_sys
{
QList< S_Solute > in_distro; // Raw input distribution
QList< S_Solute > nm_distro; // Normalized concentration distro
+ QList< S_Solute > bo_distro; // Boundary distro w/ orig points
QList< S_Solute > bf_distro; // Boundary fractions distro
QString run_name;
QString analys_name;
@@ -35,6 +34,7 @@
int plot_x;
int solutionID;
double d2opct;
+ double bdensity;
} DisSys;
//! \brief Less-than function for sorting distributions
@@ -97,6 +97,8 @@
QPushButton* pb_help;
QPushButton* pb_close;
QPushButton* pb_rmvdist;
+ QPushButton* pb_mdlpars;
+ QPushButton* pb_save;
QCheckBox* ck_autosxy;
QCheckBox* ck_autoscz;
@@ -112,11 +114,20 @@
QRadioButton* rb_x_rh;
QRadioButton* rb_x_vbar;
QRadioButton* rb_x_s;
+ QRadioButton* rb_x_d;
QButtonGroup* bg_x_axis;
- QList< DisSys > alldis;
+ QVector< DisSys > alldis;
+ QVector< double > v_bfracs;
+ QVector< double > v_vbars;
+ QVector< double > v_mmass;
+ QVector< double > v_frats;
+ QVector< double > v_hrads;
+ QVector< QVector< double > > v_sedcs;
+ QVector< QVector< double > > v_difcs;
+
double resolu;
double plt_smin;
double plt_smax;
@@ -148,6 +159,7 @@
QString mfilter;
QStringList pfilts;
+ QStringList mdescs;
private slots:
@@ -168,12 +180,14 @@
void select_prefilt( void );
void load_distro( void );
void load_distro( US_Model, QString );
- void plotall( void );
- void reset( void );
- void set_limits( void );
- void sort_distro( QList< S_Solute >&, bool );
- void remove_distro( void );
- void select_x_axis( int );
+ void plotall( void );
+ void reset( void );
+ void save( void );
+ void set_limits ( void );
+ void sort_distro ( QList< S_Solute >&, bool );
+ void remove_distro ( void );
+ void set_mparms ( void );
+ void select_x_axis ( int );
void build_bf_distro( void );
QString anno_title ( int );
Modified: trunk/programs/us_density_match/us_density_match.pro
===================================================================
--- trunk/programs/us_density_match/us_density_match.pro 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_density_match.pro 2019-08-11 22:59:54 UTC (rev 2806)
@@ -5,8 +5,10 @@
TARGET = us_density_match
HEADERS = us_density_match.h \
- us_remove_models.h
+ us_remove_models.h \
+ us_model_params.h
SOURCES = us_density_match.cpp \
- us_remove_models.cpp
+ us_remove_models.cpp \
+ us_model_params.cpp
Added: trunk/programs/us_density_match/us_model_params.cpp
===================================================================
--- trunk/programs/us_density_match/us_model_params.cpp (rev 0)
+++ trunk/programs/us_density_match/us_model_params.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -0,0 +1,273 @@
+//! \file us_model_params.cpp
+
+#include "us_model_params.h"
+#include "us_gui_settings.h"
+
+// Constructor: remove-distributions dialog widget
+US_ModelParams::US_ModelParams( QVector< DisSys >& adistros,
+ QWidget* p ) : US_WidgetsDialog( p, 0 ), distros( adistros )
+{
+ setObjectName( "US_ModelParams" );
+ setPalette( US_GuiSettings::frameColor() );
+ setFont( QFont( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() ) );
+
+ // Lay out the GUI
+ setWindowTitle( tr( "Distribution Parameters" ) );
+
+ mainLayout = new QGridLayout( this );
+
+ mainLayout->setSpacing ( 2 );
+ mainLayout->setContentsMargins( 2, 2, 2, 2 );
+
+ QLabel* lb_mtitle = us_banner( tr( "Modify Model D2O Percent, Density,"
+ " Label" ) );
+
+ pb_help = us_pushbutton( tr( "Help" ) );
+ pb_cancel = us_pushbutton( tr( "Cancel" ) );
+ pb_accept = us_pushbutton( tr( "Accept" ) );
+ pb_compute = us_pushbutton( tr( "Compute Densities" ) );
+
+
+ // Build lists of model parameters
+ nd_orig = distros.count();
+ int maxdlen = 0;
+
+ for ( int jj = 0; jj < nd_orig; jj++ )
+ {
+ QString runid = distros[ jj ].run_name;
+ QString analy = distros[ jj ].analys_name;
+ QString method = distros[ jj ].method;
+ QString mlabel = distros[ jj ].label;
+ QString edid = analy.section( "_", 0, -4 );
+ QString anid = analy.section( "_", -3, -3 );
+ QString iter = analy.section( "_", -2, -1 );
+ QString mdesc = runid + "." + edid + "_" + anid + "_" + method
+ + "_" + iter;
+
+ mdescrs << mdesc;
+ d2opcts << distros[ jj ].d2opct;
+ bdensts << distros[ jj ].bdensity;
+ modelids << tr( "Model %1" ).arg( ( jj + 1 ) );
+ mlabels << mlabel;
+// labels << QLabel( mlabel );
+
+ maxdlen = qMax( maxdlen, mdesc.length() );
+ }
+
+ // Fill in the bulk of GUI elements, including model table
+ int row = 0;
+ mainLayout ->addWidget( lb_mtitle, row++, 0, 1, 8 );
+ row += 9;
+ QLabel* lb_hdr1 = us_banner( tr( "Model ndx" ) );
+ QLabel* lb_hdr2 = us_banner( tr( "D2O Percent" ) );
+ QLabel* lb_hdr3 = us_banner( tr( "Density (g/l)" ) );
+ QLabel* lb_hdr4 = us_banner( tr( "Label" ) );
+ QLabel* lb_hdr5 = us_banner( tr( "Description" ) );
+ mainLayout->addWidget( lb_hdr1, row, 0, 1, 1 );
+ mainLayout->addWidget( lb_hdr2, row, 1, 1, 1 );
+ mainLayout->addWidget( lb_hdr3, row, 2, 1, 1 );
+ mainLayout->addWidget( lb_hdr4, row, 3, 1, 2 );
+ mainLayout->addWidget( lb_hdr5, row++, 5, 1, 3 );
+ for ( int jj = 0; jj < nd_orig; jj++ )
+ {
+ QString modelid = modelids[ jj ];
+ double d2opc = d2opcts[ jj ];
+ double bdens = bdensts[ jj ];
+ QString sd2opc = ( d2opc < 0.0 ) ? "" : QString::number( d2opc );
+ QString sbdens = QString::number( bdens );
+ QString mlabel = mlabels [ jj ];
+ QString mdesc = mdescrs [ jj ];
+ int kk = mdesc.indexOf( "-run" );
+ mdesc = ( kk > 0 ) ? QString( mdesc ).mid( ( kk + 1 ) )
+ : mdesc;
+
+ QLabel* lb_mdli = us_label ( modelid );
+ QLineEdit* le_d2op = us_lineedit( sd2opc );
+ QLineEdit* le_dens = us_lineedit( sbdens );
+ QLineEdit* le_mlab = us_lineedit( mlabel );
+ QLineEdit* le_mdsc = us_lineedit( mdesc );
+ us_setReadOnly( le_mdsc, true );
+
+ QString rowx = QString::number( jj );
+ le_d2op->setObjectName( "D2OP:" + rowx );
+ le_dens->setObjectName( "DENS:" + rowx );
+ le_mlab->setObjectName( "MLAB:" + rowx );
+
+ mainLayout->addWidget( lb_mdli, row, 0, 1, 1 );
+ mainLayout->addWidget( le_d2op, row, 1, 1, 1 );
+ mainLayout->addWidget( le_dens, row, 2, 1, 1 );
+ mainLayout->addWidget( le_mlab, row, 3, 1, 2 );
+ mainLayout->addWidget( le_mdsc, row++, 5, 1, 3 );
+ }
+
+ mainLayout ->addWidget( pb_help, row, 0, 1, 1 );
+ mainLayout ->addWidget( pb_cancel, row, 1, 1, 2 );
+ mainLayout ->addWidget( pb_accept, row, 3, 1, 2 );
+ mainLayout ->addWidget( pb_compute, row++, 6, 1, 3 );
+ row += 2;
+
+ mainLayout->setColumnStretch( 0, 2 );
+ mainLayout->setColumnStretch( 1, 2 );
+ mainLayout->setColumnStretch( 2, 2 );
+ mainLayout->setColumnStretch( 3, 3 );
+ mainLayout->setColumnStretch( 4, 3 );
+ mainLayout->setColumnStretch( 5, 4 );
+ mainLayout->setColumnStretch( 6, 4 );
+ mainLayout->setColumnStretch( 7, 4 );
+
+ connect( pb_help, SIGNAL( clicked() ),
+ this, SLOT( help() ) );
+ connect( pb_cancel, SIGNAL( clicked() ),
+ this, SLOT( canceled() ) );
+ connect( pb_accept, SIGNAL( clicked() ),
+ this, SLOT( accepted() ) );
+ connect( pb_compute, SIGNAL( clicked() ),
+ this, SLOT( compute_densities() ) );
+ QFont font( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() );
+ QFontMetrics fm( font );
+ int fhigh = fm.lineSpacing();
+ int fwide = fm.width( QChar( '6' ) );
+ int lhigh = fhigh * 10 + 12;
+ int lwide = fwide * ( maxdlen + 2 );
+
+ adjustSize();
+ int wwide = qMax( 500, lwide );
+ int whigh = size().height();
+ resize( wwide, whigh );
+ qApp->processEvents();
+}
+
+// Private slot to react to a change in selections
+void US_ModelParams::d2opctChanged( int sel )
+{
+DbgLv(1) << "d2opctChanged: sel" << sel;
+ bool can_accept = false;
+ // Enable buttons according to the present state of selection/removal
+ pb_accept ->setEnabled( can_accept );
+}
+
+// Private slot to react to a change in selections
+void US_ModelParams::labelChanged( int sel )
+{
+DbgLv(1) << "labelChanged: sel" << sel;
+}
+
+
+// Private slot to do the actual removal of distributions and close
+void US_ModelParams::accepted()
+{
+DbgLv(1) << "accepted";
+#if 0
+ if ( nd_selected > 0 )
+ { // Accept attempt with selections and no Remove clicked
+ if ( QMessageBox::Yes == QMessageBox::warning( this,
+ tr( "Outstanding Selections" ),
+ tr( "You have selected distributions,\n"
+ "but did not click on the Remove button.\n"
+ "Do you want to remove the selected distributions?" ),
+ QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes ) )
+ { // If "Yes" to above, add current selections to the remove list
+ remove();
+ }
+ }
+
+ for ( int jj = nd_orig - 1; jj >= 0; jj-- )
+ { // Remove all entries in the original that are not in the current list
+ QString mdesc = mdesc_orig[ jj ];
+
+ if ( ! mdesc_list.contains( mdesc ) )
+ { // This original list item is to be removed from the passed list
+ distros.removeAt( jj );
+ }
+ }
+#endif
+
+ QList< QObject* > ochilds = this->children();
+DbgLv(1) << " acc: ochilds size" << ochilds.size();
+ for ( int jj = 0; jj < ochilds.size(); jj++ )
+ {
+ QObject* ochild = ochilds[ jj ];
+ QLineEdit* lned = (QLineEdit*) ochild;
+ QString cname = ochild->objectName();
+ QString pname = cname.section( ":", 0, 0 );
+ int rowx = cname.section( ":", 1, 1 ).toInt();
+ if ( pname == "D2OP" )
+ {
+ distros[ rowx ].d2opct = lned->text().toDouble();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text().toDouble();
+ }
+ else if ( pname == "DENS" )
+ {
+ distros[ rowx ].bdensity = lned->text().toDouble();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text().toDouble();
+ }
+ else if ( pname == "MLAB" )
+ {
+ distros[ rowx ].label = lned->text();
+DbgLv(1) << " acc: jj rowx" << jj << rowx << "pname value" << pname
+ << lned->text();
+ }
+ }
+
+ accept();
+}
+
+// Private slot to do the actual removal of distributions and close
+void US_ModelParams::canceled()
+{
+DbgLv(1) << "canceled";
+ reject();
+}
+
+void US_ModelParams::compute_densities()
+{
+ const double dnslope = 0.00108766;
+ QList< QObject* > ochilds = this->children();
+ int nzd2pc = 0;
+ int npd2pc = 0;
+ bool misspc = false;
+ double d2opct = -1.0;
+ double denszpc = 0.0;
+ double density = 0.0;
+DbgLv(1) << " cdn: ochilds size" << ochilds.size();
+ for ( int jj = 0; jj < ochilds.size(); jj++ )
+ {
+ QObject* ochild = ochilds[ jj ];
+ QLineEdit* lned = (QLineEdit*) ochild;
+ QString cname = ochild->objectName();
+ QString pname = cname.section( ":", 0, 0 );
+ if ( pname == "D2OP" )
+ {
+ d2opct = lned->text().toDouble();
+ if ( d2opct == 0.0 )
+ {
+ nzd2pc++;
+ if ( npd2pc > 0 )
+ misspc = true;
+ }
+ else
+ {
+ npd2pc++;
+ if ( nzd2pc == 0 )
+ misspc = true;
+ }
+ }
+ else if ( pname == "DENS" )
+ {
+ density = lned->text().toDouble();
+ if ( d2opct == 0.0 )
+ {
+ denszpc = density;
+ }
+ else
+ {
+ density = denszpc + d2opct * dnslope;
+ lned->setText( QString::number( density ) );
+ }
+ }
+ }
+DbgLv(1) << " cdn: misspc" << misspc;
+}
+
Property changes on: trunk/programs/us_density_match/us_model_params.cpp
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_model_params.h
===================================================================
--- trunk/programs/us_density_match/us_model_params.h (rev 0)
+++ trunk/programs/us_density_match/us_model_params.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -0,0 +1,59 @@
+//! \file us_model_params.h
+#ifndef US_MDLPARAM_H
+#define US_MDLPARAM_H
+
+#include "us_extern.h"
+#include "us_widgets_dialog.h"
+#include "us_density_match.h"
+#include "us_help.h"
+
+//! \brief A class to provide a window for setting parameters for each model
+
+class US_ModelParams : public US_WidgetsDialog
+{
+ Q_OBJECT
+
+ public:
+ //! \brief US_ModelParams constructor
+ //! \param adistros Pointer to model distributions list
+ //! \param p Pointer to the parent of this widget
+ US_ModelParams( QVector< DisSys >&, QWidget* p = 0 );
+
+ private:
+ QVector< DisSys >& distros; // Reference to model distributions vector
+
+ int nd_orig; // Number of distributions in original
+ int dbg_level;
+
+ QGridLayout* mainLayout; //
+
+ QList< QLabel* > labels;
+ QList< double > d2opcts;
+ QList< double > bdensts;
+ QStringList modelids;
+ QStringList mlabels;
+ QStringList mdescrs;
+
+ QStringList mdesc_orig; // List of descriptions from original
+ QStringList mdesc_list; // List of descriptions now listed
+
+ QPushButton* pb_help; // Help button
+ QPushButton* pb_cancel; // Cancel button
+ QPushButton* pb_accept; // Accept button
+ QPushButton* pb_compute; // Compute button
+
+ protected:
+ US_Help showHelp;
+
+ private slots:
+
+ void d2opctChanged ( int );
+ void labelChanged ( int );
+ void canceled ( void );
+ void accepted ( void );
+ void compute_densities( void );
+ void help ( void )
+ { showHelp.show_help( "dens_match_mparam.html" ); };
+};
+#endif
+
Property changes on: trunk/programs/us_density_match/us_model_params.h
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Modified: trunk/programs/us_density_match/us_remove_models.cpp
===================================================================
--- trunk/programs/us_density_match/us_remove_models.cpp 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_remove_models.cpp 2019-08-11 22:59:54 UTC (rev 2806)
@@ -4,7 +4,7 @@
#include "us_gui_settings.h"
// Constructor: remove-distributions dialog widget
-US_RemoveModels::US_RemoveModels( QList< DisSys >& adistros,
+US_RemoveModels::US_RemoveModels( QVector< DisSys >& adistros,
QWidget* p ) : US_WidgetsDialog( p, 0 ), distros( adistros )
{
setObjectName( "US_RemoveModels" );
Modified: trunk/programs/us_density_match/us_remove_models.h
===================================================================
--- trunk/programs/us_density_match/us_remove_models.h 2019-08-10 17:37:42 UTC (rev 2805)
+++ trunk/programs/us_density_match/us_remove_models.h 2019-08-11 22:59:54 UTC (rev 2806)
@@ -19,10 +19,10 @@
//! \brief US_RemoveModels constructor
//! \param adistros Pointer to model distributions list
//! \param p Pointer to the parent of this widget
- US_RemoveModels( QList< DisSys >&, QWidget* p = 0 );
+ US_RemoveModels( QVector< DisSys >&, QWidget* p = 0 );
private:
- QList< DisSys >& distros; // Reference to model distributions list
+ QVector< DisSys >& distros; // Reference to model distributions vector
int nd_orig; // Number of distributions in original
int nd_removed; // Number of total distributions removed
1
0
Author: gegorbet
Date: 2019-08-10 17:37:42 +0000 (Sat, 10 Aug 2019)
New Revision: 2805
Modified:
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
Log:
some progress in functionality for new us_density_match
Modified: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp 2019-08-08 01:00:11 UTC (rev 2804)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-10 17:37:42 UTC (rev 2805)
@@ -8,6 +8,7 @@
#include "us_model.h"
#include "us_license_t.h"
#include "us_license.h"
+#include "us_solution_vals.h"
#include "us_settings.h"
#include "us_gui_settings.h"
#include "us_gui_util.h"
@@ -17,15 +18,9 @@
#include "us_passwd.h"
#include "us_report.h"
#include "us_constants.h"
+
#define DbgLv(a) if(dbg_level>=a)qDebug()
-#if QT_VERSION < 0x050000
-#define setSamples(a,b,c) setData(a,b,c)
-#define setMinimum(a) setMinValue(a)
-#define setMaximum(a) setMaxValue(a)
-#endif
-#define PA_TMDIS_MS 0 // default Plotall time per distro in milliseconds
-
// main program
int main( int argc, char* argv[] )
{
@@ -42,21 +37,21 @@
// qSort LessThan method for S_Solute sort
bool distro_lessthan( const S_Solute &solu1, const S_Solute &solu2 )
-{ // TRUE iff (s1<s2) || (s1==s2 && k1<k2)
+{ // TRUE iff (s1<s2) || (s1==s2 && d1<d2)
return ( solu1.s < solu2.s ) ||
- ( ( solu1.s == solu2.s ) && ( solu1.k < solu2.k ) );
+ ( ( solu1.s == solu2.s ) && ( solu1.d < solu2.d ) );
}
// US_Density_Match class constructor
US_Density_Match::US_Density_Match() : US_Widgets()
{
- // set up the GUI
+ // Set up the GUI
setWindowTitle( tr( "Density Matching" ) );
setPalette( US_GuiSettings::frameColor() );
- // primary layouts
+ // Primary layouts
QHBoxLayout* main = new QHBoxLayout( this );
QVBoxLayout* left = new QVBoxLayout();
QGridLayout* spec = new QGridLayout();
@@ -70,7 +65,7 @@
int s_row = 0;
dbg_level = US_Settings::us_debug();
DbgLv(1) << "MD: main: AA";
- clean_etc_dir();
+// clean_etc_dir();
// Top banner
QLabel* lb_info1 = us_banner( tr( "Model Selection Controls" ) );
@@ -94,62 +89,28 @@
+ tr( " analysisID" ) );
us_setReadOnly( te_distr_info, true );
-// le_cmap_name = us_lineedit(
-// tr( "Default Color Map: w-cyan-magenta-red-black" ), -1, true );
-// te_distr_info->setMaximumHeight( le_cmap_name->height() * 2 );
+ plot_x = 0;
- plot_x = 0;
- plot_y = 1;
-#if 0
QLabel* lb_x_axis = us_label( tr( "Plot X:" ) );
- QLabel* lb_y_axis = us_label( tr( "Plot Y:" ) );
bg_x_axis = new QButtonGroup( this );
- bg_y_axis = new QButtonGroup( this );
- QGridLayout* gl_x_s = us_radiobutton( tr( "s" ), rb_x_s, true );
+ QGridLayout* gl_x_mass = us_radiobutton( tr( "m.mass" ), rb_x_mass, true );
QGridLayout* gl_x_ff0 = us_radiobutton( tr( "ff0" ), rb_x_ff0, false );
- QGridLayout* gl_x_mw = us_radiobutton( tr( "mw" ), rb_x_mw, false );
+ QGridLayout* gl_x_rh = us_radiobutton( tr( "Rh" ), rb_x_rh, false );
QGridLayout* gl_x_vbar = us_radiobutton( tr( "vbar"), rb_x_vbar, false );
- QGridLayout* gl_x_D = us_radiobutton( tr( "D" ), rb_x_D, false );
- QGridLayout* gl_x_f = us_radiobutton( tr( "f" ), rb_x_f, false );
- QGridLayout* gl_y_s = us_radiobutton( tr( "s" ), rb_y_s, false );
- QGridLayout* gl_y_ff0 = us_radiobutton( tr( "ff0" ), rb_y_ff0, true );
- QGridLayout* gl_y_mw = us_radiobutton( tr( "mw" ), rb_y_mw, false );
- QGridLayout* gl_y_vbar = us_radiobutton( tr( "vbar"), rb_y_vbar, false );
- QGridLayout* gl_y_D = us_radiobutton( tr( "D" ), rb_y_D, false );
- QGridLayout* gl_y_f = us_radiobutton( tr( "f" ), rb_y_f, false );
- bg_x_axis->addButton( rb_x_s, ATTR_S );
+ QGridLayout* gl_x_s = us_radiobutton( tr( "s" ), rb_x_s, false );
+ bg_x_axis->addButton( rb_x_mass, ATTR_W );
bg_x_axis->addButton( rb_x_ff0, ATTR_K );
- bg_x_axis->addButton( rb_x_mw, ATTR_W );
+ bg_x_axis->addButton( rb_x_rh, ATTR_R );
bg_x_axis->addButton( rb_x_vbar, ATTR_V );
- bg_x_axis->addButton( rb_x_D, ATTR_D );
- bg_x_axis->addButton( rb_x_f, ATTR_F );
- bg_y_axis->addButton( rb_y_s, ATTR_S );
- bg_y_axis->addButton( rb_y_ff0, ATTR_K );
- bg_y_axis->addButton( rb_y_mw, ATTR_W );
- bg_y_axis->addButton( rb_y_vbar, ATTR_V );
- bg_y_axis->addButton( rb_y_D, ATTR_D );
- bg_y_axis->addButton( rb_y_f, ATTR_F );
- rb_x_s ->setChecked( true );
- rb_y_s ->setEnabled( false );
- rb_y_ff0 ->setChecked( true );
- rb_x_ff0 ->setEnabled( false );
- rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
+ bg_x_axis->addButton( rb_x_s, ATTR_S );
+ rb_x_mass->setChecked( true );
+ rb_x_mass->setToolTip( tr( "Set X axis to Molar Mass" ) );
rb_x_ff0 ->setToolTip( tr( "Set X axis to Frictional Ratio" ) );
- rb_x_mw ->setToolTip( tr( "Set X axis to Molecular Weight" ) );
+ rb_x_rh ->setToolTip( tr( "Set X axis to Hydrodynamic Radius" ) );
rb_x_vbar->setToolTip( tr( "Set X axis to Partial Specific Volume" ) );
- rb_x_D ->setToolTip( tr( "Set X axis to Diffusion Coefficient" ) );
- rb_x_f ->setToolTip( tr( "Set X axis to Frictional Coefficient" ) );
- rb_y_s ->setToolTip( tr( "Set Y axis to Sedimentation Coefficient" ) );
- rb_y_ff0 ->setToolTip( tr( "Set Y axis to Frictional Ratio" ) );
- rb_y_mw ->setToolTip( tr( "Set Y axis to Molecular Weight" ) );
- rb_y_vbar->setToolTip( tr( "Set Y axis to Partial Specific Volume" ) );
- rb_y_D ->setToolTip( tr( "Set Y axis to Diffusion Coefficient" ) );
- rb_y_f ->setToolTip( tr( "Set Y axis to Frictional Coefficient" ) );
+ rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
connect( bg_x_axis, SIGNAL( buttonReleased( int ) ),
this, SLOT ( select_x_axis ( int ) ) );
- connect( bg_y_axis, SIGNAL( buttonReleased( int ) ),
- this, SLOT ( select_y_axis ( int ) ) );
-#endif
pb_refresh = us_pushbutton( tr( "Refresh Plot" ) );
pb_refresh->setEnabled( false );
@@ -168,13 +129,6 @@
pb_prefilt = us_pushbutton( tr( "Select PreFilter" ) );
-#if 0
- pb_ldcolor = us_pushbutton( tr( "Load Color File" ) );
- pb_ldcolor->setEnabled( true );
- connect( pb_ldcolor, SIGNAL( clicked() ),
- this, SLOT( load_color() ) );
-#endif
-
le_prefilt = us_lineedit( tr( "" ), -1, true );
connect( pb_prefilt, SIGNAL( clicked() ),
this, SLOT( select_prefilt() ) );
@@ -204,92 +158,62 @@
spec->addLayout( dkdb_cntrls, s_row++, 0, 1, 8 );
spec->addWidget( le_prefilt, s_row++, 0, 1, 8 );
spec->addWidget( pb_prefilt, s_row++, 0, 1, 4 );
- //spec->addWidget( pb_ldcolor, s_row++, 4, 1, 4 );
spec->addWidget( pb_lddistr, s_row, 0, 1, 4 );
spec->addWidget( pb_rmvdist, s_row++, 4, 1, 4 );
spec->addWidget( pb_refresh, s_row, 0, 1, 4 );
spec->addWidget( pb_reset, s_row++, 4, 1, 4 );
-
-
+ spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
+ spec->addLayout( gl_x_mass, s_row, 2, 1, 2 );
+ spec->addLayout( gl_x_ff0, s_row, 4, 1, 2 );
+ spec->addLayout( gl_x_rh, s_row++, 6, 1, 2 );
+ spec->addLayout( gl_x_vbar, s_row, 2, 1, 2 );
+ spec->addLayout( gl_x_s, s_row++, 4, 1, 2 );
spec->addWidget( ck_savepl, s_row, 0, 1, 4 );
spec->addWidget( ck_locsave, s_row++, 4, 1, 4 );
-// spec->addWidget( lb_curr_distr, s_row, 0, 1, 4 );
-// spec->addWidget( ct_curr_distr, s_row++, 4, 1, 4 );
spec->addWidget( te_distr_info, s_row, 0, 2, 8 ); s_row += 2;
- //spec->addWidget( le_cmap_name, s_row++, 0, 1, 8 );
-#if 0
- spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
- spec->addLayout( gl_x_s, s_row, 2, 1, 1 );
- spec->addLayout( gl_x_ff0, s_row, 3, 1, 1 );
- spec->addLayout( gl_x_mw, s_row, 4, 1, 1 );
- spec->addLayout( gl_x_vbar, s_row, 5, 1, 1 );
- spec->addLayout( gl_x_D, s_row, 6, 1, 1 );
- spec->addLayout( gl_x_f, s_row++, 7, 1, 1 );
- spec->addWidget( lb_y_axis, s_row, 0, 1, 2 );
- spec->addLayout( gl_y_s, s_row, 2, 1, 1 );
- spec->addLayout( gl_y_ff0, s_row, 3, 1, 1 );
- spec->addLayout( gl_y_mw, s_row, 4, 1, 1 );
- spec->addLayout( gl_y_vbar, s_row, 5, 1, 1 );
- spec->addLayout( gl_y_D, s_row, 6, 1, 1 );
- spec->addLayout( gl_y_f, s_row++, 7, 1, 1 );
-#endif
// Set up analysis controls
QLabel* lb_analysis = us_banner( tr( "Analysis Controls" ) );
+ QLabel* lb_boundPct = us_label ( tr( "% of Boundary:" ) );
+ QLabel* lb_boundPos = us_label ( tr( "Boundary Position (%):" ) );
QLabel* lb_smoothing = us_label ( tr( "Data Smoothing:" ) );
- QLabel* lb_boundPercent = us_label ( tr( "% of Boundary:" ) );
- QLabel* lb_boundPos = us_label ( tr( "Boundary Position (%):" ) );
-#if 0
- lb_tolerance = us_label( tr( "Back Diffusion Tolerance:" ) );
- lb_tolerance->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
- ct_tolerance = us_counter( 3, 0.001, 1.0, 0.001 );
- ct_tolerance->setSingleStep( 0.001 );
- ct_tolerance->setEnabled( true );
- connect( ct_tolerance, SIGNAL( valueChanged( double ) ),
- this, SLOT( update_bdtoler( double ) ) );
-#endif
-
- lb_division = us_label( tr( "Divisions:" ) );
+ lb_division = us_label( tr( "Divisions:" ) );
lb_division->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
- ct_division = us_counter( 3, 0, 100, 50 );
+ ct_division = us_counter( 2, 0, 100, 50 );
ct_division->setSingleStep( 1 );
ct_division->setEnabled( true );
connect( ct_division, SIGNAL( valueChanged( double ) ),
this, SLOT( update_divis( double ) ) );
- ct_smoothing = us_counter( 2, 1, 100, 1 );
- ct_boundaryPercent = us_counter( 3, 10, 100, 1 );
- ct_boundaryPos = us_counter( 3, 0, 100, 1 );
+ ct_boundaryPct = us_counter( 2, 10, 100, 1 );
+ ct_boundaryPos = us_counter( 2, 0, 100, 1 );
+ ct_smoothing = us_counter( 2, 1, 100, 1 );
- ct_smoothing ->setSingleStep( 1 );
- ct_boundaryPercent->setSingleStep( 1 );
- ct_boundaryPos ->setSingleStep( 1 );
- ct_smoothing ->setValue( 1 );
- ct_boundaryPercent->setValue( 90 );
- ct_boundaryPos ->setValue( 5 );
+ ct_boundaryPct->setSingleStep( 1 );
+ ct_boundaryPos->setSingleStep( 1 );
+ ct_smoothing ->setSingleStep( 1 );
+ ct_boundaryPct->setValue( 90 );
+ ct_boundaryPos->setValue( 5 );
+ ct_smoothing ->setValue( 1 );
spec->addWidget( lb_analysis , s_row++, 0, 1, 8 );
-// spec->addWidget( lb_tolerance , s_row, 0, 1, 4 );
-// spec->addWidget( ct_tolerance , s_row++, 4, 1, 4 );
spec->addWidget( lb_division , s_row, 0, 1, 4 );
spec->addWidget( ct_division , s_row++, 4, 1, 4 );
+ spec->addWidget( lb_boundPct , s_row, 0, 1, 4 );
+ spec->addWidget( ct_boundaryPct , s_row++, 4, 1, 4 );
+ spec->addWidget( lb_boundPos , s_row, 0, 1, 4 );
+ spec->addWidget( ct_boundaryPos , s_row++, 4, 1, 4 );
spec->addWidget( lb_smoothing , s_row, 0, 1, 4 );
spec->addWidget( ct_smoothing , s_row++, 4, 1, 4 );
- spec->addWidget( lb_boundPercent , s_row, 0, 1, 4 );
- spec->addWidget( ct_boundaryPercent, s_row++, 4, 1, 4 );
- spec->addWidget( lb_boundPos , s_row, 0, 1, 4 );
- spec->addWidget( ct_boundaryPos , s_row++, 4, 1, 4 );
spec->addWidget( pb_help, ++s_row, 0, 1, 4 );
spec->addWidget( pb_close, s_row++, 4, 1, 4 );
// Set up plot component window on right side
- //xa_title = anno_title( ATTR_S );
- //ya_title = anno_title( ATTR_K );
- xa_title = tr( "Sedimentation Coefficient x 1.e+13" );
- ya_title = tr( "Boundary Fraction" );
+ xa_title = anno_title( ATTR_S );
+ ya_title = anno_title( ATTR_F );
QBoxLayout* plot = new US_Plot( data_plot,
tr( "Density Matching Data" ), xa_title, ya_title );
@@ -300,17 +224,11 @@
data_plot->setAxisScale( QwtPlot::xBottom, -200.0, 200.0 );
data_plot->setAxisScale( QwtPlot::yLeft, 0.0, 1.0 );
data_plot->setCanvasBackground( Qt::white );
-#if 0
- QwtText zTitle( "Partial Concentration" );
- zTitle.setFont( QFont( US_GuiSettings::fontFamily(),
- US_GuiSettings::fontSize(), QFont::Bold ) );
- data_plot->setAxisTitle( QwtPlot::yRight, zTitle );
-#endif
pick = new US_PlotPicker( data_plot );
pick->setRubberBand( QwtPicker::RectRubberBand );
- // put layouts together for overall layout
+ // Put layouts together for overall layout
left->addLayout( spec );
left->addStretch();
@@ -326,7 +244,6 @@
latest = true;
// Set up variables and initial state of GUI
-
reset();
}
@@ -339,7 +256,6 @@
need_save = false;
plot_x = ATTR_S;
- plot_y = ATTR_K;
// resolu = 90.0;
// ct_resolu->setRange( 1.0, 100.0 );
// ct_resolu->setSingleStep( 1.0 );
@@ -398,15 +314,7 @@
ct_curr_distr->setEnabled( false );
#endif
- // default to white-cyan-magenta-red-black color map
- colormap = new QwtLinearColorMap( Qt::white, Qt::black );
- colormap->addColorStop( 0.10, Qt::cyan );
- colormap->addColorStop( 0.50, Qt::magenta );
- colormap->addColorStop( 0.80, Qt::red );
- cmapname = tr( "Default Color Map: w-cyan-magenta-red-black" );
-
- stop();
- system.clear();
+ alldis.clear();
pfilts.clear();
// pb_pltall ->setEnabled( false );
pb_refresh->setEnabled( false );
@@ -417,7 +325,7 @@
// plot the data
void US_Density_Match::plot_data( void )
{
- int syssiz = system.size();
+ int syssiz = alldis.size();
if ( syssiz < 1 )
return;
@@ -430,54 +338,24 @@
curr_distr = qBound( curr_distr, 0, syssiz );
}
- zpcent = ck_zpcent->isChecked();
+// zpcent = ck_zpcent->isChecked();
- // Get current distro and (if need be) rebuild XY distro
- DisSys* tsys = (DisSys*)&system.at( curr_distr );
- QList< S_Solute >* sol_d = &tsys->sk_distro;
+ // Get current distro and (if need be) rebuild BF distro
+ DisSys* tsys = (DisSys*)&alldis.at( curr_distr );
+ QList< S_Solute >* sol_d = &tsys->in_distro;
- build_xy_distro();
+ build_bf_distro();
- if ( zpcent )
- {
- data_plot->setAxisTitle( QwtPlot::yRight,
- tr( "Percent of Total Concentration" ) );
- sol_d = &tsys->xy_distro_zp;
- }
-
- else
- {
- data_plot->setAxisTitle( QwtPlot::yRight,
- tr( "Partial Concentration" ) );
- sol_d = &tsys->xy_distro;
- }
-
- colormap = tsys->colormap;
- cmapname = tsys->cmapname;
-
QString tstr = tsys->run_name + "\n" + tsys->analys_name
+ "\n" + tsys->method;
data_plot->setTitle( tstr );
data_plot->detachItems( QwtPlotItem::Rtti_PlotSpectrogram );
- QColor bg = colormap->color1();
+ QColor bg = QColor( Qt::white );
data_plot->setCanvasBackground( bg );
int csum = bg.red() + bg.green() + bg.blue();
pick->setTrackerPen( QPen( csum > 600 ? QColor( Qt::black ) :
QColor( Qt::white ) ) );
- // Set up spectrogram data
- QwtPlotSpectrogram* d_spectrogram = new QwtPlotSpectrogram();
-#if QT_VERSION < 0x050000
- d_spectrogram->setData( US_SpectrogramData() );
- d_spectrogram->setColorMap( *colormap );
- US_SpectrogramData& spec_dat = (US_SpectrogramData&)d_spectrogram->data();
-#else
- US_SpectrogramData* rdata = new US_SpectrogramData();
- d_spectrogram->setData( rdata );
-// d_spectrogram->setColorMap( (QwtColorMap*)colormap );
- d_spectrogram->setColorMap( ColorMapCopy( colormap ) );
- US_SpectrogramData& spec_dat = (US_SpectrogramData&)*(d_spectrogram->data());
-#endif
QwtDoubleRect drect;
if ( auto_sxy )
@@ -489,8 +367,8 @@
( plt_smax - plt_smin ), ( plt_kmax - plt_kmin ) );
}
- plt_zmin = zpcent ? 100.0 : 1e+8;
- plt_zmax = zpcent ? 0.0 : -1e+8;
+ plt_zmin = 1e+8;
+ plt_zmax = -1e+8;
if ( auto_scz )
{ // Find Z min,max for current distribution
@@ -503,11 +381,10 @@
}
else
{ // Find Z min,max for all distributions
- for ( int ii = 0; ii < system.size(); ii++ )
+ for ( int ii = 0; ii < alldis.size(); ii++ )
{
- DisSys* tsys = (DisSys*)&system.at( ii );
- QList< S_Solute >* sol_z = zpcent ? &tsys->sk_distro_zp
- : &tsys->sk_distro;
+ DisSys* tsys = (DisSys*)&alldis.at( ii );
+ QList< S_Solute >* sol_z = &tsys->in_distro;
for ( int jj = 0; jj < sol_z->size(); jj++ )
{
@@ -518,18 +395,9 @@
}
}
- spec_dat.setRastRanges( xreso, yreso, resolu, zfloor, drect );
- spec_dat.setZRange( 0.0, plt_zmax );
- spec_dat.setRaster( sol_d );
-
- d_spectrogram->attach( data_plot );
-
- // set color map and axis settings
- QwtScaleWidget *rightAxis = data_plot->axisWidget( QwtPlot::yRight );
- rightAxis->setColorBarEnabled( true );
-
+ // Set axis settings
xa_title = anno_title( plot_x );
- ya_title = anno_title( plot_y );
+ ya_title = anno_title( ATTR_F );
data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
@@ -546,45 +414,26 @@
data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax, lStep );
}
-#if QT_VERSION < 0x050000
- rightAxis->setColorMap( QwtDoubleInterval( 0.0, plt_zmax ),
- d_spectrogram->colorMap() );
-#else
-// rightAxis->setColorMap( QwtInterval( plt_zmin, plt_zmax ),
-// (QwtColorMap*)d_spectrogram->colorMap() );
- rightAxis->setColorMap( QwtInterval( 0.0, plt_zmax ),
- ColorMapCopy( colormap ) );
-#endif
-// data_plot->setAxisScale( QwtPlot::yRight, plt_zmin, plt_zmax );
- data_plot->setAxisScale( QwtPlot::yRight, 0.0, plt_zmax );
-
data_plot->replot();
//QString dtext = te_distr_info->toPlainText().section( "\n", 0, 1 );
QString dtext = tr( "Run: " ) + tsys->run_name
+ " (" + tsys->method + ")\n " + tsys->analys_name;
- bool sv_plot = ck_savepl->isChecked() &&
- ( ( looping && !ck_conloop->isChecked() ) || !looping );
-DbgLv(2) << "(1) sv_plot" << sv_plot << "looping" << looping;
+ bool sv_plot = ck_savepl->isChecked();
+DbgLv(2) << "(1) sv_plot" << sv_plot;
DbgLv(2) << "(3) need_save sv_plot" << need_save << sv_plot;
//if ( need_save && sv_plot )
if ( sv_plot )
{ // Automatically save plot image in a PNG file
const QString s_attrs[] = { "s", "ff0", "MW", "vbar", "D", "f" };
-#if QT_VERSION > 0x050000
QPixmap plotmap = ((QWidget*)data_plot)->grab();
-#else
- QSize pmsize = data_plot->size();
- QPixmap plotmap = QPixmap::grabWidget( data_plot, 0, 0,
- pmsize.width(), pmsize.height() );
-#endif
QString runid = tsys->run_name.section( ".", 0, -2 );
QString triple = tsys->run_name.section( ".", -1, -1 );
QString report = QString( "pseudo3d_" ) + s_attrs[ plot_x ]
- + "_" + s_attrs[ plot_y ];
+ + "_" + s_attrs[ ATTR_F ];
QString ofdir = US_Settings::reportDir() + "/" + runid;
QDir dirof( ofdir );
@@ -644,32 +493,10 @@
yreso = dval;
}
-void US_Density_Match::update_zfloor( double dval )
-{
- zfloor = dval;
-}
-
void US_Density_Match::update_curr_distr( double dval )
{
curr_distr = qRound( dval ) - 1;
DbgLv(1) << "upd_curr_distr" << curr_distr;
-
- if ( curr_distr > (-1) && curr_distr < system.size() )
- {
- DisSys* tsys = (DisSys*)&system.at( curr_distr );
- cmapname = tsys->cmapname;
-// le_cmap_name->setText( cmapname );
- colormap = tsys->colormap;
- if ( ! looping )
- te_distr_info->setText( tr( "Run: " ) + tsys->run_name
- + " (" + tsys->method + ")\n " + tsys->analys_name );
- }
-
- build_xy_distro();
-
- set_limits();
-
- plot_data();
}
void US_Density_Match::update_plot_smin( double dval )
@@ -712,28 +539,9 @@
set_limits();
}
-void US_Density_Match::select_conloop()
-{
- cont_loop = ck_conloop->isChecked();
- DisSys* tsys = (DisSys*)&system.at( curr_distr );
- QString dtext = tr( "Run: " ) + tsys->run_name
- + " (" + tsys->method + ")\n " + tsys->analys_name;
-
- if ( cont_loop )
- {
- pb_pltall->setText( tr( "Plot All Distros in a Loop" ) );
- dtext = dtext +
- tr( "\nWith continuous loop, plot files are not saved." );
- }
- else
- pb_pltall->setText( tr( "Plot All Distros" ) );
-
- te_distr_info->setText( dtext );
-}
-
void US_Density_Match::load_distro()
{
- // get a model description or set of descriptions for distribution data
+ // Get a model description or set of descriptions for distribution data
QList< US_Model > models;
QStringList mdescs;
bool loadDB = dkdb_cntrls->db();
@@ -752,33 +560,30 @@
need_save = false;
for ( int jj = 0; jj < models.count(); jj++ )
- { // load each selected distribution model
+ { // Load each selected distribution model
load_distro( models[ jj ], mdescs[ jj ] );
}
- curr_distr = system.size() - 1;
+ curr_distr = alldis.size() - 1;
need_save = ck_savepl->isChecked() && !cont_loop;
- ct_curr_distr->setEnabled( true );
- ct_curr_distr->setValue( curr_distr + 1 );
pb_rmvdist->setEnabled( models.count() > 0 );
- update_curr_distr( (double)system.size() );
+ update_curr_distr( (double)alldis.size() );
}
+// Create distributions from a loaded model
void US_Density_Match::load_distro( US_Model model, QString mdescr )
{
DisSys tsys;
- S_Solute sol_sk;
- S_Solute sol_xy;
+ S_Solute sol_in;
+ S_Solute sol_nm;
+ S_Solute sol_bf;
+ QList< S_Solute > wk_distro;
model.update_coefficients(); // fill in any missing coefficients
- QString mdesc = mdescr.section( mdescr.left( 1 ), 1, 1 );
+ QString mdesc = mdescr.section( mdescr.left( 1 ), 1, 1 );
- // load current colormap
- tsys.colormap = colormap;
- tsys.cmapname = cmapname;
-
tsys.run_name = mdesc.section( ".", 0, -3 );
QString asys = mdesc.section( ".", -2, -2 );
tsys.analys_name = asys.section( "_", 0, -4 ) + "_"
@@ -794,7 +599,6 @@
}
tsys.editGUID = model.editGUID;
tsys.plot_x = plot_x;
- tsys.plot_y = plot_y;
DbgLv(1) << "LD: method" << tsys.method << "mdesc" << mdesc;
if ( tsys.method == "Manual" || tsys.method == "CUSTOMGRID" )
@@ -807,134 +611,134 @@
DbgLv(1) << "LD: analys_name" << tsys.analys_name;
}
+DbgLv(1) << "LD: model:" << model.description;
tsys.distro_type = (int)model.analysis;
- tsys.monte_carlo = model.monteCarlo;
+ QString edir = US_Settings::tmpDir();
+ QString efname = tsys.run_name + ".xml";
- if ( model.monteCarlo )
- { // Revisit setting if Monte Carlo
- QString miter = mdescr.section( mdescr.left( 1 ), 6 );
- int kiter = miter.isEmpty() ? 0 : miter.toInt();
+ // Read in edit for this model
+ US_DataIO::EditedData edata;
+ US_DB2* dbP = NULL;
- if ( kiter < 2 )
- { // Turn off flag if not composite MC model (is individual MC)
- tsys.monte_carlo = false;
- }
+ if ( dkdb_cntrls->db() )
+ { // Set up to read from database
+ US_Passwd pw;
+ dbP = new US_DB2( pw.getPasswd() );
+ QStringList qry;
+ qry << "get_editID" << model.editGUID;
+ dbP->query( qry );
+ dbP->next();
+ QString editID = dbP->value( 0 ).toString();
+ int idEdit = editID.toInt();
+DbgLv(1) << "LD: idEdit" << idEdit;
+ qry.clear();
+ qry << "get_editedData" << editID;
+ dbP->query( qry );
+ dbP->next();
+ int idRaw = dbP->value( 0 ).toString().toInt();
+ efname = dbP->value( 3 ).toString();
+DbgLv(1) << "LD: edir" << edir;
+DbgLv(1) << "LD: efname" << efname;
+ QString epath = edir + "/" + efname;
+ QString rpath = edir + "/" + efname.section( ".", 0, -7 ) + "."
+ + efname.section( ".", -5, -2 ) + ".auc";
+
+ dbP->readBlobFromDB( epath, "download_editData", idEdit );
+ dbP->readBlobFromDB( rpath, "download_aucData", idRaw );
}
-
+ // Read in edit
+ US_DataIO::loadData( edir, efname, edata );
+DbgLv(1) << "LD: edata: desc run cell chan"
+ << edata.description << edata.runID << edata.cell << edata.channel;
+
+ // Now, get associated solution,buffer values
+ QString soluID;
+ QString cvbar20;
+ QString bdens;
+ QString bvisc;
+ QString cmprss;
+ QString bmanu;
+ QString errmsg;
+DbgLv(1) << "LD: solvals CALL";
+ US_SolutionVals::values( dbP, &edata,
+ soluID, cvbar20, bdens, bvisc, cmprss, bmanu, errmsg );
+DbgLv(1) << "LD: solval: bdens soluID errmsg"
+ << bdens << soluID << errmsg;
+
+
te_distr_info->setText( tr( "Run: " ) + tsys.run_name
+ " (" + tsys.method + ")\n " + tsys.analys_name );
- plt_zmin_co = 1e+8;
- plt_zmax_co = -1e+8;
- plt_zmin_zp = 100.0;
- plt_zmax_zp = 0.0;
int nsolmc = model.components.size();
- // read in and set distribution s,k,c,... values
- if ( tsys.distro_type != (int)US_Model::COFS )
+ // Read in and set distribution s,k,c,... values
+ double tot_conc = 0.0;
+
+ for ( int jj = 0; jj < nsolmc; jj++ )
{
- double tot_conc = 0.0;
+ sol_in.s = model.components[ jj ].s * 1.0e13;
+ sol_in.k = model.components[ jj ].f_f0;
+ sol_in.c = model.components[ jj ].signal_concentration;
+ sol_in.w = model.components[ jj ].mw;
+ sol_in.v = model.components[ jj ].vbar20;
+ sol_in.d = model.components[ jj ].D * 1.0e7;
+ sol_in.f = model.components[ jj ].f;
- for ( int jj = 0; jj < nsolmc; jj++ )
- {
- sol_sk.s = model.components[ jj ].s * 1.0e13;
- sol_sk.k = model.components[ jj ].f_f0;
- sol_sk.c = model.components[ jj ].signal_concentration;
- sol_sk.w = model.components[ jj ].mw;
- sol_sk.v = model.components[ jj ].vbar20;
- sol_sk.d = model.components[ jj ].D * 1.0e7;
- sol_sk.f = model.components[ jj ].f;
+ tsys.in_distro << sol_in;
+ wk_distro << sol_in;
- sol_xy = sol_sk;
- sol_xy.s = ( plot_x == ATTR_S ) ? sol_sk.s : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_K ) ? sol_sk.k : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_W ) ? sol_sk.w : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_V ) ? sol_sk.v : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_D ) ? sol_sk.d : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_F ) ? sol_sk.f : sol_xy.s;
- sol_xy.k = ( plot_y == ATTR_S ) ? sol_sk.s : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_K ) ? sol_sk.k : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_W ) ? sol_sk.w : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_V ) ? sol_sk.v : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_D ) ? sol_sk.d : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_F ) ? sol_sk.f : sol_xy.k;
+ tot_conc += sol_in.c;
+if ( jj<3 || (jj+4)>nsolmc )
+ DbgLv(1) << "LD: jj" << jj << "soli s,d,c,t"
+ << sol_in.s << sol_in.d << sol_in.c << tot_conc;
+ }
- tsys.sk_distro << sol_sk;
- tsys.xy_distro << sol_xy;
+ // Sort and reduce distributions, then normalize
+ sort_distro( wk_distro, true );
- plt_zmin_co = qMin( plt_zmin_co, sol_sk.c );
- plt_zmax_co = qMax( plt_zmax_co, sol_sk.c );
- tot_conc += sol_sk.c;
- }
-DbgLv(1) << "LD: zmin zmax totconc" << plt_zmin_co << plt_zmax_co << tot_conc;
+ tsys.nm_distro.clear();
+ int nsolin = tsys.in_distro.size();
+ int nsolnm = wk_distro.size();
+DbgLv(1) << "LD: totconc" << tot_conc << "nsolin nsolnm" << nsolin << nsolnm;
+ for ( int jj = 0; jj < nsolnm; jj++ )
+ {
+ sol_nm = wk_distro[ jj ];
+ sol_nm.c /= tot_conc;
+ tsys.nm_distro << sol_nm;
+if ( jj<3 || (jj+4)>nsolnm )
+ DbgLv(1) << "LD: jj" << jj << "soln s,d,c"
+ << sol_nm.s << sol_nm.d << sol_nm.c;
+ }
+DbgLv(1) << "LD: nsolin nsolnm" << nsolin << nsolnm << tsys.nm_distro.size();
- // sort and reduce distributions
- sort_distro( tsys.sk_distro, false );
- sort_distro( tsys.xy_distro, true );
- int nsolsk = tsys.sk_distro.size();
- int nsolxy = tsys.xy_distro.size();
-DbgLv(1) << "LD: nsolsk nsolxy nsolmc" << nsolsk << nsolxy << nsolmc;
- tsys.sk_distro_zp.clear();
- tsys.xy_distro_zp.clear();
+ // Create version of distribution with boundary fraction
- // Create Z-as-percentage version of distributions
+ wk_distro.clear();
+ double sum_co = 0.0;
- for ( int jj = 0; jj < nsolmc; jj++ )
- {
- double cozpc;
-
- if ( jj < nsolsk )
- {
- sol_sk = tsys.sk_distro[ jj ];
- cozpc = sol_sk.c * 100.0 / tot_conc;
- sol_sk.c = cozpc;
- plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
- plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
- tsys.sk_distro_zp << sol_sk;
- }
-
- if ( jj < nsolxy )
- {
- sol_xy = tsys.xy_distro[ jj ];
- cozpc = sol_xy.c * 100.0 / tot_conc;
- sol_xy.c = cozpc;
- plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
- plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
- tsys.xy_distro_zp << sol_xy;
- }
- }
-DbgLv(1) << "LD: zminzp zmaxzp" << plt_zmin_zp << plt_zmax_zp;
+ for ( int jj = 0; jj < nsolnm; jj++ )
+ {
+ sol_nm = tsys.nm_distro[ jj ];
+ sum_co += sol_nm.c;
+ sol_bf = sol_nm;
+ sol_bf.f = sum_co;
+ wk_distro << sol_bf;
+if ( jj<3 || (jj+4)>nsolnm )
+ DbgLv(1) << "LD: jj" << jj << "solb s,d,c,f"
+ << sol_bf.d << sol_bf.d << sol_bf.c << sol_bf.f;
}
- // update current distribution record
- system.append( tsys );
- int jd = system.size();
- curr_distr = jd - 1;
- ct_curr_distr->setRange( 1.0, jd );
- ct_curr_distr->setSingleStep( 1.0 );
- ct_curr_distr->setValue( jd );
- ct_curr_distr->setEnabled( true );
+ // Update current distribution record
+DbgLv(1) << "LD: call alldis.append";
+ alldis.append( tsys );
+DbgLv(1) << "LD: retn fr alldis.append";
+#if 0
if ( auto_sxy )
{
DbgLv(1) << "LD: auto_sxy call set_limits";
set_limits();
-DbgLv(1) << "LD: auto_sxy rtn fr set_limits";
- ct_plt_kmin->setEnabled( false );
- ct_plt_kmax->setEnabled( false );
- ct_plt_smin->setEnabled( false );
- ct_plt_smax->setEnabled( false );
}
- else
- {
- plt_smin = ct_plt_smin->value();
- plt_smax = ct_plt_smax->value();
- plt_kmin = ct_plt_kmin->value();
- plt_kmax = ct_plt_kmax->value();
-DbgLv(1) << "LD: non-auto_sxy call set_limits";
- set_limits();
-DbgLv(1) << "LD: non-auto_sxy rtn fr set_limits";
- }
data_plot->setAxisScale( QwtPlot::xBottom, plt_smin, plt_smax );
data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax );
@@ -946,53 +750,13 @@
pb_pltall->setText( tr( "Plot All Distros in a Loop" ) );
else
pb_pltall->setText( tr( "Plot All Distros" ) );
+#endif
DbgLv(1) << "LD: RETURN";
}
-void US_Density_Match::load_color()
-{
- QString filter = tr( "Color Map files (*cm-*.xml);;" )
- + tr( "Any XML files (*.xml);;" )
- + tr( "Any files (*)" );
-
- // get an xml file name for the color map
- QString fname = QFileDialog::getOpenFileName( this,
- tr( "Load Color Map File" ),
- US_Settings::etcDir(), filter, 0, 0 );
-
- if ( fname.isEmpty() )
- return;
-
- // get the map from the file
- QList< QColor > cmcolor;
- QList< double > cmvalue;
-
- US_ColorGradIO::read_color_steps( fname, cmcolor, cmvalue );
- colormap = new QwtLinearColorMap( cmcolor.first(), cmcolor.last() );
-
- for ( int jj = 1; jj < cmvalue.size() - 1; jj++ )
- {
- colormap->addColorStop( cmvalue.at( jj ), cmcolor.at( jj ) );
- }
- QFileInfo fi( fname );
- cmapname = tr( "Color Map: " ) + fi.baseName();
-// le_cmap_name->setText( cmapname );
-
- // save the map information for the current distribution
- if ( curr_distr < system.size() )
- {
- DisSys* tsys = (DisSys*)&system.at( curr_distr );
- tsys->colormap = colormap;
- tsys->cmapname = cmapname;
- }
-
- plot_data();
-}
-
// Start a loop of plotting all distros
void US_Density_Match::plotall()
{
- looping = true;
pb_stopplt->setEnabled( true );
curr_distr = 0;
plot_data();
@@ -1000,19 +764,12 @@
patm_id = startTimer( patm_dlay );
- if ( curr_distr == system.size() )
+ if ( curr_distr == alldis.size() )
curr_distr--;
need_save = ck_savepl->isChecked() && !cont_loop;
}
-// Stop the distros-plotting loop
-void US_Density_Match::stop()
-{
- looping = false;
- need_save = ck_savepl->isChecked() && !cont_loop;
-}
-
void US_Density_Match::set_limits()
{
double smin = 1.0e30;
@@ -1022,23 +779,23 @@
double sinc;
double kinc;
xa_title = anno_title( plot_x );
- ya_title = anno_title( plot_y );
+ ya_title = anno_title( ATTR_F );
data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
- if ( system.size() < 1 )
+ if ( alldis.size() < 1 )
return;
// find min,max for X,Y distributions
- for ( int ii = 0; ii < system.size(); ii++ )
+ for ( int ii = 0; ii < alldis.size(); ii++ )
{
- DisSys* tsys = (DisSys*)&system.at( ii );
+ DisSys* tsys = (DisSys*)&alldis.at( ii );
- for ( int jj = 0; jj < tsys->xy_distro.size(); jj++ )
+ for ( int jj = 0; jj < tsys->nm_distro.size(); jj++ )
{
- double sval = tsys->xy_distro.at( jj ).s;
- double kval = tsys->xy_distro.at( jj ).k;
+ double sval = tsys->nm_distro.at( jj ).s;
+ double kval = tsys->nm_distro.at( jj ).k;
smin = qMin( smin, sval );
smax = qMax( smax, sval );
kmin = qMin( kmin, kval );
@@ -1102,7 +859,7 @@
<< plt_kmin << plt_kmax;
}
-// Sort distribution solute list by s,k values and optionally reduce
+// Sort distribution solute list by s,d values and optionally reduce
void US_Density_Match::sort_distro( QList< S_Solute >& listsols,
bool reduce )
{
@@ -1132,7 +889,7 @@
{ // loop to compare each entry to previous
sol2 = *jj; // solute entry
- if ( sol1.s != sol2.s || sol1.k != sol2.k )
+ if ( sol1.s != sol2.s || sol1.d != sol2.d )
{ // not a duplicate, so output to temporary list
reduced.append( sol2 );
jdup = 0;
@@ -1141,8 +898,8 @@
else
{ // duplicate, so sum c value;
sol2.c += sol1.c; // sum c value
- sol2.s = ( sol1.s + sol2.s ) * 0.5; // average s,k
- sol2.k = ( sol1.k + sol2.k ) * 0.5;
+ sol2.s = ( sol1.s + sol2.s ) * 0.5; // average s,d
+ sol2.d = ( sol1.d + sol2.d ) * 0.5;
reduced.replace( reduced.size() - 1, sol2 );
kdup = max( kdup, ++jdup );
}
@@ -1169,51 +926,6 @@
return;
}
-void US_Density_Match::timerEvent( QTimerEvent *event )
-{
- int tm_id = event->timerId();
-
- if ( tm_id != patm_id )
- { // if other than plot loop timer event, pass on to normal handler
- QWidget::timerEvent( event );
- return;
- }
-
- int syssiz = system.size();
- int maxsiz = syssiz - 1;
- int jdistr = curr_distr + 1;
-
- if ( syssiz > 0 && looping )
- { // If still looping, plot the next distribution
- if ( jdistr > maxsiz )
- { // If we have passed the end in looping, reset
- jdistr = 0;
-
- if ( ! cont_loop )
- { // If not in continuous loop, turn off looping flag
- jdistr = curr_distr;
- looping = false;
- }
-
- else
- { // If in continuous loop, turn off save-plot flag
- need_save = false;
- }
- }
- curr_distr = jdistr;
- plot_data();
- }
-
- if ( curr_distr > maxsiz || !looping )
- { // If past last distro or Stop clicked, stop the loop
- killTimer( tm_id );
- pb_stopplt->setEnabled( false );
- curr_distr = ( curr_distr > maxsiz ) ? maxsiz : curr_distr;
- need_save = ck_savepl->isChecked() && !cont_loop;
- }
- ct_curr_distr->setValue( curr_distr + 1 );
-}
-
// Reset Disk_DB control whenever data source is changed in any dialog
void US_Density_Match::update_disk_db( bool isDB )
{
@@ -1256,11 +968,11 @@
void US_Density_Match::remove_distro( void )
{
qDebug() << "Remove Distros";
- US_RemoveModels rmvd( system );
+ US_RemoveModels rmvd( alldis );
if ( rmvd.exec() == QDialog::Accepted )
{
- int jd = system.size();
+ int jd = alldis.size();
if ( jd < 1 )
{
@@ -1281,15 +993,34 @@
// Select coordinate for horizontal axis
void US_Density_Match::select_x_axis( int ival )
{
+DbgLv(1) << "sel_x: ival" << ival;
+#if 0
+ const QString xlabs[] = { "mass", "f/f0", "rh", "vbar", "s" };
+ const double xvlos[] = { 2e+4, 1.0, 2e+4, 0.60, 1.0 };
+ const double xvhis[] = { 1e+5, 4.0, 1e+5, 0.80, 10.0 };
+ const double xmins[] = { 0.0, 1.0, 0.0, 0.01, -10000.0 };
+ const double xmaxs[] = { 1e+10, 50.0, 1e+10, 3.00, 10000.0 };
+ const double xincs[] = { 1000.0, 0.01, 1000.0, 0.01, 0.01 };
+#endif
+
+ const QString xlabs[] = { "s", "f/f0", "mass","vbar", "D", "f", "r" };
+ const double xvlos[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8, 1e-8 };
+ const double xvhis[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7, 1e-7 };
+ const double xmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9, 1e-9 };
+ const double xmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5, 1e-4 };
+ const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9, 1e-9 };
+#if 0
const QString xlabs[] = { "s", "f/f0", "MW", "vbar", "D", "f" };
const double xvlos[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
const double xvhis[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7 };
const double xmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
const double xmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
+#endif
plot_x = ival;
+#if 0
lb_plt_smin->setText( tr( "Plot Limit " ) + xlabs[ plot_x ]
+ tr( " Minimum:" ) );
lb_plt_smax->setText( tr( "Plot Limit " ) + xlabs[ plot_x ]
@@ -1300,115 +1031,61 @@
ct_plt_smax->setSingleStep( xincs[ plot_x ] );
ct_plt_smin->setValue( xvlos[ plot_x ] );
ct_plt_smax->setValue( xvhis[ plot_x ] );
+#endif
+DbgLv(1) << "sel_x: lab vlos vhis xmin xmax xinc" << xlabs[plot_x]
+ << xvlos[plot_x] << xvhis[plot_x] << xmins[plot_x] << xmaxs[plot_x]
+ << xincs[plot_x];
- rb_y_s ->setEnabled( plot_x != ATTR_S );
- rb_y_ff0 ->setEnabled( plot_x != ATTR_K );
- rb_y_mw ->setEnabled( plot_x != ATTR_W );
- rb_y_vbar->setEnabled( plot_x != ATTR_V );
- rb_y_D ->setEnabled( plot_x != ATTR_D );
- rb_y_f ->setEnabled( plot_x != ATTR_F );
+ build_bf_distro();
- build_xy_distro();
-
set_limits();
plot_data();
}
-// Select coordinate for vertical axis
-void US_Density_Match::select_y_axis( int ival )
+// (Re-)generate the BF version of the current distribution
+void US_Density_Match::build_bf_distro()
{
- const QString ylabs[] = { "s", "f/f0", "MW", "vbar", "D", "f" };
- const double yvlos[] = { 1.0, 1.0, 2e+4, 0.60, 0.0, 1e-8 };
- const double yvhis[] = { 10.0, 4.0, 1e+5, 0.80, 30.0, 1e-7 };
- const double ymins[] = { -10000.0, 1.0, 0.0, 0.01, 0.0, 1e-9 };
- const double ymaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 10000.0, 1e-5 };
- const double yincs[] = { 0.01, 0.01, 1000.0, 0.01, 0.01, 1e-9 };
-
- plot_y = ival;
-qDebug() << "select-y: plot_y" << plot_y;
-
- lb_plt_kmin->setText( tr( "Plot Limit " ) + ylabs[ plot_y ]
- + tr( " Minimum:" ) );
- lb_plt_kmax->setText( tr( "Plot Limit " ) + ylabs[ plot_y ]
- + tr( " Maximum:" ) );
-qDebug() << " ylab" << ylabs[plot_y];
- ct_plt_kmin->setRange( ymins[ plot_y ], ymaxs[ plot_y ] );
- ct_plt_kmax->setRange( ymins[ plot_y ], ymaxs[ plot_y ] );
- ct_plt_kmin->setSingleStep( yincs[ plot_y ] );
- ct_plt_kmax->setSingleStep( yincs[ plot_y ] );
- ct_plt_kmin->setValue( yvlos[ plot_y ] );
- ct_plt_kmax->setValue( yvhis[ plot_y ] );
-qDebug() << " yval-lo val-hi" << yvlos[plot_y] << yvhis[plot_y];
-
- rb_x_s ->setEnabled( plot_y != ATTR_S );
- rb_x_ff0 ->setEnabled( plot_y != ATTR_K );
- rb_x_mw ->setEnabled( plot_y != ATTR_W );
- rb_x_vbar->setEnabled( plot_y != ATTR_V );
- rb_x_D ->setEnabled( plot_y != ATTR_D );
- rb_x_f ->setEnabled( plot_y != ATTR_F );
-
- build_xy_distro();
-
- set_limits();
-
- plot_data();
-}
-
-// Re-generate the XY version of the current distribution
-void US_Density_Match::build_xy_distro()
-{
- if ( system.size() < 1 )
+ if ( alldis.size() < 1 )
return;
- DisSys* tsys = (DisSys*)&system.at( curr_distr );
- if ( tsys->plot_x == plot_x && tsys->plot_y == plot_y )
+ DisSys* tsys = (DisSys*)&alldis.at( curr_distr );
+ if ( tsys->plot_x == plot_x )
return;
- tsys->xy_distro.clear();
+ tsys->nm_distro.clear();
tsys->plot_x = plot_x;
- tsys->plot_y = plot_y;
double tot_conc = 0.0;
- int nsolsk = tsys->sk_distro.size();
+ int nsolin = tsys->in_distro.size();
// Create solute list with specified x,y
- for ( int ii = 0; ii < nsolsk; ii++ )
+ for ( int ii = 0; ii < nsolin; ii++ )
{
- S_Solute sol_sk = tsys->sk_distro[ ii ];
- S_Solute sol_xy = sol_sk;
+ S_Solute sol_in = tsys->in_distro[ ii ];
+ S_Solute sol_nm = sol_in;
- sol_xy.s = ( plot_x == ATTR_S ) ? sol_sk.s : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_K ) ? sol_sk.k : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_W ) ? sol_sk.w : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_V ) ? sol_sk.v : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_D ) ? sol_sk.d : sol_xy.s;
- sol_xy.s = ( plot_x == ATTR_F ) ? sol_sk.f : sol_xy.s;
- sol_xy.k = ( plot_y == ATTR_S ) ? sol_sk.s : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_K ) ? sol_sk.k : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_W ) ? sol_sk.w : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_V ) ? sol_sk.v : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_D ) ? sol_sk.d : sol_xy.k;
- sol_xy.k = ( plot_y == ATTR_F ) ? sol_sk.f : sol_xy.k;
- tot_conc += sol_sk.c;
- tsys->xy_distro << sol_xy;
+ sol_nm.s = ( plot_x == ATTR_S ) ? sol_in.s : sol_nm.s;
+ sol_nm.s = ( plot_x == ATTR_K ) ? sol_in.k : sol_nm.s;
+ sol_nm.s = ( plot_x == ATTR_W ) ? sol_in.w : sol_nm.s;
+ sol_nm.s = ( plot_x == ATTR_V ) ? sol_in.v : sol_nm.s;
+ sol_nm.s = ( plot_x == ATTR_D ) ? sol_in.d : sol_nm.s;
+ sol_nm.s = ( plot_x == ATTR_F ) ? sol_in.f : sol_nm.s;
+ tot_conc += sol_in.c;
+ tsys->nm_distro << sol_nm;
}
// Sort and possibly reduce XY distro
- sort_distro( tsys->xy_distro, true );
+ sort_distro( tsys->nm_distro, true );
// Create Z-as-percentage version of xy distribution
- int nsolxy = tsys->xy_distro.size();
-DbgLv(1) << "Bld: nsolsk nsolxy" << nsolsk << nsolxy;
- tsys->xy_distro_zp.clear();
+ int nsolnm = tsys->nm_distro.size();
+DbgLv(1) << "Bld: nsolin nsolnm" << nsolin << nsolnm;
- for ( int ii = 0; ii < nsolxy; ii++ )
+ for ( int ii = 0; ii < nsolnm; ii++ )
{
- S_Solute sol_xy = tsys->xy_distro[ ii ];
- double cozpc = sol_xy.c * 100.0 / tot_conc;
- sol_xy.c = cozpc;
- plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
- plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
+ S_Solute sol_nm = tsys->nm_distro[ ii ];
+ sol_nm.c /= tot_conc;
- tsys->xy_distro_zp << sol_xy;
+ tsys->nm_distro << sol_nm;
}
}
@@ -1423,32 +1100,22 @@
else if ( pltndx == ATTR_K )
a_title = tr( "Frictional Ratio f/f0" );
else if ( pltndx == ATTR_W )
- a_title = tr( "Molecular Weight (Dalton)" );
+ a_title = tr( "Molar Mass (Dalton)" );
else if ( pltndx == ATTR_V )
a_title = tr( "Vbar at 20" ) + DEGC;
else if ( pltndx == ATTR_D )
a_title = tr( "Diffusion Coefficient (1e-7)" );
+ else if ( pltndx == ATTR_R )
+ a_title = tr( "Hydrodynamic Radius" );
else if ( pltndx == ATTR_F )
- a_title = tr( "Frictional Coefficient" );
+ a_title = tr( "Boundary Fraction" );
return a_title;
}
-// Make a ColorMap copy and return a pointer to the new ColorMap
-QwtLinearColorMap* US_Density_Match::ColorMapCopy( QwtLinearColorMap* colormap )
+// Update structures and plot after division change
+void US_Density_Match::update_divis( double dval )
{
- QVector< double > cstops = colormap->colorStops();
- int lstop = cstops.count() - 1;
- QwtInterval csvals( 0.0, 1.0 );
- QwtLinearColorMap* cmapcopy = new QwtLinearColorMap( colormap->color1(),
- colormap->color2() );
-
- for ( int jj = 1; jj < lstop; jj++ )
- {
- QColor scolor = colormap->color( csvals, cstops[ jj ] );
- cmapcopy->addColorStop( cstops[ jj ], scolor );
- }
-
- return cmapcopy;
+DbgLv(1) << "UpdDiv:" << dval;
}
Modified: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h 2019-08-08 01:00:11 UTC (rev 2804)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-10 17:37:42 UTC (rev 2805)
@@ -22,20 +22,19 @@
//!< \brief Distribution structure
typedef struct distro_sys
{
- QList< S_Solute > sk_distro;
- QList< S_Solute > xy_distro;
- QList< S_Solute > sk_distro_zp;
- QList< S_Solute > xy_distro_zp;
- QwtLinearColorMap* colormap;
+ QList< S_Solute > in_distro; // Raw input distribution
+ QList< S_Solute > nm_distro; // Normalized concentration distro
+ QList< S_Solute > bf_distro; // Boundary fractions distro
QString run_name;
QString analys_name;
QString method;
- QString cmapname;
QString editGUID;
+ QString solutionGUID;
+ QString label;
int distro_type;
int plot_x;
- int plot_y;
- bool monte_carlo;
+ int solutionID;
+ double d2opct;
} DisSys;
//! \brief Less-than function for sorting distributions
@@ -52,7 +51,7 @@
private:
- enum attr_type { ATTR_S, ATTR_K, ATTR_W, ATTR_V, ATTR_D, ATTR_F };
+ enum attr_type { ATTR_S, ATTR_K, ATTR_W, ATTR_V, ATTR_D, ATTR_F, ATTR_R };
QLabel* lb_plt_smin;
QLabel* lb_plt_smax;
@@ -63,7 +62,6 @@
QTextEdit* te_distr_info;
- QLineEdit* le_cmap_name;
QLineEdit* le_prefilt;
US_Help showHelp;
@@ -81,15 +79,13 @@
QwtCounter* ct_tolerance;
QwtCounter* ct_division;
QwtCounter* ct_smoothing;
- QwtCounter* ct_boundaryPercent;
+ QwtCounter* ct_boundaryPct;
QwtCounter* ct_boundaryPos;
QwtPlot* data_plot;
QwtPlotPicker* pick;
- QwtLinearColorMap* colormap;
-
US_Disk_DB_Controls* dkdb_cntrls;
QPushButton* pb_pltall;
@@ -98,39 +94,28 @@
QPushButton* pb_reset;
QPushButton* pb_prefilt;
QPushButton* pb_lddistr;
- QPushButton* pb_ldcolor;
QPushButton* pb_help;
QPushButton* pb_close;
QPushButton* pb_rmvdist;
QCheckBox* ck_autosxy;
QCheckBox* ck_autoscz;
- QCheckBox* ck_conloop;
QCheckBox* ck_plot_sk;
QCheckBox* ck_plot_wk;
QCheckBox* ck_plot_sv;
QCheckBox* ck_plot_wv;
- QCheckBox* ck_zpcent;
QCheckBox* ck_savepl;
QCheckBox* ck_locsave;
- QRadioButton* rb_x_s;
+ QRadioButton* rb_x_mass;
QRadioButton* rb_x_ff0;
- QRadioButton* rb_x_mw;
+ QRadioButton* rb_x_rh;
QRadioButton* rb_x_vbar;
- QRadioButton* rb_x_D;
- QRadioButton* rb_x_f;
- QRadioButton* rb_y_s;
- QRadioButton* rb_y_ff0;
- QRadioButton* rb_y_mw;
- QRadioButton* rb_y_vbar;
- QRadioButton* rb_y_D;
- QRadioButton* rb_y_f;
+ QRadioButton* rb_x_s;
QButtonGroup* bg_x_axis;
- QButtonGroup* bg_y_axis;
- QList< DisSys > system;
+ QList< DisSys > alldis;
double resolu;
double plt_smin;
@@ -139,10 +124,6 @@
double plt_kmax;
double plt_zmin;
double plt_zmax;
- double plt_zmin_zp;
- double plt_zmax_zp;
- double plt_zmin_co;
- double plt_zmax_co;
double s_range;
double k_range;
double xreso;
@@ -150,27 +131,20 @@
double zfloor;
int curr_distr;
- int init_solutes;
- int mc_iters;
int patm_id;
int patm_dlay;
int dbg_level;
int plot_x;
- int plot_y;
- bool cnst_vbar;
bool auto_sxy;
bool auto_scz;
bool cont_loop;
- bool looping;
bool need_save;
bool runsel;
bool latest;
- bool zpcent;
QString xa_title;
QString ya_title;
- QString cmapname;
QString mfilter;
QStringList pfilts;
@@ -180,7 +154,6 @@
void update_resolu( double );
void update_xreso( double );
void update_yreso( double );
- void update_zfloor( double );
void update_curr_distr( double );
void update_plot_smin( double );
void update_plot_smax( double );
@@ -190,28 +163,21 @@
void plot_data( void );
void select_autosxy( void );
void select_autoscz( void );
- void select_conloop( void );
void update_disk_db( bool );
+ void update_divis ( double );
void select_prefilt( void );
void load_distro( void );
void load_distro( US_Model, QString );
- void load_color( void );
void plotall( void );
- void stop( void );
void reset( void );
void set_limits( void );
void sort_distro( QList< S_Solute >&, bool );
void remove_distro( void );
void select_x_axis( int );
- void select_y_axis( int );
- void build_xy_distro( void );
+ void build_bf_distro( void );
QString anno_title ( int );
- QwtLinearColorMap* ColorMapCopy( QwtLinearColorMap* );
void help ( void )
{ showHelp.show_help( "pseudo3d_combine.html" ); };
-
- protected:
- virtual void timerEvent( QTimerEvent *e );
};
#endif
1
0
Author: alexey
Date: 2019-08-08 01:00:11 +0000 (Thu, 08 Aug 2019)
New Revision: 2804
Modified:
trunk/programs/us_experiment/us_exp_utils.cpp
trunk/programs/us_experiment/us_experiment_gui_optima.cpp
trunk/programs/us_experiment/us_experiment_gui_optima.h
trunk/programs/us_experiment/us_proto_ranges.cpp
Log:
Preclude saving exp. protocol if #scans exceeds 1501..
Modified: trunk/programs/us_experiment/us_exp_utils.cpp
===================================================================
--- trunk/programs/us_experiment/us_exp_utils.cpp 2019-08-07 20:01:20 UTC (rev 2803)
+++ trunk/programs/us_experiment/us_exp_utils.cpp 2019-08-08 01:00:11 UTC (rev 2804)
@@ -2396,6 +2396,9 @@
else
scancount = int( duration_sec / ( scanint_sec_min * Total_wvl[i] ) );
}
+
+ mainw->ScanCount_global = scancount;
+
DbgLv(1) << "EGRn:inP: speed" << i << "scancount" << scancount;
QString scancount_stage = tr( "Stage %1. Number of Scans per Wavelength: %2 " ).arg(i+1).arg(scancount);
cb_scancount->addItem( scancount_stage );
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.cpp
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-08-07 20:01:20 UTC (rev 2803)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-08-08 01:00:11 UTC (rev 2804)
@@ -46,6 +46,7 @@
usmode = false;
global_reset = false;
instruments_in_use.clear();
+ ScanCount_global = 0;
// Create tab and panel widgets
tabWidget = us_tabwidget();
@@ -4393,6 +4394,18 @@
// Slot to save the current Run Protocol
void US_ExperGuiUpload::saveRunProtocol()
{
+
+ if ( mainw->ScanCount_global > 1501 )
+ {
+ QMessageBox::critical( this,
+ tr( "*ERROR* in Saving Protocol" ),
+ tr( "Protocol cannot be saved: \n"
+ "Number of scans per cell per wavelengths is %1. \n"
+ "It must not exceed 1501. \n\n"
+ "Please revise experiment parameters accordingly." ).arg( mainw->ScanCount_global ) );
+ return;
+ }
+
DbgLv(1) << "EGUp:svRP: IN";
// Test that the current protocol name is new
QStringList prnames;
@@ -4807,7 +4820,7 @@
tr( "*ERROR* in Submitting Protocol" ),
tr( "Protocol cannot be submitted: \n"
"Number of scans per cell per wavelengths is %1. \n"
- "It must be less than 1501. \n\n"
+ "It must not exceed 1501. \n\n"
"Please revise experiment parameters accordingly." ).arg( ScanCount ) );
return;
}
@@ -5040,7 +5053,7 @@
tr( "*ERROR* in Submitting Protocol" ),
tr( "Protocol cannot be submitted: \n"
"Number of scans per cell per wavelengths is %1. \n"
- "It must be less than 1501. \n\n"
+ "It must not exceed 1501. \n\n"
"Please revise experiment parameters accordingly." ).arg( ScanCount ) );
return;
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.h
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-08-07 20:01:20 UTC (rev 2803)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.h 2019-08-08 01:00:11 UTC (rev 2804)
@@ -910,6 +910,8 @@
bool solutions_change;
+ int ScanCount_global;
+
bool connection_status;
QString xpnhost;
int xpnport;
Modified: trunk/programs/us_experiment/us_proto_ranges.cpp
===================================================================
--- trunk/programs/us_experiment/us_proto_ranges.cpp 2019-08-07 20:01:20 UTC (rev 2803)
+++ trunk/programs/us_experiment/us_proto_ranges.cpp 2019-08-08 01:00:11 UTC (rev 2804)
@@ -637,7 +637,8 @@
scancount = int( duration_sec / scanint_sec );
else
scancount = int( duration_sec / (scanint_sec_min * tot_wvl) );
-
+
+ mainw->ScanCount_global = scancount;
QString scancount_stage = tr( "Stage %1. Number of Scans per Wavelength: %2 " ).arg(i+1).arg(scancount);
cb_scancount->addItem( scancount_stage );
}
@@ -777,6 +778,8 @@
scancount = int( duration_sec / scanint_sec );
else
scancount = int( duration_sec / (scanint_sec_min * tot_wvl) );
+
+ mainw->ScanCount_global = scancount;
QString scancount_stage = tr( "Stage %1. Number of Scans per Wavelength: %2 " ).arg(i+1).arg(scancount);
cb_scancount->addItem( scancount_stage );
1
0
Author: gegorbet
Date: 2019-08-07 20:01:20 +0000 (Wed, 07 Aug 2019)
New Revision: 2803
Added:
trunk/programs/us_density_match/
trunk/programs/us_density_match/us_density_match.cpp
trunk/programs/us_density_match/us_density_match.h
trunk/programs/us_density_match/us_density_match.pro
trunk/programs/us_density_match/us_remove_models.cpp
trunk/programs/us_density_match/us_remove_models.h
Log:
first shell for density_match program
Index: trunk/programs/us_density_match
===================================================================
--- trunk/programs/us_density_match 2019-08-06 23:37:59 UTC (rev 2802)
+++ trunk/programs/us_density_match 2019-08-07 20:01:20 UTC (rev 2803)
Property changes on: trunk/programs/us_density_match
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,4 ##
+Makefile
+moc
+obj
+.qmake.stash
Added: trunk/programs/us_density_match/us_density_match.cpp
===================================================================
--- trunk/programs/us_density_match/us_density_match.cpp (rev 0)
+++ trunk/programs/us_density_match/us_density_match.cpp 2019-08-07 20:01:20 UTC (rev 2803)
@@ -0,0 +1,1454 @@
+//! \file us_density_match.cpp
+
+#include <QApplication>
+
+#include "us_density_match.h"
+#include "us_remove_models.h"
+#include "us_select_runs.h"
+#include "us_model.h"
+#include "us_license_t.h"
+#include "us_license.h"
+#include "us_settings.h"
+#include "us_gui_settings.h"
+#include "us_gui_util.h"
+#include "us_math2.h"
+#include "us_matrix.h"
+#include "us_sleep.h"
+#include "us_passwd.h"
+#include "us_report.h"
+#include "us_constants.h"
+#define DbgLv(a) if(dbg_level>=a)qDebug()
+#if QT_VERSION < 0x050000
+#define setSamples(a,b,c) setData(a,b,c)
+#define setMinimum(a) setMinValue(a)
+#define setMaximum(a) setMaxValue(a)
+#endif
+
+#define PA_TMDIS_MS 0 // default Plotall time per distro in milliseconds
+
+// main program
+int main( int argc, char* argv[] )
+{
+ QApplication application( argc, argv );
+
+ #include "main1.inc"
+
+ // License is OK. Start up.
+
+ US_Density_Match w;
+ w.show(); //!< \memberof QWidget
+ return application.exec(); //!< \memberof QApplication
+}
+
+// qSort LessThan method for S_Solute sort
+bool distro_lessthan( const S_Solute &solu1, const S_Solute &solu2 )
+{ // TRUE iff (s1<s2) || (s1==s2 && k1<k2)
+ return ( solu1.s < solu2.s ) ||
+ ( ( solu1.s == solu2.s ) && ( solu1.k < solu2.k ) );
+}
+
+// US_Density_Match class constructor
+US_Density_Match::US_Density_Match() : US_Widgets()
+{
+ // set up the GUI
+
+ setWindowTitle( tr( "Density Matching" ) );
+ setPalette( US_GuiSettings::frameColor() );
+
+
+ // primary layouts
+ QHBoxLayout* main = new QHBoxLayout( this );
+ QVBoxLayout* left = new QVBoxLayout();
+ QGridLayout* spec = new QGridLayout();
+ main->setSpacing ( 2 );
+ main->setContentsMargins( 2, 2, 2, 2 );
+ left->setSpacing ( 0 );
+ left->setContentsMargins( 0, 1, 0, 1 );
+ spec->setSpacing ( 1 );
+ spec->setContentsMargins( 0, 0, 0, 0 );
+
+ int s_row = 0;
+ dbg_level = US_Settings::us_debug();
+DbgLv(1) << "MD: main: AA";
+ clean_etc_dir();
+
+ // Top banner
+ QLabel* lb_info1 = us_banner( tr( "Model Selection Controls" ) );
+
+
+ us_checkbox( tr( "Save Plot(s)" ), ck_savepl, false );
+ us_checkbox( tr( "Local Save Only" ), ck_locsave, true );
+
+#if 0
+ QLabel* lb_curr_distr = us_label( tr( "Current Distro:" ) );
+ lb_curr_distr->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
+
+ ct_curr_distr = us_counter( 3, 0.0, 10.0, 0.0 );
+ ct_curr_distr->setSingleStep( 1 );
+ connect( ct_curr_distr, SIGNAL( valueChanged ( double ) ),
+ this, SLOT( update_curr_distr( double ) ) );
+#endif
+
+ te_distr_info = us_textedit();
+ te_distr_info->setText ( tr( "Run: runID.triple (method)\n" )
+ + tr( " analysisID" ) );
+ us_setReadOnly( te_distr_info, true );
+
+// le_cmap_name = us_lineedit(
+// tr( "Default Color Map: w-cyan-magenta-red-black" ), -1, true );
+// te_distr_info->setMaximumHeight( le_cmap_name->height() * 2 );
+
+ plot_x = 0;
+ plot_y = 1;
+#if 0
+ QLabel* lb_x_axis = us_label( tr( "Plot X:" ) );
+ QLabel* lb_y_axis = us_label( tr( "Plot Y:" ) );
+ bg_x_axis = new QButtonGroup( this );
+ bg_y_axis = new QButtonGroup( this );
+ QGridLayout* gl_x_s = us_radiobutton( tr( "s" ), rb_x_s, true );
+ QGridLayout* gl_x_ff0 = us_radiobutton( tr( "ff0" ), rb_x_ff0, false );
+ QGridLayout* gl_x_mw = us_radiobutton( tr( "mw" ), rb_x_mw, false );
+ QGridLayout* gl_x_vbar = us_radiobutton( tr( "vbar"), rb_x_vbar, false );
+ QGridLayout* gl_x_D = us_radiobutton( tr( "D" ), rb_x_D, false );
+ QGridLayout* gl_x_f = us_radiobutton( tr( "f" ), rb_x_f, false );
+ QGridLayout* gl_y_s = us_radiobutton( tr( "s" ), rb_y_s, false );
+ QGridLayout* gl_y_ff0 = us_radiobutton( tr( "ff0" ), rb_y_ff0, true );
+ QGridLayout* gl_y_mw = us_radiobutton( tr( "mw" ), rb_y_mw, false );
+ QGridLayout* gl_y_vbar = us_radiobutton( tr( "vbar"), rb_y_vbar, false );
+ QGridLayout* gl_y_D = us_radiobutton( tr( "D" ), rb_y_D, false );
+ QGridLayout* gl_y_f = us_radiobutton( tr( "f" ), rb_y_f, false );
+ bg_x_axis->addButton( rb_x_s, ATTR_S );
+ bg_x_axis->addButton( rb_x_ff0, ATTR_K );
+ bg_x_axis->addButton( rb_x_mw, ATTR_W );
+ bg_x_axis->addButton( rb_x_vbar, ATTR_V );
+ bg_x_axis->addButton( rb_x_D, ATTR_D );
+ bg_x_axis->addButton( rb_x_f, ATTR_F );
+ bg_y_axis->addButton( rb_y_s, ATTR_S );
+ bg_y_axis->addButton( rb_y_ff0, ATTR_K );
+ bg_y_axis->addButton( rb_y_mw, ATTR_W );
+ bg_y_axis->addButton( rb_y_vbar, ATTR_V );
+ bg_y_axis->addButton( rb_y_D, ATTR_D );
+ bg_y_axis->addButton( rb_y_f, ATTR_F );
+ rb_x_s ->setChecked( true );
+ rb_y_s ->setEnabled( false );
+ rb_y_ff0 ->setChecked( true );
+ rb_x_ff0 ->setEnabled( false );
+ rb_x_s ->setToolTip( tr( "Set X axis to Sedimentation Coefficient" ) );
+ rb_x_ff0 ->setToolTip( tr( "Set X axis to Frictional Ratio" ) );
+ rb_x_mw ->setToolTip( tr( "Set X axis to Molecular Weight" ) );
+ rb_x_vbar->setToolTip( tr( "Set X axis to Partial Specific Volume" ) );
+ rb_x_D ->setToolTip( tr( "Set X axis to Diffusion Coefficient" ) );
+ rb_x_f ->setToolTip( tr( "Set X axis to Frictional Coefficient" ) );
+ rb_y_s ->setToolTip( tr( "Set Y axis to Sedimentation Coefficient" ) );
+ rb_y_ff0 ->setToolTip( tr( "Set Y axis to Frictional Ratio" ) );
+ rb_y_mw ->setToolTip( tr( "Set Y axis to Molecular Weight" ) );
+ rb_y_vbar->setToolTip( tr( "Set Y axis to Partial Specific Volume" ) );
+ rb_y_D ->setToolTip( tr( "Set Y axis to Diffusion Coefficient" ) );
+ rb_y_f ->setToolTip( tr( "Set Y axis to Frictional Coefficient" ) );
+ connect( bg_x_axis, SIGNAL( buttonReleased( int ) ),
+ this, SLOT ( select_x_axis ( int ) ) );
+ connect( bg_y_axis, SIGNAL( buttonReleased( int ) ),
+ this, SLOT ( select_y_axis ( int ) ) );
+#endif
+
+ pb_refresh = us_pushbutton( tr( "Refresh Plot" ) );
+ pb_refresh->setEnabled( false );
+ connect( pb_refresh, SIGNAL( clicked() ),
+ this, SLOT( plot_data() ) );
+
+ pb_reset = us_pushbutton( tr( "Reset" ) );
+ pb_reset->setEnabled( true );
+ connect( pb_reset, SIGNAL( clicked() ),
+ this, SLOT( reset() ) );
+
+ dkdb_cntrls = new US_Disk_DB_Controls(
+ US_Settings::default_data_location() );
+ connect( dkdb_cntrls, SIGNAL( changed( bool ) ),
+ this, SLOT( update_disk_db( bool ) ) );
+
+ pb_prefilt = us_pushbutton( tr( "Select PreFilter" ) );
+
+#if 0
+ pb_ldcolor = us_pushbutton( tr( "Load Color File" ) );
+ pb_ldcolor->setEnabled( true );
+ connect( pb_ldcolor, SIGNAL( clicked() ),
+ this, SLOT( load_color() ) );
+#endif
+
+ le_prefilt = us_lineedit( tr( "" ), -1, true );
+ connect( pb_prefilt, SIGNAL( clicked() ),
+ this, SLOT( select_prefilt() ) );
+
+ pb_lddistr = us_pushbutton( tr( "Load Distribution(s)" ) );
+ pb_lddistr->setEnabled( true );
+ connect( pb_lddistr, SIGNAL( clicked() ),
+ this, SLOT( load_distro() ) );
+
+ pb_rmvdist = us_pushbutton( tr( "Remove Distribution(s)" ) );
+ pb_rmvdist->setEnabled( true );
+ connect( pb_rmvdist, SIGNAL( clicked() ),
+ this, SLOT( remove_distro() ) );
+
+ pb_help = us_pushbutton( tr( "Help" ) );
+ pb_help->setEnabled( true );
+ connect( pb_help, SIGNAL( clicked() ),
+ this, SLOT( help() ) );
+
+ pb_close = us_pushbutton( tr( "Close" ) );
+ pb_close->setEnabled( true );
+ connect( pb_close, SIGNAL( clicked() ),
+ this, SLOT( close() ) );
+
+ // Order plot components on the left side
+ spec->addWidget( lb_info1, s_row++, 0, 1, 8 );
+ spec->addLayout( dkdb_cntrls, s_row++, 0, 1, 8 );
+ spec->addWidget( le_prefilt, s_row++, 0, 1, 8 );
+ spec->addWidget( pb_prefilt, s_row++, 0, 1, 4 );
+ //spec->addWidget( pb_ldcolor, s_row++, 4, 1, 4 );
+ spec->addWidget( pb_lddistr, s_row, 0, 1, 4 );
+ spec->addWidget( pb_rmvdist, s_row++, 4, 1, 4 );
+ spec->addWidget( pb_refresh, s_row, 0, 1, 4 );
+ spec->addWidget( pb_reset, s_row++, 4, 1, 4 );
+
+
+ spec->addWidget( ck_savepl, s_row, 0, 1, 4 );
+ spec->addWidget( ck_locsave, s_row++, 4, 1, 4 );
+// spec->addWidget( lb_curr_distr, s_row, 0, 1, 4 );
+// spec->addWidget( ct_curr_distr, s_row++, 4, 1, 4 );
+ spec->addWidget( te_distr_info, s_row, 0, 2, 8 ); s_row += 2;
+ //spec->addWidget( le_cmap_name, s_row++, 0, 1, 8 );
+#if 0
+ spec->addWidget( lb_x_axis, s_row, 0, 1, 2 );
+ spec->addLayout( gl_x_s, s_row, 2, 1, 1 );
+ spec->addLayout( gl_x_ff0, s_row, 3, 1, 1 );
+ spec->addLayout( gl_x_mw, s_row, 4, 1, 1 );
+ spec->addLayout( gl_x_vbar, s_row, 5, 1, 1 );
+ spec->addLayout( gl_x_D, s_row, 6, 1, 1 );
+ spec->addLayout( gl_x_f, s_row++, 7, 1, 1 );
+ spec->addWidget( lb_y_axis, s_row, 0, 1, 2 );
+ spec->addLayout( gl_y_s, s_row, 2, 1, 1 );
+ spec->addLayout( gl_y_ff0, s_row, 3, 1, 1 );
+ spec->addLayout( gl_y_mw, s_row, 4, 1, 1 );
+ spec->addLayout( gl_y_vbar, s_row, 5, 1, 1 );
+ spec->addLayout( gl_y_D, s_row, 6, 1, 1 );
+ spec->addLayout( gl_y_f, s_row++, 7, 1, 1 );
+#endif
+
+ // Set up analysis controls
+ QLabel* lb_analysis = us_banner( tr( "Analysis Controls" ) );
+ QLabel* lb_smoothing = us_label ( tr( "Data Smoothing:" ) );
+ QLabel* lb_boundPercent = us_label ( tr( "% of Boundary:" ) );
+ QLabel* lb_boundPos = us_label ( tr( "Boundary Position (%):" ) );
+#if 0
+ lb_tolerance = us_label( tr( "Back Diffusion Tolerance:" ) );
+ lb_tolerance->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
+
+ ct_tolerance = us_counter( 3, 0.001, 1.0, 0.001 );
+ ct_tolerance->setSingleStep( 0.001 );
+ ct_tolerance->setEnabled( true );
+ connect( ct_tolerance, SIGNAL( valueChanged( double ) ),
+ this, SLOT( update_bdtoler( double ) ) );
+#endif
+
+ lb_division = us_label( tr( "Divisions:" ) );
+ lb_division->setAlignment( Qt::AlignVCenter | Qt::AlignLeft );
+
+ ct_division = us_counter( 3, 0, 100, 50 );
+ ct_division->setSingleStep( 1 );
+ ct_division->setEnabled( true );
+ connect( ct_division, SIGNAL( valueChanged( double ) ),
+ this, SLOT( update_divis( double ) ) );
+ ct_smoothing = us_counter( 2, 1, 100, 1 );
+ ct_boundaryPercent = us_counter( 3, 10, 100, 1 );
+ ct_boundaryPos = us_counter( 3, 0, 100, 1 );
+
+ ct_smoothing ->setSingleStep( 1 );
+ ct_boundaryPercent->setSingleStep( 1 );
+ ct_boundaryPos ->setSingleStep( 1 );
+ ct_smoothing ->setValue( 1 );
+ ct_boundaryPercent->setValue( 90 );
+ ct_boundaryPos ->setValue( 5 );
+
+ spec->addWidget( lb_analysis , s_row++, 0, 1, 8 );
+// spec->addWidget( lb_tolerance , s_row, 0, 1, 4 );
+// spec->addWidget( ct_tolerance , s_row++, 4, 1, 4 );
+ spec->addWidget( lb_division , s_row, 0, 1, 4 );
+ spec->addWidget( ct_division , s_row++, 4, 1, 4 );
+ spec->addWidget( lb_smoothing , s_row, 0, 1, 4 );
+ spec->addWidget( ct_smoothing , s_row++, 4, 1, 4 );
+ spec->addWidget( lb_boundPercent , s_row, 0, 1, 4 );
+ spec->addWidget( ct_boundaryPercent, s_row++, 4, 1, 4 );
+ spec->addWidget( lb_boundPos , s_row, 0, 1, 4 );
+ spec->addWidget( ct_boundaryPos , s_row++, 4, 1, 4 );
+
+
+ spec->addWidget( pb_help, ++s_row, 0, 1, 4 );
+ spec->addWidget( pb_close, s_row++, 4, 1, 4 );
+
+ // Set up plot component window on right side
+ //xa_title = anno_title( ATTR_S );
+ //ya_title = anno_title( ATTR_K );
+ xa_title = tr( "Sedimentation Coefficient x 1.e+13" );
+ ya_title = tr( "Boundary Fraction" );
+ QBoxLayout* plot = new US_Plot( data_plot,
+ tr( "Density Matching Data" ), xa_title, ya_title );
+
+ data_plot->setMinimumSize( 600, 600 );
+
+ data_plot->enableAxis( QwtPlot::xBottom, true );
+ data_plot->enableAxis( QwtPlot::yLeft, true );
+ data_plot->setAxisScale( QwtPlot::xBottom, -200.0, 200.0 );
+ data_plot->setAxisScale( QwtPlot::yLeft, 0.0, 1.0 );
+ data_plot->setCanvasBackground( Qt::white );
+#if 0
+ QwtText zTitle( "Partial Concentration" );
+ zTitle.setFont( QFont( US_GuiSettings::fontFamily(),
+ US_GuiSettings::fontSize(), QFont::Bold ) );
+ data_plot->setAxisTitle( QwtPlot::yRight, zTitle );
+#endif
+
+ pick = new US_PlotPicker( data_plot );
+ pick->setRubberBand( QwtPicker::RectRubberBand );
+
+ // put layouts together for overall layout
+ left->addLayout( spec );
+ left->addStretch();
+
+ main->addLayout( left );
+ main->addLayout( plot );
+ main->setStretchFactor( left, 3 );
+ main->setStretchFactor( plot, 5 );
+
+ mfilter = "";
+ plt_zmin = 1e+8;
+ plt_zmax = -1e+8;
+ runsel = true;
+ latest = true;
+
+ // Set up variables and initial state of GUI
+
+ reset();
+}
+
+void US_Density_Match::reset( void )
+{
+DbgLv(1) << "MD: reset: AA";
+ dataPlotClear( data_plot );
+ data_plot->replot();
+
+ need_save = false;
+
+ plot_x = ATTR_S;
+ plot_y = ATTR_K;
+// resolu = 90.0;
+// ct_resolu->setRange( 1.0, 100.0 );
+// ct_resolu->setSingleStep( 1.0 );
+// ct_resolu->setValue( resolu );
+
+#if 0
+ xreso = 300.0;
+ yreso = 300.0;
+ ct_xreso->setRange( 10.0, 1000.0 );
+ ct_xreso->setSingleStep( 1.0 );
+ ct_xreso->setValue( (double)xreso );
+ ct_yreso->setRange( 10.0, 1000.0 );
+ ct_yreso->setSingleStep( 1.0 );
+ ct_yreso->setValue( (double)yreso );
+
+ zfloor = 100.0;
+ ct_zfloor->setRange( 50.0, 150.0 );
+ ct_zfloor->setSingleStep( 1.0 );
+ ct_zfloor->setValue( (double)zfloor );
+
+ auto_sxy = true;
+ ck_autosxy->setChecked( auto_sxy );
+ auto_scz = true;
+ ck_autoscz->setChecked( auto_scz );
+ cont_loop = false;
+ ck_conloop->setChecked( cont_loop );
+ ck_savepl ->setChecked( false );
+ ck_locsave->setChecked( true );
+
+ plt_kmin = 0.8;
+ plt_kmax = 4.2;
+ ct_plt_kmin->setRange( 0.0, 50.0 );
+ ct_plt_kmin->setSingleStep( 0.01 );
+ ct_plt_kmin->setValue( plt_kmin );
+ ct_plt_kmin->setEnabled( false );
+ ct_plt_kmax->setRange( 1.0, 50.0 );
+ ct_plt_kmax->setSingleStep( 0.01 );
+ ct_plt_kmax->setValue( plt_kmax );
+ ct_plt_kmax->setEnabled( false );
+
+ plt_smin = 1.0;
+ plt_smax = 10.0;
+ ct_plt_smin->setRange( -10.0, 10000.0 );
+ ct_plt_smin->setSingleStep( 0.01 );
+ ct_plt_smin->setValue( plt_smin );
+ ct_plt_smin->setEnabled( false );
+ ct_plt_smax->setRange( 0.0, 10000.0 );
+ ct_plt_smax->setSingleStep( 0.01 );
+ ct_plt_smax->setValue( plt_smax );
+ ct_plt_smax->setEnabled( false );
+
+ curr_distr = 0;
+ ct_curr_distr->setRange( 1.0, 1.0 );
+ ct_curr_distr->setSingleStep( 1.0 );
+ ct_curr_distr->setValue( curr_distr + 1 );
+ ct_curr_distr->setEnabled( false );
+#endif
+
+ // default to white-cyan-magenta-red-black color map
+ colormap = new QwtLinearColorMap( Qt::white, Qt::black );
+ colormap->addColorStop( 0.10, Qt::cyan );
+ colormap->addColorStop( 0.50, Qt::magenta );
+ colormap->addColorStop( 0.80, Qt::red );
+ cmapname = tr( "Default Color Map: w-cyan-magenta-red-black" );
+
+ stop();
+ system.clear();
+ pfilts.clear();
+// pb_pltall ->setEnabled( false );
+ pb_refresh->setEnabled( false );
+ pb_rmvdist->setEnabled( false );
+ le_prefilt->setText( tr( "(no prefilter)" ) );
+}
+
+// plot the data
+void US_Density_Match::plot_data( void )
+{
+ int syssiz = system.size();
+
+ if ( syssiz < 1 )
+ return;
+
+ if ( curr_distr < 0 || curr_distr >= syssiz )
+ { // current distro index somehow out of valid range
+ qDebug() << "curr_distr=" << curr_distr
+ << " ( sys.size()=" << syssiz << " )";
+ syssiz--;
+ curr_distr = qBound( curr_distr, 0, syssiz );
+ }
+
+ zpcent = ck_zpcent->isChecked();
+
+ // Get current distro and (if need be) rebuild XY distro
+ DisSys* tsys = (DisSys*)&system.at( curr_distr );
+ QList< S_Solute >* sol_d = &tsys->sk_distro;
+
+ build_xy_distro();
+
+ if ( zpcent )
+ {
+ data_plot->setAxisTitle( QwtPlot::yRight,
+ tr( "Percent of Total Concentration" ) );
+ sol_d = &tsys->xy_distro_zp;
+ }
+
+ else
+ {
+ data_plot->setAxisTitle( QwtPlot::yRight,
+ tr( "Partial Concentration" ) );
+ sol_d = &tsys->xy_distro;
+ }
+
+ colormap = tsys->colormap;
+ cmapname = tsys->cmapname;
+
+ QString tstr = tsys->run_name + "\n" + tsys->analys_name
+ + "\n" + tsys->method;
+ data_plot->setTitle( tstr );
+ data_plot->detachItems( QwtPlotItem::Rtti_PlotSpectrogram );
+ QColor bg = colormap->color1();
+ data_plot->setCanvasBackground( bg );
+ int csum = bg.red() + bg.green() + bg.blue();
+ pick->setTrackerPen( QPen( csum > 600 ? QColor( Qt::black ) :
+ QColor( Qt::white ) ) );
+
+ // Set up spectrogram data
+ QwtPlotSpectrogram* d_spectrogram = new QwtPlotSpectrogram();
+#if QT_VERSION < 0x050000
+ d_spectrogram->setData( US_SpectrogramData() );
+ d_spectrogram->setColorMap( *colormap );
+ US_SpectrogramData& spec_dat = (US_SpectrogramData&)d_spectrogram->data();
+#else
+ US_SpectrogramData* rdata = new US_SpectrogramData();
+ d_spectrogram->setData( rdata );
+// d_spectrogram->setColorMap( (QwtColorMap*)colormap );
+ d_spectrogram->setColorMap( ColorMapCopy( colormap ) );
+ US_SpectrogramData& spec_dat = (US_SpectrogramData&)*(d_spectrogram->data());
+#endif
+ QwtDoubleRect drect;
+
+ if ( auto_sxy )
+ drect = QwtDoubleRect( 0.0, 0.0, 0.0, 0.0 );
+
+ else
+ {
+ drect = QwtDoubleRect( plt_smin, plt_kmin,
+ ( plt_smax - plt_smin ), ( plt_kmax - plt_kmin ) );
+ }
+
+ plt_zmin = zpcent ? 100.0 : 1e+8;
+ plt_zmax = zpcent ? 0.0 : -1e+8;
+
+ if ( auto_scz )
+ { // Find Z min,max for current distribution
+ for ( int jj = 0; jj < sol_d->size(); jj++ )
+ {
+ double zval = sol_d->at( jj ).c;
+ plt_zmin = qMin( plt_zmin, zval );
+ plt_zmax = qMax( plt_zmax, zval );
+ }
+ }
+ else
+ { // Find Z min,max for all distributions
+ for ( int ii = 0; ii < system.size(); ii++ )
+ {
+ DisSys* tsys = (DisSys*)&system.at( ii );
+ QList< S_Solute >* sol_z = zpcent ? &tsys->sk_distro_zp
+ : &tsys->sk_distro;
+
+ for ( int jj = 0; jj < sol_z->size(); jj++ )
+ {
+ double zval = sol_z->at( jj ).c;
+ plt_zmin = qMin( plt_zmin, zval );
+ plt_zmax = qMax( plt_zmax, zval );
+ }
+ }
+ }
+
+ spec_dat.setRastRanges( xreso, yreso, resolu, zfloor, drect );
+ spec_dat.setZRange( 0.0, plt_zmax );
+ spec_dat.setRaster( sol_d );
+
+ d_spectrogram->attach( data_plot );
+
+ // set color map and axis settings
+ QwtScaleWidget *rightAxis = data_plot->axisWidget( QwtPlot::yRight );
+ rightAxis->setColorBarEnabled( true );
+
+ xa_title = anno_title( plot_x );
+ ya_title = anno_title( plot_y );
+ data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
+ data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
+
+ if ( auto_sxy )
+ { // Auto scale x and y
+ data_plot->setAxisAutoScale( QwtPlot::yLeft );
+ data_plot->setAxisAutoScale( QwtPlot::xBottom );
+ }
+ else
+ { // Manual limits on x and y
+ double lStep = data_plot->axisStepSize( QwtPlot::yLeft );
+ double bStep = data_plot->axisStepSize( QwtPlot::xBottom );
+ data_plot->setAxisScale( QwtPlot::xBottom, plt_smin, plt_smax, bStep );
+ data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax, lStep );
+ }
+
+#if QT_VERSION < 0x050000
+ rightAxis->setColorMap( QwtDoubleInterval( 0.0, plt_zmax ),
+ d_spectrogram->colorMap() );
+#else
+// rightAxis->setColorMap( QwtInterval( plt_zmin, plt_zmax ),
+// (QwtColorMap*)d_spectrogram->colorMap() );
+ rightAxis->setColorMap( QwtInterval( 0.0, plt_zmax ),
+ ColorMapCopy( colormap ) );
+#endif
+// data_plot->setAxisScale( QwtPlot::yRight, plt_zmin, plt_zmax );
+ data_plot->setAxisScale( QwtPlot::yRight, 0.0, plt_zmax );
+
+ data_plot->replot();
+
+ //QString dtext = te_distr_info->toPlainText().section( "\n", 0, 1 );
+ QString dtext = tr( "Run: " ) + tsys->run_name
+ + " (" + tsys->method + ")\n " + tsys->analys_name;
+
+ bool sv_plot = ck_savepl->isChecked() &&
+ ( ( looping && !ck_conloop->isChecked() ) || !looping );
+DbgLv(2) << "(1) sv_plot" << sv_plot << "looping" << looping;
+
+DbgLv(2) << "(3) need_save sv_plot" << need_save << sv_plot;
+ //if ( need_save && sv_plot )
+ if ( sv_plot )
+ { // Automatically save plot image in a PNG file
+ const QString s_attrs[] = { "s", "ff0", "MW", "vbar", "D", "f" };
+#if QT_VERSION > 0x050000
+ QPixmap plotmap = ((QWidget*)data_plot)->grab();
+#else
+ QSize pmsize = data_plot->size();
+ QPixmap plotmap = QPixmap::grabWidget( data_plot, 0, 0,
+ pmsize.width(), pmsize.height() );
+#endif
+
+ QString runid = tsys->run_name.section( ".", 0, -2 );
+ QString triple = tsys->run_name.section( ".", -1, -1 );
+ QString report = QString( "pseudo3d_" ) + s_attrs[ plot_x ]
+ + "_" + s_attrs[ plot_y ];
+
+ QString ofdir = US_Settings::reportDir() + "/" + runid;
+ QDir dirof( ofdir );
+ if ( !dirof.exists( ) )
+ QDir( US_Settings::reportDir() ).mkdir( runid );
+ QString ofname = tsys->method + "." + triple + "." + report + ".png";
+ QString ofpath = ofdir + "/" + ofname;
+
+ plotmap.save( ofpath );
+ dtext = dtext + tr( "\nPLOT %1 SAVED to local" )
+ .arg( curr_distr + 1 );
+
+ if ( dkdb_cntrls->db() && !ck_locsave->isChecked() )
+ { // Save a copy to the database
+QDateTime time0=QDateTime::currentDateTime();
+ US_Passwd pw;
+ US_DB2 db( pw.getPasswd() );
+ QStringList query;
+ query << "get_editID" << tsys->editGUID;
+ db.query( query );
+ db.next();
+ int idEdit = db.value( 0 ).toString().toInt();
+ US_Report freport;
+ freport.runID = runid;
+ freport.saveDocumentFromFile( ofdir, ofname, &db, idEdit );
+QDateTime time1=QDateTime::currentDateTime();
+qDebug() << "DB-save: currdist" << curr_distr
+ << "svtime:" << time0.msecsTo(time1);
+ dtext = dtext + tr( " and DB" );
+ }
+ }
+
+ else
+ dtext = dtext + tr( "\n(no plot saved)" );
+
+ te_distr_info->setText( dtext );
+
+}
+
+void US_Density_Match::plot_data( int )
+{
+ plot_data();
+}
+
+void US_Density_Match::update_resolu( double dval )
+{
+ resolu = dval;
+}
+
+void US_Density_Match::update_xreso( double dval )
+{
+ xreso = dval;
+}
+
+void US_Density_Match::update_yreso( double dval )
+{
+ yreso = dval;
+}
+
+void US_Density_Match::update_zfloor( double dval )
+{
+ zfloor = dval;
+}
+
+void US_Density_Match::update_curr_distr( double dval )
+{
+ curr_distr = qRound( dval ) - 1;
+DbgLv(1) << "upd_curr_distr" << curr_distr;
+
+ if ( curr_distr > (-1) && curr_distr < system.size() )
+ {
+ DisSys* tsys = (DisSys*)&system.at( curr_distr );
+ cmapname = tsys->cmapname;
+// le_cmap_name->setText( cmapname );
+ colormap = tsys->colormap;
+ if ( ! looping )
+ te_distr_info->setText( tr( "Run: " ) + tsys->run_name
+ + " (" + tsys->method + ")\n " + tsys->analys_name );
+ }
+
+ build_xy_distro();
+
+ set_limits();
+
+ plot_data();
+}
+
+void US_Density_Match::update_plot_smin( double dval )
+{
+ plt_smin = dval;
+DbgLv(1) << "plt_smin" << plt_smin;
+}
+
+void US_Density_Match::update_plot_smax( double dval )
+{
+ plt_smax = dval;
+DbgLv(1) << "plt_smax" << plt_smax;
+}
+
+void US_Density_Match::update_plot_kmin( double dval )
+{
+ plt_kmin = dval;
+}
+
+void US_Density_Match::update_plot_kmax( double dval )
+{
+ plt_kmax = dval;
+}
+
+void US_Density_Match::select_autosxy()
+{
+ auto_sxy = ck_autosxy->isChecked();
+ ct_plt_kmin->setEnabled( !auto_sxy );
+ ct_plt_kmax->setEnabled( !auto_sxy );
+ ct_plt_smin->setEnabled( !auto_sxy );
+ ct_plt_smax->setEnabled( !auto_sxy );
+
+ set_limits();
+}
+
+void US_Density_Match::select_autoscz()
+{
+ auto_scz = ck_autoscz->isChecked();
+
+ set_limits();
+}
+
+void US_Density_Match::select_conloop()
+{
+ cont_loop = ck_conloop->isChecked();
+ DisSys* tsys = (DisSys*)&system.at( curr_distr );
+ QString dtext = tr( "Run: " ) + tsys->run_name
+ + " (" + tsys->method + ")\n " + tsys->analys_name;
+
+ if ( cont_loop )
+ {
+ pb_pltall->setText( tr( "Plot All Distros in a Loop" ) );
+ dtext = dtext +
+ tr( "\nWith continuous loop, plot files are not saved." );
+ }
+ else
+ pb_pltall->setText( tr( "Plot All Distros" ) );
+
+ te_distr_info->setText( dtext );
+}
+
+void US_Density_Match::load_distro()
+{
+ // get a model description or set of descriptions for distribution data
+ QList< US_Model > models;
+ QStringList mdescs;
+ bool loadDB = dkdb_cntrls->db();
+
+ QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
+ US_ModelLoader dialog( loadDB, mfilter, models, mdescs, pfilts );
+ dialog.move( this->pos() + QPoint( 200, 200 ) );
+
+ connect( &dialog, SIGNAL( changed( bool ) ),
+ this, SLOT( update_disk_db( bool ) ) );
+ QApplication::restoreOverrideCursor();
+
+ if ( dialog.exec() != QDialog::Accepted )
+ return; // no selection made
+
+ need_save = false;
+
+ for ( int jj = 0; jj < models.count(); jj++ )
+ { // load each selected distribution model
+ load_distro( models[ jj ], mdescs[ jj ] );
+ }
+
+ curr_distr = system.size() - 1;
+ need_save = ck_savepl->isChecked() && !cont_loop;
+ ct_curr_distr->setEnabled( true );
+ ct_curr_distr->setValue( curr_distr + 1 );
+ pb_rmvdist->setEnabled( models.count() > 0 );
+
+ update_curr_distr( (double)system.size() );
+}
+
+void US_Density_Match::load_distro( US_Model model, QString mdescr )
+{
+ DisSys tsys;
+ S_Solute sol_sk;
+ S_Solute sol_xy;
+
+ model.update_coefficients(); // fill in any missing coefficients
+
+ QString mdesc = mdescr.section( mdescr.left( 1 ), 1, 1 );
+
+ // load current colormap
+ tsys.colormap = colormap;
+ tsys.cmapname = cmapname;
+
+ tsys.run_name = mdesc.section( ".", 0, -3 );
+ QString asys = mdesc.section( ".", -2, -2 );
+ tsys.analys_name = asys.section( "_", 0, -4 ) + "_"
+ + asys.section( "_", -2, -1 );
+ tsys.method = model.typeText();
+ tsys.method = ( mdesc.contains( "-CG" ) )
+ ? tsys.method.replace( "2DSA", "2DSA-CG" )
+ : tsys.method;
+ if ( model.global == US_Model::GLOBAL )
+ {
+ tsys.method = QString( mdesc ).section( '.', 2, 2 )
+ .section( '_', 2, 2 );
+ }
+ tsys.editGUID = model.editGUID;
+ tsys.plot_x = plot_x;
+ tsys.plot_y = plot_y;
+DbgLv(1) << "LD: method" << tsys.method << "mdesc" << mdesc;
+
+ if ( tsys.method == "Manual" || tsys.method == "CUSTOMGRID" )
+ {
+ int jj = mdesc.indexOf( ".model" );
+ mdesc = ( jj < 1 ) ? mdesc : mdesc.left( jj );
+ tsys.run_name = mdesc + ".0Z280";
+ tsys.analys_name = "e00_a00_" + tsys.method + "_local";
+DbgLv(1) << "LD: run_name" << tsys.run_name;
+DbgLv(1) << "LD: analys_name" << tsys.analys_name;
+ }
+
+ tsys.distro_type = (int)model.analysis;
+ tsys.monte_carlo = model.monteCarlo;
+
+ if ( model.monteCarlo )
+ { // Revisit setting if Monte Carlo
+ QString miter = mdescr.section( mdescr.left( 1 ), 6 );
+ int kiter = miter.isEmpty() ? 0 : miter.toInt();
+
+ if ( kiter < 2 )
+ { // Turn off flag if not composite MC model (is individual MC)
+ tsys.monte_carlo = false;
+ }
+ }
+
+
+ te_distr_info->setText( tr( "Run: " ) + tsys.run_name
+ + " (" + tsys.method + ")\n " + tsys.analys_name );
+ plt_zmin_co = 1e+8;
+ plt_zmax_co = -1e+8;
+ plt_zmin_zp = 100.0;
+ plt_zmax_zp = 0.0;
+ int nsolmc = model.components.size();
+
+ // read in and set distribution s,k,c,... values
+ if ( tsys.distro_type != (int)US_Model::COFS )
+ {
+ double tot_conc = 0.0;
+
+ for ( int jj = 0; jj < nsolmc; jj++ )
+ {
+ sol_sk.s = model.components[ jj ].s * 1.0e13;
+ sol_sk.k = model.components[ jj ].f_f0;
+ sol_sk.c = model.components[ jj ].signal_concentration;
+ sol_sk.w = model.components[ jj ].mw;
+ sol_sk.v = model.components[ jj ].vbar20;
+ sol_sk.d = model.components[ jj ].D * 1.0e7;
+ sol_sk.f = model.components[ jj ].f;
+
+ sol_xy = sol_sk;
+ sol_xy.s = ( plot_x == ATTR_S ) ? sol_sk.s : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_K ) ? sol_sk.k : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_W ) ? sol_sk.w : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_V ) ? sol_sk.v : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_D ) ? sol_sk.d : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_F ) ? sol_sk.f : sol_xy.s;
+ sol_xy.k = ( plot_y == ATTR_S ) ? sol_sk.s : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_K ) ? sol_sk.k : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_W ) ? sol_sk.w : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_V ) ? sol_sk.v : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_D ) ? sol_sk.d : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_F ) ? sol_sk.f : sol_xy.k;
+
+ tsys.sk_distro << sol_sk;
+ tsys.xy_distro << sol_xy;
+
+ plt_zmin_co = qMin( plt_zmin_co, sol_sk.c );
+ plt_zmax_co = qMax( plt_zmax_co, sol_sk.c );
+ tot_conc += sol_sk.c;
+ }
+DbgLv(1) << "LD: zmin zmax totconc" << plt_zmin_co << plt_zmax_co << tot_conc;
+
+ // sort and reduce distributions
+ sort_distro( tsys.sk_distro, false );
+ sort_distro( tsys.xy_distro, true );
+ int nsolsk = tsys.sk_distro.size();
+ int nsolxy = tsys.xy_distro.size();
+DbgLv(1) << "LD: nsolsk nsolxy nsolmc" << nsolsk << nsolxy << nsolmc;
+ tsys.sk_distro_zp.clear();
+ tsys.xy_distro_zp.clear();
+
+ // Create Z-as-percentage version of distributions
+
+ for ( int jj = 0; jj < nsolmc; jj++ )
+ {
+ double cozpc;
+
+ if ( jj < nsolsk )
+ {
+ sol_sk = tsys.sk_distro[ jj ];
+ cozpc = sol_sk.c * 100.0 / tot_conc;
+ sol_sk.c = cozpc;
+ plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
+ plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
+ tsys.sk_distro_zp << sol_sk;
+ }
+
+ if ( jj < nsolxy )
+ {
+ sol_xy = tsys.xy_distro[ jj ];
+ cozpc = sol_xy.c * 100.0 / tot_conc;
+ sol_xy.c = cozpc;
+ plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
+ plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
+ tsys.xy_distro_zp << sol_xy;
+ }
+ }
+DbgLv(1) << "LD: zminzp zmaxzp" << plt_zmin_zp << plt_zmax_zp;
+ }
+
+ // update current distribution record
+ system.append( tsys );
+ int jd = system.size();
+ curr_distr = jd - 1;
+ ct_curr_distr->setRange( 1.0, jd );
+ ct_curr_distr->setSingleStep( 1.0 );
+ ct_curr_distr->setValue( jd );
+ ct_curr_distr->setEnabled( true );
+
+ if ( auto_sxy )
+ {
+DbgLv(1) << "LD: auto_sxy call set_limits";
+ set_limits();
+DbgLv(1) << "LD: auto_sxy rtn fr set_limits";
+ ct_plt_kmin->setEnabled( false );
+ ct_plt_kmax->setEnabled( false );
+ ct_plt_smin->setEnabled( false );
+ ct_plt_smax->setEnabled( false );
+ }
+ else
+ {
+ plt_smin = ct_plt_smin->value();
+ plt_smax = ct_plt_smax->value();
+ plt_kmin = ct_plt_kmin->value();
+ plt_kmax = ct_plt_kmax->value();
+DbgLv(1) << "LD: non-auto_sxy call set_limits";
+ set_limits();
+DbgLv(1) << "LD: non-auto_sxy rtn fr set_limits";
+ }
+ data_plot->setAxisScale( QwtPlot::xBottom, plt_smin, plt_smax );
+ data_plot->setAxisScale( QwtPlot::yLeft, plt_kmin, plt_kmax );
+
+ pb_pltall ->setEnabled( true );
+ pb_refresh->setEnabled( true );
+ pb_reset ->setEnabled( true );
+
+ if ( cont_loop )
+ pb_pltall->setText( tr( "Plot All Distros in a Loop" ) );
+ else
+ pb_pltall->setText( tr( "Plot All Distros" ) );
+DbgLv(1) << "LD: RETURN";
+}
+
+void US_Density_Match::load_color()
+{
+ QString filter = tr( "Color Map files (*cm-*.xml);;" )
+ + tr( "Any XML files (*.xml);;" )
+ + tr( "Any files (*)" );
+
+ // get an xml file name for the color map
+ QString fname = QFileDialog::getOpenFileName( this,
+ tr( "Load Color Map File" ),
+ US_Settings::etcDir(), filter, 0, 0 );
+
+ if ( fname.isEmpty() )
+ return;
+
+ // get the map from the file
+ QList< QColor > cmcolor;
+ QList< double > cmvalue;
+
+ US_ColorGradIO::read_color_steps( fname, cmcolor, cmvalue );
+ colormap = new QwtLinearColorMap( cmcolor.first(), cmcolor.last() );
+
+ for ( int jj = 1; jj < cmvalue.size() - 1; jj++ )
+ {
+ colormap->addColorStop( cmvalue.at( jj ), cmcolor.at( jj ) );
+ }
+ QFileInfo fi( fname );
+ cmapname = tr( "Color Map: " ) + fi.baseName();
+// le_cmap_name->setText( cmapname );
+
+ // save the map information for the current distribution
+ if ( curr_distr < system.size() )
+ {
+ DisSys* tsys = (DisSys*)&system.at( curr_distr );
+ tsys->colormap = colormap;
+ tsys->cmapname = cmapname;
+ }
+
+ plot_data();
+}
+
+// Start a loop of plotting all distros
+void US_Density_Match::plotall()
+{
+ looping = true;
+ pb_stopplt->setEnabled( true );
+ curr_distr = 0;
+ plot_data();
+ patm_dlay = qRound( ct_plt_dlay->value() * 1000.0 );
+
+ patm_id = startTimer( patm_dlay );
+
+ if ( curr_distr == system.size() )
+ curr_distr--;
+
+ need_save = ck_savepl->isChecked() && !cont_loop;
+}
+
+// Stop the distros-plotting loop
+void US_Density_Match::stop()
+{
+ looping = false;
+ need_save = ck_savepl->isChecked() && !cont_loop;
+}
+
+void US_Density_Match::set_limits()
+{
+ double smin = 1.0e30;
+ double smax = -1.0e30;
+ double kmin = 1.0e30;
+ double kmax = -1.0e30;
+ double sinc;
+ double kinc;
+ xa_title = anno_title( plot_x );
+ ya_title = anno_title( plot_y );
+
+ data_plot->setAxisTitle( QwtPlot::xBottom, xa_title );
+ data_plot->setAxisTitle( QwtPlot::yLeft, ya_title );
+
+ if ( system.size() < 1 )
+ return;
+
+ // find min,max for X,Y distributions
+ for ( int ii = 0; ii < system.size(); ii++ )
+ {
+ DisSys* tsys = (DisSys*)&system.at( ii );
+
+ for ( int jj = 0; jj < tsys->xy_distro.size(); jj++ )
+ {
+ double sval = tsys->xy_distro.at( jj ).s;
+ double kval = tsys->xy_distro.at( jj ).k;
+ smin = qMin( smin, sval );
+ smax = qMax( smax, sval );
+ kmin = qMin( kmin, kval );
+ kmax = qMax( kmax, kval );
+ }
+ }
+
+ // adjust minima, maxima
+ sinc = ( smax - smin ) / 10.0;
+ kinc = ( kmax - kmin ) / 10.0;
+ sinc = ( sinc <= 0.0 ) ? ( smin * 0.05 ) : sinc;
+ kinc = ( kinc <= 0.0 ) ? ( kmin * 0.05 ) : kinc;
+DbgLv(1) << "SL: real smin smax kmin kmax" << smin << smax << kmin << kmax;
+ smin -= sinc;
+ smax += sinc;
+ kmin -= kinc;
+ kmax += kinc;
+DbgLv(1) << "SL: adjusted smin smax kmin kmax" << smin << smax << kmin << kmax;
+
+ if ( auto_sxy )
+ { // Set auto limits on X and Y
+ sinc = pow( 10.0, qFloor( log10( smax ) ) - 3.0 );
+ kinc = pow( 10.0, qFloor( log10( kmax ) ) - 3.0 );
+ if ( qAbs( ( smax - smin ) / smax ) < 0.001 )
+ { // Put padding around virtually constant value
+ smin -= sinc;
+ smax += sinc;
+ }
+ if ( qAbs( ( kmax - kmin ) / kmax ) < 0.001 )
+ { // Put padding around virtually constant value
+ kmin -= kinc;
+ kmax += kinc;
+ }
+ // Make sure limits are nearest reasonable values
+ smin = qFloor( smin / sinc ) * sinc;
+ smax = qFloor( smax / sinc ) * sinc + sinc;
+ smin = ( plot_x != ATTR_S ) ? qMax( smin, 0.0 ) : smin;
+ smin = ( plot_x == ATTR_K ) ? qMax( smin, 0.5 ) : smin;
+ kmin = qFloor( kmin / kinc ) * kinc;
+ kmax = qFloor( kmax / kinc ) * kinc + kinc;
+
+DbgLv(1) << "SL: setVal kmin kmax" << kmin << kmax;
+ ct_plt_smin->setValue( smin );
+ ct_plt_smax->setValue( smax );
+ ct_plt_kmin->setValue( kmin );
+ ct_plt_kmax->setValue( kmax );
+
+ plt_smin = smin;
+ plt_smax = smax;
+ plt_kmin = kmin;
+ plt_kmax = kmax;
+ }
+ else
+ {
+ plt_smin = ct_plt_smin->value();
+ plt_smax = ct_plt_smax->value();
+ plt_kmin = ct_plt_kmin->value();
+ plt_kmax = ct_plt_kmax->value();
+ }
+DbgLv(1) << "SL: plt_smin _smax _kmin _kmax" << plt_smin << plt_smax
+ << plt_kmin << plt_kmax;
+}
+
+// Sort distribution solute list by s,k values and optionally reduce
+void US_Density_Match::sort_distro( QList< S_Solute >& listsols,
+ bool reduce )
+{
+ int sizi = listsols.size();
+
+ if ( sizi < 2 )
+ return; // nothing need be done for 1-element list
+
+ // sort distro solute list by s,k values
+
+ qSort( listsols.begin(), listsols.end(), distro_lessthan );
+
+ // check reduce flag
+
+ if ( reduce )
+ { // skip any duplicates in sorted list
+ S_Solute sol1;
+ S_Solute sol2;
+ QList< S_Solute > reduced;
+ QList< S_Solute >::iterator jj = listsols.begin();
+ sol1 = *jj;
+ reduced.append( *jj ); // output first entry
+ int kdup = 0;
+ int jdup = 0;
+
+ while ( (++jj) != listsols.end() )
+ { // loop to compare each entry to previous
+ sol2 = *jj; // solute entry
+
+ if ( sol1.s != sol2.s || sol1.k != sol2.k )
+ { // not a duplicate, so output to temporary list
+ reduced.append( sol2 );
+ jdup = 0;
+ }
+
+ else
+ { // duplicate, so sum c value;
+ sol2.c += sol1.c; // sum c value
+ sol2.s = ( sol1.s + sol2.s ) * 0.5; // average s,k
+ sol2.k = ( sol1.k + sol2.k ) * 0.5;
+ reduced.replace( reduced.size() - 1, sol2 );
+ kdup = max( kdup, ++jdup );
+ }
+
+ sol1 = sol2; // save entry for next iteration
+ }
+
+ if ( kdup > 0 )
+ { // if some reduction happened, replace list with reduced version
+ double sc = 1.0 / (double)( kdup + 1 );
+DbgLv(1) << "KDUP" << kdup;
+//sc = 1.0;
+
+ for ( int ii = 0; ii < reduced.size(); ii++ )
+ { // first scale c values by reciprocal of maximum replicate count
+ reduced[ ii ].c *= sc;
+ }
+
+ listsols = reduced;
+DbgLv(1) << " reduced-size" << reduced.size();
+ }
+ }
+DbgLv(1) << " sol-size" << listsols.size();
+ return;
+}
+
+void US_Density_Match::timerEvent( QTimerEvent *event )
+{
+ int tm_id = event->timerId();
+
+ if ( tm_id != patm_id )
+ { // if other than plot loop timer event, pass on to normal handler
+ QWidget::timerEvent( event );
+ return;
+ }
+
+ int syssiz = system.size();
+ int maxsiz = syssiz - 1;
+ int jdistr = curr_distr + 1;
+
+ if ( syssiz > 0 && looping )
+ { // If still looping, plot the next distribution
+ if ( jdistr > maxsiz )
+ { // If we have passed the end in looping, reset
+ jdistr = 0;
+
+ if ( ! cont_loop )
+ { // If not in continuous loop, turn off looping flag
+ jdistr = curr_distr;
+ looping = false;
+ }
+
+ else
+ { // If in continuous loop, turn off save-plot flag
+ need_save = false;
+ }
+ }
+ curr_distr = jdistr;
+ plot_data();
+ }
+
+ if ( curr_distr > maxsiz || !looping )
+ { // If past last distro or Stop clicked, stop the loop
+ killTimer( tm_id );
+ pb_stopplt->setEnabled( false );
+ curr_distr = ( curr_distr > maxsiz ) ? maxsiz : curr_distr;
+ need_save = ck_savepl->isChecked() && !cont_loop;
+ }
+ ct_curr_distr->setValue( curr_distr + 1 );
+}
+
+// Reset Disk_DB control whenever data source is changed in any dialog
+void US_Density_Match::update_disk_db( bool isDB )
+{
+ isDB ? dkdb_cntrls->set_db() : dkdb_cntrls->set_disk();
+}
+
+// Select a prefilter for model distributions list
+void US_Density_Match::select_prefilt( void )
+{
+ QString pfmsg;
+ int nruns = 0;
+ pfilts.clear();
+
+ US_SelectRuns srdiag( dkdb_cntrls->db(), pfilts );
+ srdiag.move( this->pos() + QPoint( 200, 200 ) );
+ connect( &srdiag, SIGNAL( dkdb_changed ( bool ) ),
+ this, SLOT ( update_disk_db( bool ) ) );
+
+ if ( srdiag.exec() == QDialog::Accepted )
+ nruns = pfilts.size();
+ else
+ pfilts.clear();
+
+ if ( nruns == 0 )
+ pfmsg = tr( "(no prefilter)" );
+
+ else if ( nruns > 1 )
+ pfmsg = tr( "RunID prefilter - %1 runs: " ).arg( nruns )
+ + QString( pfilts[ 0 ] ).left( 20 ) + "*, ...";
+
+ else
+ pfmsg = tr( "RunID prefilter - 1 run: " )
+ + QString( pfilts[ 0 ] ).left( 20 ) + " ...";
+
+ le_prefilt->setText( pfmsg );
+}
+
+
+// Remove distribution(s) from the models list
+void US_Density_Match::remove_distro( void )
+{
+qDebug() << "Remove Distros";
+ US_RemoveModels rmvd( system );
+
+ if ( rmvd.exec() == QDialog::Accepted )
+ {
+ int jd = system.size();
+
+ if ( jd < 1 )
+ {
+ reset();
+ return;
+ }
+
+ curr_distr = 0;
+ ct_curr_distr->setRange( 1, jd );
+ ct_curr_distr->setSingleStep( 1.0 );
+ ct_curr_distr->setValue( 1 );
+ ct_curr_distr->setEnabled( true );
+ }
+
+ plot_data();
+}
+
+// Select coordinate for horizontal axis
+void US_Density_Match::select_x_axis( int ival )
+{
+ const QString xlabs[] = { "s", "f/f0", "MW", "vbar", "D", "f" };
+ const double xvlos[] = { 1.0, 1.0, 2e+4, 0.60, 1e-8, 1e-8 };
+ const double xvhis[] = { 10.0, 4.0, 1e+5, 0.80, 1e-7, 1e-7 };
+ const double xmins[] = { -10000.0, 1.0, 0.0, 0.01, 1e-9, 1e-9 };
+ const double xmaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 1e-5, 1e-5 };
+ const double xincs[] = { 0.01, 0.01, 1000.0, 0.01, 1e-9, 1e-9 };
+
+ plot_x = ival;
+
+ lb_plt_smin->setText( tr( "Plot Limit " ) + xlabs[ plot_x ]
+ + tr( " Minimum:" ) );
+ lb_plt_smax->setText( tr( "Plot Limit " ) + xlabs[ plot_x ]
+ + tr( " Maximum:" ) );
+ ct_plt_smin->setRange( xmins[ plot_x ], xmaxs[ plot_x ] );
+ ct_plt_smax->setRange( xmins[ plot_x ], xmaxs[ plot_x ] );
+ ct_plt_smin->setSingleStep( xincs[ plot_x ] );
+ ct_plt_smax->setSingleStep( xincs[ plot_x ] );
+ ct_plt_smin->setValue( xvlos[ plot_x ] );
+ ct_plt_smax->setValue( xvhis[ plot_x ] );
+
+ rb_y_s ->setEnabled( plot_x != ATTR_S );
+ rb_y_ff0 ->setEnabled( plot_x != ATTR_K );
+ rb_y_mw ->setEnabled( plot_x != ATTR_W );
+ rb_y_vbar->setEnabled( plot_x != ATTR_V );
+ rb_y_D ->setEnabled( plot_x != ATTR_D );
+ rb_y_f ->setEnabled( plot_x != ATTR_F );
+
+ build_xy_distro();
+
+ set_limits();
+
+ plot_data();
+}
+
+// Select coordinate for vertical axis
+void US_Density_Match::select_y_axis( int ival )
+{
+ const QString ylabs[] = { "s", "f/f0", "MW", "vbar", "D", "f" };
+ const double yvlos[] = { 1.0, 1.0, 2e+4, 0.60, 0.0, 1e-8 };
+ const double yvhis[] = { 10.0, 4.0, 1e+5, 0.80, 30.0, 1e-7 };
+ const double ymins[] = { -10000.0, 1.0, 0.0, 0.01, 0.0, 1e-9 };
+ const double ymaxs[] = { 10000.0, 50.0, 1e+10, 3.00, 10000.0, 1e-5 };
+ const double yincs[] = { 0.01, 0.01, 1000.0, 0.01, 0.01, 1e-9 };
+
+ plot_y = ival;
+qDebug() << "select-y: plot_y" << plot_y;
+
+ lb_plt_kmin->setText( tr( "Plot Limit " ) + ylabs[ plot_y ]
+ + tr( " Minimum:" ) );
+ lb_plt_kmax->setText( tr( "Plot Limit " ) + ylabs[ plot_y ]
+ + tr( " Maximum:" ) );
+qDebug() << " ylab" << ylabs[plot_y];
+ ct_plt_kmin->setRange( ymins[ plot_y ], ymaxs[ plot_y ] );
+ ct_plt_kmax->setRange( ymins[ plot_y ], ymaxs[ plot_y ] );
+ ct_plt_kmin->setSingleStep( yincs[ plot_y ] );
+ ct_plt_kmax->setSingleStep( yincs[ plot_y ] );
+ ct_plt_kmin->setValue( yvlos[ plot_y ] );
+ ct_plt_kmax->setValue( yvhis[ plot_y ] );
+qDebug() << " yval-lo val-hi" << yvlos[plot_y] << yvhis[plot_y];
+
+ rb_x_s ->setEnabled( plot_y != ATTR_S );
+ rb_x_ff0 ->setEnabled( plot_y != ATTR_K );
+ rb_x_mw ->setEnabled( plot_y != ATTR_W );
+ rb_x_vbar->setEnabled( plot_y != ATTR_V );
+ rb_x_D ->setEnabled( plot_y != ATTR_D );
+ rb_x_f ->setEnabled( plot_y != ATTR_F );
+
+ build_xy_distro();
+
+ set_limits();
+
+ plot_data();
+}
+
+// Re-generate the XY version of the current distribution
+void US_Density_Match::build_xy_distro()
+{
+ if ( system.size() < 1 )
+ return;
+ DisSys* tsys = (DisSys*)&system.at( curr_distr );
+ if ( tsys->plot_x == plot_x && tsys->plot_y == plot_y )
+ return;
+
+ tsys->xy_distro.clear();
+ tsys->plot_x = plot_x;
+ tsys->plot_y = plot_y;
+ double tot_conc = 0.0;
+ int nsolsk = tsys->sk_distro.size();
+
+ // Create solute list with specified x,y
+ for ( int ii = 0; ii < nsolsk; ii++ )
+ {
+ S_Solute sol_sk = tsys->sk_distro[ ii ];
+ S_Solute sol_xy = sol_sk;
+
+ sol_xy.s = ( plot_x == ATTR_S ) ? sol_sk.s : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_K ) ? sol_sk.k : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_W ) ? sol_sk.w : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_V ) ? sol_sk.v : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_D ) ? sol_sk.d : sol_xy.s;
+ sol_xy.s = ( plot_x == ATTR_F ) ? sol_sk.f : sol_xy.s;
+ sol_xy.k = ( plot_y == ATTR_S ) ? sol_sk.s : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_K ) ? sol_sk.k : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_W ) ? sol_sk.w : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_V ) ? sol_sk.v : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_D ) ? sol_sk.d : sol_xy.k;
+ sol_xy.k = ( plot_y == ATTR_F ) ? sol_sk.f : sol_xy.k;
+ tot_conc += sol_sk.c;
+ tsys->xy_distro << sol_xy;
+ }
+
+ // Sort and possibly reduce XY distro
+ sort_distro( tsys->xy_distro, true );
+
+ // Create Z-as-percentage version of xy distribution
+ int nsolxy = tsys->xy_distro.size();
+DbgLv(1) << "Bld: nsolsk nsolxy" << nsolsk << nsolxy;
+ tsys->xy_distro_zp.clear();
+
+ for ( int ii = 0; ii < nsolxy; ii++ )
+ {
+ S_Solute sol_xy = tsys->xy_distro[ ii ];
+ double cozpc = sol_xy.c * 100.0 / tot_conc;
+ sol_xy.c = cozpc;
+ plt_zmin_zp = qMin( plt_zmin_zp, cozpc );
+ plt_zmax_zp = qMax( plt_zmax_zp, cozpc );
+
+ tsys->xy_distro_zp << sol_xy;
+ }
+}
+
+// Set annotation title for a plot index
+QString US_Density_Match::anno_title( int pltndx )
+{
+ QString a_title;
+
+ if ( pltndx == ATTR_S )
+ a_title = tr( "Sedimentation Coefficient (1e-13)"
+ " for water at 20" ) + DEGC;
+ else if ( pltndx == ATTR_K )
+ a_title = tr( "Frictional Ratio f/f0" );
+ else if ( pltndx == ATTR_W )
+ a_title = tr( "Molecular Weight (Dalton)" );
+ else if ( pltndx == ATTR_V )
+ a_title = tr( "Vbar at 20" ) + DEGC;
+ else if ( pltndx == ATTR_D )
+ a_title = tr( "Diffusion Coefficient (1e-7)" );
+ else if ( pltndx == ATTR_F )
+ a_title = tr( "Frictional Coefficient" );
+
+ return a_title;
+}
+
+// Make a ColorMap copy and return a pointer to the new ColorMap
+QwtLinearColorMap* US_Density_Match::ColorMapCopy( QwtLinearColorMap* colormap )
+{
+ QVector< double > cstops = colormap->colorStops();
+ int lstop = cstops.count() - 1;
+ QwtInterval csvals( 0.0, 1.0 );
+ QwtLinearColorMap* cmapcopy = new QwtLinearColorMap( colormap->color1(),
+ colormap->color2() );
+
+ for ( int jj = 1; jj < lstop; jj++ )
+ {
+ QColor scolor = colormap->color( csvals, cstops[ jj ] );
+ cmapcopy->addColorStop( cstops[ jj ], scolor );
+ }
+
+ return cmapcopy;
+}
+
Property changes on: trunk/programs/us_density_match/us_density_match.cpp
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_density_match.h
===================================================================
--- trunk/programs/us_density_match/us_density_match.h (rev 0)
+++ trunk/programs/us_density_match/us_density_match.h 2019-08-07 20:01:20 UTC (rev 2803)
@@ -0,0 +1,217 @@
+#ifndef US_DENS_MATCH_H
+#define US_DENS_MATCH_H
+
+#include "us_extern.h"
+#include "us_widgets.h"
+#include "us_help.h"
+#include "us_editor.h"
+#include "us_model_loader.h"
+#include "us_plot.h"
+#include "us_colorgradIO.h"
+#include "us_spectrodata.h"
+
+#include "qwt_plot_marker.h"
+#include "qwt_plot_spectrogram.h"
+#include "qwt_plot_layout.h"
+#include "qwt_plot_zoomer.h"
+#include "qwt_plot_panner.h"
+#include "qwt_scale_widget.h"
+#include "qwt_scale_draw.h"
+#include "qwt_color_map.h"
+
+//!< \brief Distribution structure
+typedef struct distro_sys
+{
+ QList< S_Solute > sk_distro;
+ QList< S_Solute > xy_distro;
+ QList< S_Solute > sk_distro_zp;
+ QList< S_Solute > xy_distro_zp;
+ QwtLinearColorMap* colormap;
+ QString run_name;
+ QString analys_name;
+ QString method;
+ QString cmapname;
+ QString editGUID;
+ int distro_type;
+ int plot_x;
+ int plot_y;
+ bool monte_carlo;
+} DisSys;
+
+//! \brief Less-than function for sorting distributions
+bool distro_lessthan( const S_Solute&, const S_Solute& );
+
+//! Class for displaying models in pseudo-3D
+class US_Density_Match : public US_Widgets
+{
+ Q_OBJECT
+
+ public:
+ //! \brief Pseudo-3D Combination constructor
+ US_Density_Match();
+
+ private:
+
+ enum attr_type { ATTR_S, ATTR_K, ATTR_W, ATTR_V, ATTR_D, ATTR_F };
+
+ QLabel* lb_plt_smin;
+ QLabel* lb_plt_smax;
+ QLabel* lb_plt_kmin;
+ QLabel* lb_plt_kmax;
+ QLabel* lb_tolerance;
+ QLabel* lb_division;
+
+ QTextEdit* te_distr_info;
+
+ QLineEdit* le_cmap_name;
+ QLineEdit* le_prefilt;
+
+ US_Help showHelp;
+
+ QwtCounter* ct_resolu;
+ QwtCounter* ct_xreso;
+ QwtCounter* ct_yreso;
+ QwtCounter* ct_zfloor;
+ QwtCounter* ct_plt_kmin;
+ QwtCounter* ct_plt_kmax;
+ QwtCounter* ct_plt_smin;
+ QwtCounter* ct_plt_smax;
+ QwtCounter* ct_plt_dlay;
+ QwtCounter* ct_curr_distr;
+ QwtCounter* ct_tolerance;
+ QwtCounter* ct_division;
+ QwtCounter* ct_smoothing;
+ QwtCounter* ct_boundaryPercent;
+ QwtCounter* ct_boundaryPos;
+
+ QwtPlot* data_plot;
+
+ QwtPlotPicker* pick;
+
+ QwtLinearColorMap* colormap;
+
+ US_Disk_DB_Controls* dkdb_cntrls;
+
+ QPushButton* pb_pltall;
+ QPushButton* pb_stopplt;
+ QPushButton* pb_refresh;
+ QPushButton* pb_reset;
+ QPushButton* pb_prefilt;
+ QPushButton* pb_lddistr;
+ QPushButton* pb_ldcolor;
+ QPushButton* pb_help;
+ QPushButton* pb_close;
+ QPushButton* pb_rmvdist;
+
+ QCheckBox* ck_autosxy;
+ QCheckBox* ck_autoscz;
+ QCheckBox* ck_conloop;
+ QCheckBox* ck_plot_sk;
+ QCheckBox* ck_plot_wk;
+ QCheckBox* ck_plot_sv;
+ QCheckBox* ck_plot_wv;
+ QCheckBox* ck_zpcent;
+ QCheckBox* ck_savepl;
+ QCheckBox* ck_locsave;
+
+ QRadioButton* rb_x_s;
+ QRadioButton* rb_x_ff0;
+ QRadioButton* rb_x_mw;
+ QRadioButton* rb_x_vbar;
+ QRadioButton* rb_x_D;
+ QRadioButton* rb_x_f;
+ QRadioButton* rb_y_s;
+ QRadioButton* rb_y_ff0;
+ QRadioButton* rb_y_mw;
+ QRadioButton* rb_y_vbar;
+ QRadioButton* rb_y_D;
+ QRadioButton* rb_y_f;
+
+ QButtonGroup* bg_x_axis;
+ QButtonGroup* bg_y_axis;
+
+ QList< DisSys > system;
+
+ double resolu;
+ double plt_smin;
+ double plt_smax;
+ double plt_kmin;
+ double plt_kmax;
+ double plt_zmin;
+ double plt_zmax;
+ double plt_zmin_zp;
+ double plt_zmax_zp;
+ double plt_zmin_co;
+ double plt_zmax_co;
+ double s_range;
+ double k_range;
+ double xreso;
+ double yreso;
+ double zfloor;
+
+ int curr_distr;
+ int init_solutes;
+ int mc_iters;
+ int patm_id;
+ int patm_dlay;
+ int dbg_level;
+ int plot_x;
+ int plot_y;
+
+ bool cnst_vbar;
+ bool auto_sxy;
+ bool auto_scz;
+ bool cont_loop;
+ bool looping;
+ bool need_save;
+ bool runsel;
+ bool latest;
+ bool zpcent;
+
+ QString xa_title;
+ QString ya_title;
+ QString cmapname;
+ QString mfilter;
+
+ QStringList pfilts;
+
+ private slots:
+
+ void update_resolu( double );
+ void update_xreso( double );
+ void update_yreso( double );
+ void update_zfloor( double );
+ void update_curr_distr( double );
+ void update_plot_smin( double );
+ void update_plot_smax( double );
+ void update_plot_kmin( double );
+ void update_plot_kmax( double );
+ void plot_data( int );
+ void plot_data( void );
+ void select_autosxy( void );
+ void select_autoscz( void );
+ void select_conloop( void );
+ void update_disk_db( bool );
+ void select_prefilt( void );
+ void load_distro( void );
+ void load_distro( US_Model, QString );
+ void load_color( void );
+ void plotall( void );
+ void stop( void );
+ void reset( void );
+ void set_limits( void );
+ void sort_distro( QList< S_Solute >&, bool );
+ void remove_distro( void );
+ void select_x_axis( int );
+ void select_y_axis( int );
+ void build_xy_distro( void );
+ QString anno_title ( int );
+ QwtLinearColorMap* ColorMapCopy( QwtLinearColorMap* );
+
+ void help ( void )
+ { showHelp.show_help( "pseudo3d_combine.html" ); };
+
+ protected:
+ virtual void timerEvent( QTimerEvent *e );
+};
+#endif
Property changes on: trunk/programs/us_density_match/us_density_match.h
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_density_match.pro
===================================================================
--- trunk/programs/us_density_match/us_density_match.pro (rev 0)
+++ trunk/programs/us_density_match/us_density_match.pro 2019-08-07 20:01:20 UTC (rev 2803)
@@ -0,0 +1,12 @@
+include( ../../gui.pri )
+
+QT += xml
+
+TARGET = us_density_match
+
+HEADERS = us_density_match.h \
+ us_remove_models.h
+
+SOURCES = us_density_match.cpp \
+ us_remove_models.cpp
+
Property changes on: trunk/programs/us_density_match/us_density_match.pro
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_remove_models.cpp
===================================================================
--- trunk/programs/us_density_match/us_remove_models.cpp (rev 0)
+++ trunk/programs/us_density_match/us_remove_models.cpp 2019-08-07 20:01:20 UTC (rev 2803)
@@ -0,0 +1,246 @@
+//! \file us_remove_models.cpp
+
+#include "us_remove_models.h"
+#include "us_gui_settings.h"
+
+// Constructor: remove-distributions dialog widget
+US_RemoveModels::US_RemoveModels( QList< DisSys >& adistros,
+ QWidget* p ) : US_WidgetsDialog( p, 0 ), distros( adistros )
+{
+ setObjectName( "US_RemoveModels" );
+ setPalette( US_GuiSettings::frameColor() );
+ setFont( QFont( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() ) );
+
+ // Lay out the GUI
+ setWindowTitle( tr( "Remove Model Distributions" ) );
+
+ mainLayout = new QGridLayout( this );
+
+ mainLayout->setSpacing ( 2 );
+ mainLayout->setContentsMargins( 2, 2, 2, 2 );
+
+ QLabel* lb_mtitle = us_banner( tr( "Select Models to Remove" ) );
+ lw_distrs = us_listwidget();
+
+ pb_restore = us_pushbutton( tr( "Restore" ) );
+ pb_remove = us_pushbutton( tr( "Remove" ) );
+ pb_help = us_pushbutton( tr( "Help" ) );
+ pb_cancel = us_pushbutton( tr( "Cancel" ) );
+ pb_accept = us_pushbutton( tr( "Accept" ) );
+
+ te_status = us_textedit();
+
+ int row = 0;
+ mainLayout ->addWidget( lb_mtitle, row++, 0, 1, 5 );
+ mainLayout ->addWidget( lw_distrs, row, 0, 9, 5 );
+ row += 9;
+ mainLayout ->addWidget( pb_remove, row, 0, 1, 1 );
+ mainLayout ->addWidget( pb_restore, row, 1, 1, 1 );
+ mainLayout ->addWidget( pb_help, row, 2, 1, 1 );
+ mainLayout ->addWidget( pb_cancel, row, 3, 1, 1 );
+ mainLayout ->addWidget( pb_accept, row++, 4, 1, 1 );
+ mainLayout ->addWidget( te_status, row, 0, 2, 5 );
+ row += 2;
+
+ connect( pb_remove, SIGNAL( clicked() ),
+ this, SLOT( remove() ) );
+ connect( pb_restore, SIGNAL( clicked() ),
+ this, SLOT( restore() ) );
+ connect( pb_help, SIGNAL( clicked() ),
+ this, SLOT( help() ) );
+ connect( pb_cancel, SIGNAL( clicked() ),
+ this, SLOT( reject() ) );
+ connect( pb_accept, SIGNAL( clicked() ),
+ this, SLOT( accepted() ) );
+
+ connect( lw_distrs, SIGNAL( itemSelectionChanged() ),
+ this, SLOT( selectionsChanged() ) );
+
+ // Build list of original model descriptions
+ nd_orig = distros.count();
+ int maxdlen = 0;
+
+ for ( int jj = 0; jj < nd_orig; jj++ )
+ {
+ QString runid = distros[ jj ].run_name;
+ QString analy = distros[ jj ].analys_name;
+ QString method = distros[ jj ].method;
+ QString edid = analy.section( "_", 0, -4 );
+ QString anid = analy.section( "_", -3, -3 );
+ QString iter = analy.section( "_", -2, -1 );
+ QString mdesc = runid + "." + edid + "_" + anid + "_" + method
+ + "_" + iter;
+
+ mdesc_orig << mdesc;
+
+ maxdlen = qMax( maxdlen, mdesc.length() );
+ }
+
+ // Set up the list widget with the original models
+ restore();
+
+ QFont font( US_GuiSettings::fontFamily(), US_GuiSettings::fontSize() );
+ QFontMetrics fm( font );
+ int fhigh = fm.lineSpacing();
+ int fwide = fm.width( QChar( '6' ) );
+ int lhigh = fhigh * 10 + 12;
+ int lwide = fwide * ( maxdlen + 2 );
+
+ lw_distrs->setMinimumHeight( lhigh );
+ lw_distrs->resize( lwide, lhigh );
+ lw_distrs->setSelectionMode( QAbstractItemView::ExtendedSelection );
+
+ te_status->setMaximumHeight( fhigh * 2 + 12 );
+ us_setReadOnly( te_status, true );
+ te_status->setTextColor( Qt::blue );
+ te_status->setText(
+ tr( "The list shows all the original %1 distributions.\n"
+ "No models are currently selected for removal." ).arg( nd_orig ) );
+
+ adjustSize();
+ int wwide = qMax( 500, lwide );
+ int whigh = size().height();
+ resize( wwide, whigh );
+ qApp->processEvents();
+}
+
+// Private slot to react to a change in selections
+void US_RemoveModels::selectionsChanged()
+{
+ // Get the list of selected items
+ QList< QListWidgetItem* > selitems = lw_distrs->selectedItems();
+ nd_selected = selitems.count();
+
+ if ( nd_removed == 0 )
+ { // No list entries have thus-far been removed
+ if ( nd_selected == 0 )
+ { // No items removed or selected
+ te_status->setText(
+ tr( "The list shows all the original %1 distributions.\n"
+ "No models are currently selected for removal." )
+ .arg( nd_orig ) );
+ }
+
+ else if ( nd_selected == 1 )
+ { // No items removed, but 1 selected
+ te_status->setText(
+ tr( "The list shows all the original %1 distributions.\n"
+ "One model is currently selected for removal." )
+ .arg( nd_orig ) );
+ }
+
+ else
+ { // No items removed, but several selected
+ te_status->setText(
+ tr( "The list shows all the original %1 distributions.\n"
+ "%2 models are currently selected for removal." )
+ .arg( nd_orig ).arg( nd_selected ) );
+ }
+ }
+
+ else
+ { // Some items were previously removed
+ if ( nd_selected == 0 )
+ { // Removals were done, but currently no items selected
+ te_status->setText(
+ tr( "The list shows distributions with %1 removed.\n"
+ "No more models are currently selected for removal." )
+ .arg( nd_removed ) );
+ }
+
+ else if ( nd_selected == 1 )
+ { // Removals were done, and currently one more item is selected
+ te_status->setText(
+ tr( "The list shows distributions with %1 removed.\n"
+ "One more model is currently selected for removal." )
+ .arg( nd_removed ) );
+ }
+
+ else
+ { // Removals were done, and currently some more items are selected
+ te_status->setText(
+ tr( "The list shows distributions with %1 removed.\n"
+ "%2 more models are currently selected for removal." )
+ .arg( nd_removed ).arg( nd_selected ) );
+ }
+ }
+
+ // Enable buttons according to the present state of selection/removal
+ pb_remove ->setEnabled( nd_selected > 0 );
+ pb_restore->setEnabled( nd_removed > 0 );
+ pb_accept ->setEnabled( nd_removed > 0 );
+}
+
+// Private slot to remove selected distributions from the displayed list
+void US_RemoveModels::remove()
+{
+ // Get the list-widget items currently selected
+ QList< QListWidgetItem* > selitems = lw_distrs->selectedItems();
+ nd_selected = selitems.count();
+ nd_removed += nd_selected;
+
+ for ( int jj = 0; jj < nd_selected; jj++ )
+ { // Get a selected item and remove its description from the current list
+ QListWidgetItem* item = selitems[ jj ];
+ QString mdesc = item->text();
+
+ mdesc_list.removeOne( mdesc );
+ }
+
+ // Re-do the displayed list and enable buttons according to present state
+ lw_distrs->clear();
+ lw_distrs->addItems( mdesc_list );
+ pb_remove ->setEnabled( false );
+ pb_restore->setEnabled( true );
+ pb_accept ->setEnabled( true );
+ nd_selected = 0;
+}
+
+// Private slot to restore the original list of distributions
+void US_RemoveModels::restore()
+{
+ mdesc_list = mdesc_orig;
+ nd_orig = mdesc_orig.count();
+ nd_removed = 0;
+ nd_selected = 0;
+
+ lw_distrs->clear();
+ lw_distrs->addItems( mdesc_orig );
+ te_status->setText(
+ tr( "The list shows all the original %1 distributions.\n"
+ "No models are currently selected for removal." ).arg( nd_orig ) );
+
+ pb_remove ->setEnabled( false );
+ pb_restore->setEnabled( false );
+ pb_accept ->setEnabled( false );
+}
+
+// Private slot to do the actual removal of distributions and close
+void US_RemoveModels::accepted()
+{
+ if ( nd_selected > 0 )
+ { // Accept attempt with selections and no Remove clicked
+ if ( QMessageBox::Yes == QMessageBox::warning( this,
+ tr( "Outstanding Selections" ),
+ tr( "You have selected distributions,\n"
+ "but did not click on the Remove button.\n"
+ "Do you want to remove the selected distributions?" ),
+ QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes ) )
+ { // If "Yes" to above, add current selections to the remove list
+ remove();
+ }
+ }
+
+ for ( int jj = nd_orig - 1; jj >= 0; jj-- )
+ { // Remove all entries in the original that are not in the current list
+ QString mdesc = mdesc_orig[ jj ];
+
+ if ( ! mdesc_list.contains( mdesc ) )
+ { // This original list item is to be removed from the passed list
+ distros.removeAt( jj );
+ }
+ }
+
+ accept();
+}
+
Property changes on: trunk/programs/us_density_match/us_remove_models.cpp
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
Added: trunk/programs/us_density_match/us_remove_models.h
===================================================================
--- trunk/programs/us_density_match/us_remove_models.h (rev 0)
+++ trunk/programs/us_density_match/us_remove_models.h 2019-08-07 20:01:20 UTC (rev 2803)
@@ -0,0 +1,59 @@
+//! \file us_remove_distros.h
+#ifndef US_RMVMODEL_H
+#define US_RMVMODEL_H
+
+#include "us_extern.h"
+#include "us_widgets_dialog.h"
+#include "us_density_match.h"
+#include "us_help.h"
+
+#include <qwt_plot.h>
+
+//! \brief A class to provide a window for remove_distros analysis controls
+
+class US_RemoveModels : public US_WidgetsDialog
+{
+ Q_OBJECT
+
+ public:
+ //! \brief US_RemoveModels constructor
+ //! \param adistros Pointer to model distributions list
+ //! \param p Pointer to the parent of this widget
+ US_RemoveModels( QList< DisSys >&, QWidget* p = 0 );
+
+ private:
+ QList< DisSys >& distros; // Reference to model distributions list
+
+ int nd_orig; // Number of distributions in original
+ int nd_removed; // Number of total distributions removed
+ int nd_selected; // Number of currently selected distributions
+
+ QGridLayout* mainLayout; //
+
+ QStringList mdesc_orig; // List of descriptions from original
+ QStringList mdesc_list; // List of descriptions now listed
+
+ QListWidget* lw_distrs; // List widget of distributions
+
+ QTextEdit* te_status; // Status text box
+
+ QPushButton* pb_restore; // Restore button
+ QPushButton* pb_remove; // Remove button
+ QPushButton* pb_help; // Help button
+ QPushButton* pb_cancel; // Cancel button
+ QPushButton* pb_accept; // Accept button
+
+ protected:
+ US_Help showHelp;
+
+ private slots:
+
+ void selectionsChanged( void );
+ void remove ( void );
+ void restore ( void );
+ void accepted ( void );
+ void help ( void )
+ { showHelp.show_help( "mass_distrib_rmv.html" ); };
+};
+#endif
+
Property changes on: trunk/programs/us_density_match/us_remove_models.h
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+LastChangedDate Author
\ No newline at end of property
1
0
Author: alexey
Date: 2019-08-06 23:37:59 +0000 (Tue, 06 Aug 2019)
New Revision: 2802
Modified:
trunk/gui/us_select_item.cpp
trunk/programs/us_experiment/us_exp_utils.cpp
trunk/programs/us_experiment/us_experiment_gui_optima.cpp
Log:
1501 scans per wvl per cell issue... plus some other minor corrections...
Modified: trunk/gui/us_select_item.cpp
===================================================================
--- trunk/gui/us_select_item.cpp 2019-08-06 14:51:11 UTC (rev 2801)
+++ trunk/gui/us_select_item.cpp 2019-08-06 23:37:59 UTC (rev 2802)
@@ -119,7 +119,7 @@
le_info = us_textedit();
QFontMetrics m (le_info -> font()) ;
int RowHeight = m.lineSpacing() ;
- le_info -> setFixedHeight (10 * RowHeight) ;
+ le_info -> setFixedHeight (11 * RowHeight) ;
QPalette p = le_info->palette();
p.setColor(QPalette::Base, Qt::lightGray);
Modified: trunk/programs/us_experiment/us_exp_utils.cpp
===================================================================
--- trunk/programs/us_experiment/us_exp_utils.cpp 2019-08-06 14:51:11 UTC (rev 2801)
+++ trunk/programs/us_experiment/us_exp_utils.cpp 2019-08-06 23:37:59 UTC (rev 2802)
@@ -2618,9 +2618,14 @@
// subm_enab = ( have_run && have_proj && proto_ena &&
// connected );
- subm_enab = ( have_run && have_proj && proto_ena &&
- mainw->connection_status && // ALEXEY: use top-level connection boolean!
- !currProto->exp_label.isEmpty() ); // ALEXEY: and label is present
+ if ( mainw->automode )
+ subm_enab = ( have_run && have_proj && proto_ena &&
+ mainw->connection_status && // ALEXEY: use top-level connection boolean!
+ !currProto->exp_label.isEmpty() ); // ALEXEY: and label is present
+ else
+ subm_enab = ( have_run && have_proj && proto_ena &&
+ mainw->connection_status ); // ALEXEY: use top-level connection boolean!
+
ck_run ->setChecked( have_run );
ck_project ->setChecked( have_proj );
Modified: trunk/programs/us_experiment/us_experiment_gui_optima.cpp
===================================================================
--- trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-08-06 14:51:11 UTC (rev 2801)
+++ trunk/programs/us_experiment/us_experiment_gui_optima.cpp 2019-08-06 23:37:59 UTC (rev 2802)
@@ -4799,6 +4799,19 @@
if ( has_absorbance )
{
+
+ //Stop if ScanCount > 1501
+ if ( ScanCount > 1501 )
+ {
+ QMessageBox::critical( this,
+ tr( "*ERROR* in Submitting Protocol" ),
+ tr( "Protocol cannot be submitted: \n"
+ "Number of scans per cell per wavelengths is %1. \n"
+ "It must be less than 1501. \n\n"
+ "Please revise experiment parameters accordingly." ).arg( ScanCount ) );
+ return;
+ }
+
for ( int ii = 0; ii < rpRange->nranges; ii++ )
{
channel = rpRange->chrngs[ ii ].channel;
@@ -5020,6 +5033,19 @@
}
if ( has_interference )
{
+ //ALEXEY: For interference as well ?
+ if ( ScanCount > 1501 )
+ {
+ QMessageBox::critical( this,
+ tr( "*ERROR* in Submitting Protocol" ),
+ tr( "Protocol cannot be submitted: \n"
+ "Number of scans per cell per wavelengths is %1. \n"
+ "It must be less than 1501. \n\n"
+ "Please revise experiment parameters accordingly." ).arg( ScanCount ) );
+
+ return;
+ }
+
QString scan_count = QString::number( ScanCount ); // <-- ScanInterval
QString scan_interval = QString::number( int(ScanInt) ); // <-- ScanCount
1
0
Author: demeler
Date: 2019-08-06 14:51:11 +0000 (Tue, 06 Aug 2019)
New Revision: 2801
Modified:
trunk/gui/us_select_item.cpp
trunk/programs/us_com_project/us_com_project_gui.cpp
Log:
Minor text edits
Modified: trunk/gui/us_select_item.cpp
===================================================================
--- trunk/gui/us_select_item.cpp 2019-08-03 19:48:41 UTC (rev 2800)
+++ trunk/gui/us_select_item.cpp 2019-08-06 14:51:11 UTC (rev 2801)
@@ -126,9 +126,9 @@
p.setColor(QPalette::Text, Qt::darkRed);
le_info->setPalette(p);
- le_info->setText(tr( "Information on one or more experimental methods submitted to Bechman Optima(s) is available."
- "<ul><li>You can reattach to specific job by selecting from the list below and clicking \"Select Optima Run to Follow\"</ul></li>"
- "<ul><li>Alternatively, you can click \"Define Another Experiment\" to design and/or submit a new experiment method to the availabale Optima instrument(s)</ul></li>"
+ le_info->setText(tr( "Information on one or more experimental methods submitted to Beckman Optima AUC Instruments is available."
+ "<ul><li>You can reattach to a specific job by selecting it from the list below and clicking \"Select Optima Run to Follow\"</ul></li>"
+ "<ul><li>Alternatively, you can click \"Define Another Experiment\" to design and/or submit a new experimental method to the availabale Optima instrument(s)</ul></li>"
"<ul><li>Finally, records can be deleted (\"Delete Record\"). Use with caution</ul></li>" ));
Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-03 19:48:41 UTC (rev 2800)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp 2019-08-06 14:51:11 UTC (rev 2801)
@@ -47,9 +47,9 @@
//QGridLayout* statL = new QGridLayout();
//QHBoxLayout* buttL = new QHBoxLayout();
- gen_banner = us_banner( tr( "TEST PROGRAM, v. 0.1" ) );
+ gen_banner = us_banner( tr( "UltraScan GMP, v. 0.1" ) );
//gen_banner = new QLabel;
- //gen_banner->setText("TEST PROGRAM, v. 0.1");
+ //gen_banner->setText("UltraScan GMP, v. 0.1");
//gen_banner->setAlignment(Qt::AlignCenter);
//gen_banner->setStyleSheet("background-color: #36454f; color : #D3D9DF;");
@@ -62,7 +62,7 @@
main->addWidget(gen_banner);
welcome = new QTextEdit;
- welcome->setText(" <br> Welcome to the TEST PROGRAM <br> for setting up, monitoring, editing and analyzing <br> AUC experiments and produced data... <br>");
+ welcome->setText(" <br> Welcome to UltraScan GMP<br> for setting up, monitoring, editing and analyzing <br> AUC experiments and produced data... <br>");
//welcome->setMaximumHeight(120);
welcome->setReadOnly(true);
welcome->setAlignment(Qt::AlignCenter);
@@ -213,9 +213,9 @@
//QGridLayout* statL = new QGridLayout();
//QHBoxLayout* buttL = new QHBoxLayout();
- gen_banner = us_banner( tr( "TEST PROGRAM, v. 0.1" ) );
+ gen_banner = us_banner( tr( "UltraScan GMP, v. 0.1" ) );
//gen_banner = new QLabel;
- //gen_banner->setText("TEST PROGRAM, v. 0.1");
+ //gen_banner->setText("UltraScan GMP, v. 0.1");
//gen_banner->setAlignment(Qt::AlignCenter);
//gen_banner->setStyleSheet("background-color: #36454f; color : #D3D9DF;");
@@ -228,7 +228,7 @@
main->addWidget(gen_banner);
welcome = new QTextEdit;
- welcome->setText(" <br> Welcome to the TEST PROGRAM <br> for setting up, monitoring, editing and analyzing <br> AUC experiments and produced data... <br>");
+ welcome->setText(" <br> Welcome to UltraScan GMP<br> for setting up, monitoring, editing and analyzing <br> AUC experiments and produced data... <br>");
//welcome->setMaximumHeight(120);
welcome->setReadOnly(true);
welcome->setAlignment(Qt::AlignCenter);
1
0