14 QVector< EqScanFit >& a_scanfits,
22 scanfits ( a_scanfits ),
27 mWidget ( a_mWidget ),
30 setAttribute ( Qt::WA_DeleteOnClose );
31 setWindowTitle( tr(
"Equilibrium Model Control Window" ) );
33 setMinimumSize( 200, 100 );
36 QBoxLayout*
main =
new QVBoxLayout(
this );
37 main->setContentsMargins( 2, 2, 2, 2 );
38 main->setSpacing ( 2 );
41 QGridLayout* globalLayout =
new QGridLayout;
42 QGridLayout* localLayout =
new QGridLayout;
47 tr(
"Global Run Parameters for Component: " ) );
49 QLabel* lb_param =
us_label( tr(
"Parameter:" ) );
50 QLabel* lb_guess =
us_label( tr(
"Initial Guess:" ) );
51 QLabel* lb_bounds =
us_label( tr(
"+/- Bounds:" ) );
52 QLabel* lb_units =
us_label( tr(
"Units" ) );
53 QLabel* lb_float =
us_label( tr(
"Float:" ) );
54 QLabel* lb_lock =
us_label( tr(
"Lock:" ) );
55 QLabel* lb_bound =
us_label( tr(
"Bound:" ) );
59 QLabel* lb_mwunits =
us_label( tr(
"Dalton" ) );
68 QLabel* lb_vbunits =
us_label( tr(
"ccm/g" ) );
77 QLabel* lb_l1units =
us_label( tr(
"" ) );
86 QLabel* lb_l2units =
us_label( tr(
"" ) );
95 QLabel* lb_l3units =
us_label( tr(
"" ) );
104 QLabel* lb_l4units =
us_label( tr(
"" ) );
112 globalLayout->addWidget(
lb_gbanner, row++, 0, 1, 10 );
113 globalLayout->addWidget( lb_grunpar, row, 0, 1, 7 );
114 globalLayout->addWidget(
ct_grunpar, row++, 7, 1, 3 );
115 globalLayout->addWidget( lb_param, row, 0, 1, 2 );
116 globalLayout->addWidget( lb_guess, row, 2, 1, 2 );
117 globalLayout->addWidget( lb_bounds, row, 4, 1, 2 );
118 globalLayout->addWidget( lb_units, row, 6, 1, 1 );
119 globalLayout->addWidget( lb_float, row, 7, 1, 1 );
120 globalLayout->addWidget( lb_lock, row, 8, 1, 1 );
121 globalLayout->addWidget( lb_bound, row++, 9, 1, 1 );
122 globalLayout->addWidget(
lb_molecwt, row, 0, 1, 2 );
123 globalLayout->addWidget(
le_mwguess, row, 2, 1, 2 );
124 globalLayout->addWidget(
le_mwbound, row, 4, 1, 2 );
125 globalLayout->addWidget( lb_mwunits, row, 6, 1, 1 );
126 globalLayout->addLayout( lo_mwflbox, row, 7, 1, 2 );
127 globalLayout->addLayout( lo_mwbound, row++, 9, 1, 1 );
128 globalLayout->addWidget(
pb_vbar20, row, 0, 1, 2 );
129 globalLayout->addWidget(
le_vbguess, row, 2, 1, 2 );
130 globalLayout->addWidget(
le_vbbound, row, 4, 1, 2 );
131 globalLayout->addWidget( lb_vbunits, row, 6, 1, 1 );
132 globalLayout->addLayout( lo_vbflbox, row, 7, 1, 2 );
133 globalLayout->addLayout( lo_vbbound, row++, 9, 1, 1 );
134 globalLayout->addWidget(
pb_lnasc1, row, 0, 1, 2 );
135 globalLayout->addWidget(
le_l1guess, row, 2, 1, 2 );
136 globalLayout->addWidget(
le_l1bound, row, 4, 1, 2 );
137 globalLayout->addWidget( lb_l1units, row, 6, 1, 1 );
138 globalLayout->addLayout( lo_l1flbox, row, 7, 1, 2 );
139 globalLayout->addLayout( lo_l1bound, row++, 9, 1, 1 );
140 globalLayout->addWidget(
pb_lnasc2, row, 0, 1, 2 );
141 globalLayout->addWidget(
le_l2guess, row, 2, 1, 2 );
142 globalLayout->addWidget(
le_l2bound, row, 4, 1, 2 );
143 globalLayout->addWidget( lb_l2units, row, 6, 1, 1 );
144 globalLayout->addLayout( lo_l2flbox, row, 7, 1, 2 );
145 globalLayout->addLayout( lo_l2bound, row++, 9, 1, 1 );
146 globalLayout->addWidget(
pb_lnasc3, row, 0, 1, 2 );
147 globalLayout->addWidget(
le_l3guess, row, 2, 1, 2 );
148 globalLayout->addWidget(
le_l3bound, row, 4, 1, 2 );
149 globalLayout->addWidget( lb_l3units, row, 6, 1, 1 );
150 globalLayout->addLayout( lo_l3flbox, row, 7, 1, 2 );
151 globalLayout->addLayout( lo_l3bound, row++, 9, 1, 1 );
152 globalLayout->addWidget(
pb_lnasc4, row, 0, 1, 2 );
153 globalLayout->addWidget(
le_l4guess, row, 2, 1, 2 );
154 globalLayout->addWidget(
le_l4bound, row, 4, 1, 2 );
155 globalLayout->addWidget( lb_l4units, row, 6, 1, 1 );
156 globalLayout->addLayout( lo_l4flbox, row, 7, 1, 2 );
157 globalLayout->addLayout( lo_l4bound, row++, 9, 1, 1 );
186 connect(
ct_grunpar, SIGNAL( valueChanged(
double ) ),
190 connect(
rb_mwfloat, SIGNAL( toggled(
bool ) ),
192 connect(
rb_vbfloat, SIGNAL( toggled(
bool ) ),
194 connect(
rb_l1float, SIGNAL( toggled(
bool ) ),
196 connect(
rb_l2float, SIGNAL( toggled(
bool ) ),
198 connect(
rb_l3float, SIGNAL( toggled(
bool ) ),
200 connect(
rb_l4float, SIGNAL( toggled(
bool ) ),
205 tr(
"Local Scan Parameters for Scan %1" ).arg(
selscan ) );
206 QLabel* lb_cdescr =
us_label( tr(
"Cell Description:" ) );
208 QLabel* lb_runid =
us_label( tr(
"Run ID:" ) );
210 QLabel* lb_tempera =
us_label( tr(
"Temperature (" ) +
DEGC +
"):" );
212 QLabel* lb_speed =
us_label( tr(
"Rotor Speed (rpm)" ) );
214 QLabel* lb_wavelen =
us_label( tr(
"Wavelength (nm)" ) );
216 QLabel* lb_pathlen =
us_label( tr(
"Cell Pathlength (cm)" ) );
219 QLabel* lb_plenscn =
us_label( tr(
"Scan(s)" ) );
221 QLabel* lb_baseln =
us_label( tr(
"Baseline:" ) );
224 QLabel* lb_blunits =
us_label( tr(
"OD" ) );
233 QLabel* lb_densscn =
us_label( tr(
"Scan(s)" ) );
235 QLabel* lb_param2 =
us_label( tr(
"Parameter:" ) );
236 QLabel* lb_guess2 =
us_label( tr(
"Initial Guess:" ) );
237 QLabel* lb_bounds2 =
us_label( tr(
"+/- Bounds:" ) );
238 QLabel* lb_units2 =
us_label( tr(
"Units" ) );
239 QLabel* lb_float2 =
us_label( tr(
"Float:" ) );
240 QLabel* lb_lock2 =
us_label( tr(
"Lock:" ) );
241 QLabel* lb_bound2 =
us_label( tr(
"Bound:" ) );
243 tr(
"Local Scan Parameters for Component: " ) );
245 QLabel* lb_param3 =
us_label( tr(
"Parameter:" ) );
246 QLabel* lb_guess3 =
us_label( tr(
"Initial Guess:" ) );
247 QLabel* lb_bounds3 =
us_label( tr(
"+/- Bounds:" ) );
248 QLabel* lb_units3 =
us_label( tr(
"Units" ) );
249 QLabel* lb_float3 =
us_label( tr(
"Float:" ) );
250 QLabel* lb_lock3 =
us_label( tr(
"Lock:" ) );
251 QLabel* lb_bound3 =
us_label( tr(
"Bound:" ) );
255 QLabel* lb_amunits =
us_label( tr(
"OD" ) );
264 QLabel* lb_extiscn =
us_label( tr(
"Scan(s)" ) );
266 QLabel* lb_sigma =
us_label( tr(
"Sigma for this Scan:" ) );
269 tr(
"Include this Scan in the Fit:" ),
ck_inclfit,
false );
270 QLabel* lb_scansel =
us_label( tr(
"Scan Selector:" ) );
272 QString extintt = tr(
"Extinction coefficient in units of"
273 " OD / (cm * mol)" );
278 localLayout->addWidget(
lb_lbanner, row++, 0, 1, 10 );
279 localLayout->addWidget( lb_cdescr, row, 0, 1, 2 );
280 localLayout->addWidget(
le_cdescr, row++, 2, 1, 8 );
281 localLayout->addWidget( lb_runid, row, 0, 1, 2 );
282 localLayout->addWidget(
le_runid, row, 2, 1, 2 );
283 localLayout->addWidget( lb_tempera, row, 4, 1, 2 );
284 localLayout->addWidget(
le_tempera, row++, 6, 1, 2 );
285 localLayout->addWidget( lb_speed, row, 0, 1, 2 );
286 localLayout->addWidget(
le_speed, row, 2, 1, 2 );
287 localLayout->addWidget( lb_wavelen, row, 4, 1, 2 );
288 localLayout->addWidget(
le_wavelen, row++, 6, 1, 2 );
289 localLayout->addWidget( lb_pathlen, row, 0, 1, 2 );
290 localLayout->addWidget(
le_pathlen, row, 2, 1, 2 );
291 localLayout->addWidget(
pb_plenapp, row, 4, 1, 2 );
292 localLayout->addWidget( lb_plenscn, row, 6, 1, 2 );
293 localLayout->addWidget(
le_plenscn, row++, 8, 1, 2 );
294 localLayout->addWidget( lb_param2, row, 0, 1, 2 );
295 localLayout->addWidget( lb_guess2, row, 2, 1, 2 );
296 localLayout->addWidget( lb_bounds2, row, 4, 1, 2 );
297 localLayout->addWidget( lb_units2, row, 6, 1, 1 );
298 localLayout->addWidget( lb_float2, row, 7, 1, 1 );
299 localLayout->addWidget( lb_lock2, row, 8, 1, 1 );
300 localLayout->addWidget( lb_bound2, row++, 9, 1, 1 );
301 localLayout->addWidget( lb_baseln, row, 0, 1, 2 );
302 localLayout->addWidget(
le_blguess, row, 2, 1, 2 );
303 localLayout->addWidget(
le_blbound, row, 4, 1, 2 );
304 localLayout->addWidget( lb_blunits, row, 6, 1, 1 );
305 localLayout->addLayout( lo_blflbox, row, 7, 1, 2 );
306 localLayout->addLayout( lo_blbound, row++, 9, 1, 1 );
307 localLayout->addWidget(
pb_density, row, 0, 1, 2 );
308 localLayout->addWidget(
le_density, row, 2, 1, 2 );
309 localLayout->addWidget(
pb_densapp, row, 4, 1, 2 );
310 localLayout->addWidget( lb_densscn, row, 6, 1, 2 );
311 localLayout->addWidget(
le_densscn, row++, 8, 1, 2 );
312 localLayout->addWidget( lb_lrunpar, row, 0, 1, 7 );
313 localLayout->addWidget(
ct_lrunpar, row++, 7, 1, 3 );
314 localLayout->addWidget( lb_param3, row, 0, 1, 2 );
315 localLayout->addWidget( lb_guess3, row, 2, 1, 2 );
316 localLayout->addWidget( lb_bounds3, row, 4, 1, 2 );
317 localLayout->addWidget( lb_units3, row, 6, 1, 1 );
318 localLayout->addWidget( lb_float3, row, 7, 1, 1 );
319 localLayout->addWidget( lb_lock3, row, 8, 1, 1 );
320 localLayout->addWidget( lb_bound3, row++, 9, 1, 1 );
321 localLayout->addWidget(
lb_amplitu, row, 0, 1, 2 );
322 localLayout->addWidget(
le_amguess, row, 2, 1, 2 );
323 localLayout->addWidget(
le_ambound, row, 4, 1, 2 );
324 localLayout->addWidget( lb_amunits, row, 6, 1, 1 );
325 localLayout->addLayout( lo_amflbox, row, 7, 1, 2 );
326 localLayout->addLayout( lo_ambound, row++, 9, 1, 1 );
327 localLayout->addWidget(
pb_extinct, row, 0, 1, 2 );
328 localLayout->addWidget(
le_extinct, row, 2, 1, 2 );
329 localLayout->addWidget(
pb_extiapp, row, 4, 1, 2 );
330 localLayout->addWidget( lb_extiscn, row, 6, 1, 2 );
331 localLayout->addWidget(
le_extiscn, row++, 8, 1, 2 );
332 localLayout->addWidget( lb_sigma, row, 0, 1, 2 );
333 localLayout->addWidget(
le_sigma, row++, 2, 1, 2 );
334 localLayout->addLayout( lo_inclfit, row, 0, 1, 4 );
335 localLayout->addWidget( lb_scansel, row, 4, 1, 3 );
336 localLayout->addWidget(
ct_scansel, row++, 7, 1, 3 );
349 connect(
ct_lrunpar, SIGNAL( valueChanged(
double ) ),
351 connect(
ct_scansel, SIGNAL( valueChanged(
double ) ),
353 connect(
rb_blfloat, SIGNAL( toggled(
bool ) ),
355 connect(
rb_amfloat, SIGNAL( toggled(
bool ) ),
375 QHBoxLayout* buttons =
new QHBoxLayout;
379 connect( pb_help, SIGNAL( clicked() ), SLOT(
help() ) );
380 connect( pb_close, SIGNAL( clicked() ), SLOT(
selected() ) );
381 buttons->addStretch( );
382 buttons->addWidget( pb_help );
383 buttons->addWidget( pb_close );
384 buttons->setStretch( 0, 2 );
385 buttons->setStretch( 1, 1 );
386 buttons->setStretch( 2, 1 );
388 main->addLayout( globalLayout );
389 main->addLayout( localLayout );
390 main->addLayout( buttons );
393 int scanx = selscan - 1;
416 setMinimumSize( 600, 500 );
424 qDebug() <<
"EMC: new_scan" << scannbr;
435 qDebug() <<
"EMC: new_components" <<
modelx;
451 qDebug() <<
"EMC: set_float" << floated;
507 qDebug() <<
"EMC: scan_changed" << value;
510 int jj = ltext.lastIndexOf(
" " ) + 1;
511 int nch = ltext.mid( jj ).length();
512 QString scan_s = QString::number(
selscan );
513 ltext.replace( jj, nch, scan_s );
530 bool scnFit =
scanfits[ scanx ].scanFit;
535 double ampv =
scanfits[ scanx ].amp_vals[ compx ];
536 double ampb =
scanfits[ scanx ].amp_rngs[ compx ];
537 ampb = ( ampb == 0.0 ) ? ( ampv * 0.2 ) : ampb;
538 le_amguess->setText( QString::number( ampv ) );
539 le_ambound->setText( QString::number( ampb ) );
540 jj =
min(
scanfits[ scanx ].extincts.size() - 1, compx );
550 if (
scanfits[ scanx ].amp_fits[ compx ] )
572 qDebug() <<
"EMC: global_comp_changed" << value;
573 int compn = (int)value;
574 int compx = compn - 1;
577 QString comp_s = QString::number( compn );
578 int mwnx = molwlb.lastIndexOf(
"(" ) + 1;
579 int lnmwr = molwlb.mid( mwnx ).lastIndexOf(
")" );
580 int vbnx = vbarpb.lastIndexOf(
"(" ) + 1;
581 int lnvbr = vbarpb.mid( vbnx ).lastIndexOf(
")" );
584 molwlb.replace( mwnx, lnmwr, comp_s );
585 vbarpb.replace( vbnx, lnvbr, comp_s );
634 qDebug() <<
"EMC: local_comp_changed" << value;
635 int compn = (int)value;
636 int compx = compn - 1;
642 QString comp_s = QString::number( compn );
643 int amnx = ampllb.lastIndexOf(
"(" ) + 1;
644 int lnamr = ampllb.mid( amnx ).lastIndexOf(
")" );
645 int exnx = extipb.lastIndexOf(
"(" ) + 1;
646 int lnexr = extipb.mid( exnx ).lastIndexOf(
")" );
647 ampllb.replace( amnx, lnamr, comp_s );
648 extipb.replace( exnx, lnexr, comp_s );
652 double ampv =
scanfits[ scanx ].amp_vals[ compx ];
653 double ampb =
scanfits[ scanx ].amp_rngs[ compx ];
654 ampb = ( ampb == 0.0 ) ? ( ampv * 0.2 ) : ampb;
655 le_amguess->setText( QString::number( ampv ) );
656 le_ambound->setText( QString::number( ampb ) );
658 int jj =
min(
scanfits[ scanx ].extincts.size() - 1, compx );
682 qDebug() <<
"EMC: update_sigma";
689 double density = sfit->
density;
691 double tempk = tempa +
K0;
693 double omega_s =
sq( sfit->
rpm * M_PI / 30.0 );
697 solution.
vbar = vbar;
703 double sigma = ( 1.0 - vbar * solution.
density_tb ) * omega_s * molecwt
704 / ( 2.0 *
R * tempk );
705 le_sigma->setText( QString::number( sigma ) );
706 qDebug() <<
"EMC: u_s: scanx compx" << scanx << compx;
707 qDebug() <<
"EMC: u_s: mw vbar20 vbar" << molecwt << vbar20 << vbar;
708 qDebug() <<
"EMC: u_s: dens dens_tb" << density << solution.
density_tb;
709 qDebug() <<
"EMC: u_s: sigma" << sigma;
715 qDebug() <<
"EMC:UpFl: chng_floats" <<
chng_floats;
757 int extix =
min( compx,
scanfits[ scanx ].extincts.size() - 1 );
822 QString scans =
le_plenscn->text().simplified();
823 int jj = scans.indexOf(
"-" );
824 jj = ( jj < 0 ) ? scans.indexOf(
" " ) : jj;
825 jj = ( jj < 0 ) ? scans.indexOf(
"," ) : jj;
826 int iscan = scans.toInt();
828 double pathln =
le_pathlen->text().toDouble();
832 iscan = scans.left( jj ).toInt();
833 lscan = scans.mid( jj + 1 ).toInt();
836 for (
int ii = iscan - 1; ii < lscan; ii++ )
845 QString scans =
le_densscn->text().simplified();
846 int jj = scans.indexOf(
"-" );
847 jj = ( jj < 0 ) ? scans.indexOf(
" " ) : jj;
848 jj = ( jj < 0 ) ? scans.indexOf(
"," ) : jj;
849 int iscan = scans.toInt();
851 double densty =
le_density->text().toDouble();
855 iscan = scans.left( jj ).toInt();
856 lscan = scans.mid( jj + 1 ).toInt();
859 for (
int ii = iscan - 1; ii < lscan; ii++ )
868 QString scans =
le_extiscn->text().simplified();
869 int jj = scans.indexOf(
"-" );
870 jj = ( jj < 0 ) ? scans.indexOf(
" " ) : jj;
871 jj = ( jj < 0 ) ? scans.indexOf(
"," ) : jj;
872 int iscan = scans.toInt();
875 double extval =
le_extinct->text().toDouble();
879 iscan = scans.left( jj ).toInt();
880 lscan = scans.mid( jj + 1 ).toInt();
883 for (
int ii = iscan - 1; ii < lscan; ii++ )
885 scanfits[ ii ].extincts[ compx ] = extval;
891 QGridLayout* lo_rb1, QRadioButton* rbtn1,
892 QGridLayout* lo_rb2, QRadioButton* rbtn2 )
895 QHBoxLayout* lo_radiobox =
new QHBoxLayout;
896 lo_radiobox->setSpacing ( 0 );
897 lo_radiobox->setContentsMargins( 0, 0, 0, 0 );
898 lo_radiobox->addLayout( lo_rb1 );
899 lo_radiobox->addLayout( lo_rb2 );
901 QButtonGroup* btn_grp =
new QButtonGroup();
902 btn_grp->addButton( rbtn1 );
903 btn_grp->addButton( rbtn2 );
904 btn_grp->setExclusive(
true );
914 connect( adiag, SIGNAL( valueChanged(
US_Analyte ) ),
917 qApp->processEvents();
926 connect( bdiag, SIGNAL( valueChanged(
US_Buffer ) ),
929 qApp->processEvents();