48 tr(
"Y-Axis Title" ) );
55 tr(
"Y-Axis Title" ) );
69 connect(
pb_load, SIGNAL( clicked() ), SLOT(
load() ) );
101 connect(
pb_close, SIGNAL( clicked() ), SLOT( close() ) );
104 QLabel* lb_info =
us_banner( tr(
"Information for this Run" ) );
105 QLabel* lb_triples =
us_banner( tr(
"Cell / Channel / Wavelength" ) );
106 QLabel* lb_id =
us_label ( tr(
"Run ID / Edit ID:" ) );
107 QLabel* lb_temp =
us_label ( tr(
"Avg Temperature:" ) );
117 QFontMetrics fm ( font );
119 int fontHeight = fm.lineSpacing();
121 te_desc ->setMaximumHeight( fontHeight * 2 + 12 );
122 lw_triples->setMaximumHeight( fontHeight * 6 + 12 );
142 QLabel* lb_density =
us_label( tr(
"Density (20" ) +
DEGC +
")" );
143 QLabel* lb_viscosity =
us_label( tr(
"Viscosity (20" ) +
DEGC +
")" );
144 QLabel* lb_vbar =
us_label( tr(
"Vbar (20" ) +
DEGC +
")" );
145 QLabel* lb_skipped =
us_label( tr(
"Skipped:" ) );
173 QLabel* lb_analysis =
us_banner( tr(
"Analysis Controls" ) );
174 QLabel* lb_smoothing =
us_label ( tr(
"Data Smoothing:" ) );
175 QLabel* lb_boundPercent =
us_label ( tr(
"% of Boundary:" ) );
176 QLabel* lb_boundPos =
us_label ( tr(
"Boundary Pos. (%):" ) );
178 QLabel* lb_from =
us_label ( tr(
"Scan focus from:" ) );
179 QLabel* lb_to =
us_label ( tr(
"to:" ) );
191 connect(
ct_smoothing, SIGNAL( valueChanged(
double ) ),
206 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
208 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
232 setMaximumSize( qApp->desktop()->size() - QSize( 60, 60 ) );
267 connect( dialog, SIGNAL( changed(
bool ) ), SLOT(
update_disk_db(
bool ) ) );
268 connect( dialog, SIGNAL( progress (
const QString ) ),
271 if ( dialog->exec() != QDialog::Accepted )
return;
278 directory = description.section( description.left( 1 ), 4, 4 );
282 for (
int ii=0; ii <
triples.size(); ii++ )
285 int nscans =
dataList[ 0 ].scanCount();
288 for (
int ii = 0; ii < nscans; ii++ )
296 connect(
lw_triples, SIGNAL( currentRowChanged(
int ) ),
307 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
312 qApp->processEvents();
324 le_temp->setText( QString::number( avTemp,
'f', 1 ) +
" " +
DEGC );
333 ct_to ->setStep( 1.0 );
342 QString svbar =
le_vbar ->text();
351 bvisc, bcomp, bmanu, errmsg );
361 manual = ( !bmanu.isEmpty() && bmanu ==
"1" );
365 if ( solID.isEmpty() )
367 QMessageBox::warning(
this, tr(
"Solution/Buffer Values Fetch" ),
368 tr(
"Empty solution ID value!" ) );
371 else if ( solID.length() < 36 && dbP != NULL )
383 svbar = QString::number(
vbar );
389 QMessageBox::warning(
this, tr(
"Solution/Buffer Values Fetch" ),
392 le_solution ->setText( tr(
"( ***Undefined*** )" ) );
409 qApp->processEvents();
418 QString dataType = tr(
"Absorbance" );
419 if ( d->
dataType ==
"RI" ) dataType = tr(
"Intensity" );
420 if ( d->
dataType ==
"WI" ) dataType = tr(
"Intensity" );
421 if ( d->
dataType ==
"IP" ) dataType = tr(
"Interference" );
422 if ( d->
dataType ==
"FI" ) dataType = tr(
"Fluorescence" );
424 QString header = tr(
"Velocity Data for\n") + d->
runID +
" ("
428 header = dataType + tr(
" at " ) + d->
wavelength + tr(
" nm" );
429 data_plot2->setAxisTitle( QwtPlot::yLeft, header );
431 header = tr(
"Radius (cm) " );
432 data_plot2->setAxisTitle( QwtPlot::xBottom, header );
438 int from = (int)
ct_from->value();
439 int to = (int)
ct_to ->value();
448 QVector< double > rvec( points );
449 QVector< double > vvec( points );
450 double* r = rvec.data();
451 double* v = vvec.data();
466 for (
int i = 0; i < scanCount; i++ )
471 bool highlight = scan_number >= from && scan_number <= to;
475 double range = s->
plateau - baseline;
476 double lower_limit = baseline + range * positionPct;
477 double upper_limit = lower_limit + range * boundaryPct;
484 while ( j < points && s->rvalues[ j ] < lower_limit )
497 title = tr(
"Curve " ) + QString::number( i ) + tr(
" below range" );
501 c->setPen( QPen( Qt::red ) );
503 c->setPen( QPen( Qt::cyan ) );
505 c->setData( r, v, count );
510 while ( j < points && s->rvalues[ j ] < upper_limit )
520 title = tr(
"Curve " ) + QString::number( i ) + tr(
" in range" );
524 c->setPen( QPen( Qt::red ) );
528 c->setData( r, v, count );
543 title = tr(
"Curve " ) + QString::number( i ) + tr(
" above range" );
547 c->setPen( QPen( Qt::red ) );
549 c->setPen( QPen( Qt::cyan ) );
551 c->setData( r, v, count );
584 double to =
ct_to->value();
589 ct_to->setValue( from );
591 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
600 double from =
ct_from->value();
607 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
616 double from =
ct_from->value();
617 double to =
ct_to ->value();
619 int displayedScan = 1;
622 int totalScans = d->
scanData.size();
624 for(
int i = 0; i < totalScans; i++ )
628 if ( displayedScan >= from && displayedScan <= to )
excludedScans << i;
633 ct_to->setValue( 0 );
646 int totalScans = d->
scanData.size();
651 ct_from->setMaxValue( totalScans );
652 ct_to ->setMaxValue( totalScans );
654 if (
ct_to->value() != 0 )
655 ct_to ->setValue( 0 );
667 int smoothPoints = (int) smoothCount;
673 for (
int ii = 0; ii < dat->
scanCount(); ii++ )
677 if ( smoothPoints > 1 )
679 QVector< double > xwvec( smoothPoints );
680 QVector< double > ywvec( smoothPoints );
685 double increment = 2.0 / smoothCount;
689 for (
int jj = 0; jj < smoothPoints; jj++ )
702 for (
int ii = 0; ii < dat->
scanData.size(); ii++ )
707 for (
int jj = 0; jj < smoothPoints; jj++ )
713 for (
int jj = smoothPoints; jj < scanPoints - smoothPoints - 1; jj++ )
719 for (
int jj = scanPoints - smoothPoints - 1; jj < scanPoints; jj++ )
732 int scan,
int point,
int type,
int smoothPoints,
int scanPoints )
748 stop = point + smoothPoints;
754 stop = point - smoothPoints;
771 if ( point - position < 0 )
774 value = savedValues[ scan ][ point ] - dy;
781 sum_y += y_weights[ position ];
785 if ( k > stop )
break;
789 if ( k <= stop )
break;
797 sum_y += y_weights[ 0 ];
803 stop = point - smoothPoints;
809 stop = point + smoothPoints;
823 if ( point + position >= scanPoints )
827 value = savedValues[ scan ][ point ] - dy;
833 sum += value * y_weights[ position ];
834 sum_y += y_weights[ position ];
838 if ( k <= stop )
break;
842 if ( k > stop )
break;
866 le_vbar ->setText( QString::number(
vbar,
'f', 5 ) );
874 for (
int ii = 0; ii < dat->
scanData.size(); ii++ )
881 ct_to ->disconnect();
887 ct_to ->setValue( 0 );
892 connect(
ct_from, SIGNAL( valueChanged(
double ) ),
895 connect(
ct_to, SIGNAL( valueChanged(
double ) ),
904 connect(
ct_smoothing, SIGNAL( valueChanged(
double ) ),
922 for (
int ii = 0; ii < dat->
scanCount(); ii++ )
933 if ( ! dir.exists( repdir ) ) dir.mkpath( repdir );
940 scan = &
dataList[ row ].scanData.last();
943 point = ( point < 5 ) ? 5 : point;
946 for (
int j = point - 5; j < point + 6; j++ )
955 return QString(
" " ).leftJustified( spaces,
' ' );
961 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td></tr>\n" );
966 const QString& s3 )
const
968 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>"
969 + s3 +
"</td></tr>\n" );
974 const QString& s3,
const QString& s4,
975 const QString& s5 )
const
977 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>"
978 + s3 +
"</td><td>" + s4 +
"</td><td>" + s5 +
"</td></tr>\n" );
983 const QString& s3,
const QString& s4,
984 const QString& s5,
const QString& s6,
985 const QString& s7 )
const
987 return (
indent( 6 ) +
"<tr><td>" + s1 +
"</td><td>" + s2 +
"</td><td>"
988 + s3 +
"</td><td>" + s4 +
"</td><td>" + s5 +
"</td><td>"
989 + s6 +
"</td><td>" + s7 +
"</td></tr>\n" );
996 QString ss = QString(
"<?xml version=\"1.0\"?>\n" );
997 ss +=
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n";
998 ss +=
" \"http://www.w3.org/TR/xhtml1/DTD"
999 "/xhtml1-strict.dtd\">\n";
1000 ss +=
"<html xmlns=\"http://www.w3.org/1999/xhtml\""
1001 " xml:lang=\"en\" lang=\"en\">\n";
1003 ss +=
" <title> " + title +
" </title>\n";
1004 ss +=
" <meta http-equiv=\"Content-Type\" content="
1005 "\"text/html; charset=iso-8859-1\"/>\n";
1006 ss +=
" <style type=\"text/css\" >\n";
1007 ss +=
" td { padding-right: 1em; }\n";
1008 ss +=
" body { background-color: white; }\n";
1009 ss +=
" </style>\n";
1010 ss +=
" </head>\n <body>\n";
1011 ss +=
" <h1>" + head1 +
"</h1>\n";
1012 ss +=
indent( 4 ) + tr(
"<h2>Data Report for Run \"" ) + edata->
runID;
1013 ss +=
"\",<br/>\n" +
indent( 4 ) +
" " + tr(
" Cell " ) + edata->
cell;
1014 ss += tr(
", Channel " ) + edata->
channel;
1015 ss += tr(
", Wavelength " ) + edata->
wavelength;
1016 ss +=
",<br/>\n" +
indent( 4 ) +
" " + tr(
" Edited Dataset " );
1017 ss += edata->
editID +
"</h2>\n";
1027 QString s =
"\n" +
indent( 4 )
1028 + tr(
"<h3>Detailed Run Information:</h3>\n" )
1029 +
indent( 4 ) +
"<table>\n"
1033 QString::number( (
int)d->
scanData[ 0 ].rpm ) +
" rpm" );
1037 double maxTemp = -1.0e99;
1038 double minTemp = 1.0e99;
1040 for (
int i = 0; i < d->
scanData.size(); i++ )
1042 double t = d->
scanData[ i ].temperature;
1044 maxTemp =
max( maxTemp, t );
1045 minTemp =
min( minTemp, t );
1048 QString average = QString::number( sum / d->
scanData.size(),
'f', 1 );
1050 s +=
table_row( tr(
"Average Temperature:" ), average +
" " +
MLDEGC );
1053 s +=
table_row( tr(
"Temperature Variation:" ), tr(
"Within tolerance" ) );
1055 s +=
table_row( tr(
"Temperature Variation:" ),
1056 tr(
"(!) OUTSIDE TOLERANCE (!)" ) );
1062 QString m = ( minutes == 1 ) ? tr(
" minute " ) : tr(
" minutes " );
1063 QString sec = ( seconds == 1 ) ? tr(
" second" ) : tr(
" seconds" );
1065 s +=
table_row( tr(
"Time Correction:" ),
1066 QString::number( minutes ) + m +
1067 QString::number( seconds ) + sec );
1069 double duration =
rawList.last().scanData.last().seconds;
1071 int hours = (int) duration / 3600;
1072 minutes = (int) duration / 60 - hours * 60;
1073 seconds = (int) duration % 60;
1074 QString dataType = tr(
"Absorbance:" );
1075 if ( d->
dataType ==
"RI" ) dataType = tr(
"Intensity:" );
1076 if ( d->
dataType ==
"WI" ) dataType = tr(
"Intensity:" );
1077 if ( d->
dataType ==
"IP" ) dataType = tr(
"Interference:" );
1078 if ( d->
dataType ==
"FI" ) dataType = tr(
"Fluorescence:" );
1081 h = ( hours == 1 ) ? tr(
" hour " ) : tr(
" hours " );
1082 m = ( minutes == 1 ) ? tr(
" minute " ) : tr(
" minutes " );
1083 sec = ( seconds == 1 ) ? tr(
" second" ) : tr(
" seconds" );
1086 QString::number( hours ) + h +
1087 QString::number( minutes ) + m +
1088 QString::number( seconds ) + sec );
1092 table_row( tr(
"Baseline " ) + dataType,
1095 QString::number( d->
meniscus,
'f', 3 ) +
" cm" );
1097 int rrx = d->
xvalues.size() - 1;
1098 double left = d->
xvalues[ 0 ];
1099 double right = d->
xvalues[ rrx ];
1101 s +=
table_row( tr(
"Edited Data starts at:" ),
1102 QString::number( left,
'f', 3 ) +
" cm" ) +
1103 table_row( tr(
"Edited Data stops at:" ),
1104 QString::number( right,
'f', 3 ) +
" cm" );
1105 s +=
indent( 4 ) +
"</table>\n";
1117 double avgTemp =
le_temp ->text().section(
" ", 0, 0 ).toDouble();
1121 QString s =
"\n" +
indent( 4 ) + tr(
"<h3>Hydrodynamic Settings:</h3>\n" )
1122 +
indent( 4 ) +
"<table>\n";
1124 s +=
table_row( tr(
"Viscosity corrected:" ),
1125 QString::number( solution.
viscosity,
'f', 5 ) ) +
1126 table_row( tr(
"Viscosity (absolute):" ),
1129 QString::number( solution.
density,
'f', 6 ) +
" g/ccm" ) +
1131 QString::number( solution.
density_tb,
'f', 6 ) +
" g/ccm" ) +
1133 QString::number( solution.
vbar,
'f', 4 ) +
" ccm/g" ) +
1135 QString::number( solution.
vbar20,
'f', 4 ) +
" ccm/g" ) +
1137 QString::number( solution.
buoyancyw,
'f', 6 ) ) +
1138 table_row( tr(
"Buoyancy (absolute):" ),
1139 QString::number( solution.
buoyancyb,
'f', 6 ) ) +
1140 table_row( tr(
"Correction Factor (s):" ),
1142 table_row( tr(
"Correction Factor (D):" ),
1144 indent( 4 ) +
"</table>\n";
1151 QString s =
"\n" +
indent( 4 ) + tr(
"<h3>Data Analysis Settings:</h3>\n" )
1152 +
indent( 4 ) +
"<table>\n";
1154 s +=
table_row( tr(
"Smoothing Frame:" ),
1156 s +=
table_row( tr(
"Analyzed Boundary:" ),
1158 s +=
table_row( tr(
"Boundary Position:" ),
1160 s +=
table_row( tr(
"Early Scans skipped:" ),
1164 s +=
indent( 4 ) +
"</table>\n";
1174 QString s =
"\n" +
indent( 4 ) + tr(
"<h3>Scan Information:</h3>\n" )
1175 +
indent( 4 ) +
"<table>\n";
1177 s +=
table_row( tr(
"Scan" ), tr(
"Corrected Time" ),
1178 tr(
"Plateau Concentration" ) );
1180 for (
int i = 0; i < d->
scanData.size(); i++ )
1188 double od = d->
scanData[ i ].plateau;
1191 s1 = s1.sprintf(
"%4d", i + 1 );
1192 s2 = s2.sprintf(
"%4d min %2d sec", time / 60, time % 60 );
1193 s3 = s3.sprintf(
"%.6f OD", od );
1198 s +=
indent( 4 ) +
"</table>\n";
1205 QDir folder( baseDir );
1207 if ( folder.exists( subdir ) )
return true;
1209 if ( folder.mkdir( subdir ) )
return true;
1211 QMessageBox::warning(
this,
1213 tr(
"Could not create the directory:\n" ) + baseDir +
"/" + subdir );
1221 te_desc->setHtml(
"<b>" + message +
" ...</b>" );
1222 qApp->processEvents();
1243 QStringList mieGUIDs;
1244 QStringList nieGUIDs;
1246 te_desc->setHtml( tr(
"<b>Scanning noise for %1 ...</b>" )
1248 qApp->processEvents();
1251 bool local = ! loadDB;
1252 int nenois = lnoise.
count_noise( local, edata, NULL, mieGUIDs, nieGUIDs );
1253 te_desc->setHtml( tr(
"<b>%1 noise(s) found for %2</b>" )
1254 .arg( nenois ).arg(
triples[ index ] ) );
1255 qApp->processEvents();
1269 nldiag->move( this->pos() + QPoint( 200, 200 ) );
1271 qApp->processEvents();
1278 QString noiID = nieGUIDs.at( 0 );
1279 QString typen = noiID.section(
":", 1, 1 );
1280 noiID = noiID.section(
":", 0, 0 );
1282 if ( typen ==
"ti" )
1296 if ( ntinois > 0 && ntinois < npoints )
1299 while ( jj++ < npoints )
1305 if ( nrinois > 0 && nrinois < nscans )
1308 while ( jj++ < nscans )
1319 pmsg = tr(
"The noise file was padded out with zeroes\n"
1320 "in order to match the data range." );
1322 pmsg = tr(
"The noise files were padded out with zeroes\n"
1323 "in order to match the data ranges." );
1325 QMessageBox::information(
this, tr(
"Noise Padded Out" ), pmsg );
1330 for (
int ii = 0; ii < nscans; ii++ )
1332 int iin =
min( ii, ( nrinois - 1 ) );
1336 for (
int jj = 0; jj < npoints; jj++ )
1338 int jjn =
min( jj, ( ntinois - 1 ) );
1341 escan->rvalues[ jj ] = edata->
value( ii, jj ) - rinoi - tinoi;
1345 escan->plateau = escan->rvalues[ plx ];
1379 QStringList query(
"get_experiment_info_by_runID" );
1385 expID = db.value( 1 ).toString().toInt();
1392 connect( soluInfo, SIGNAL( updateSolutionGuiSelection(
US_Solution ) ),
1404 QString sbufID = QString::number( bufID );
1408 QString svbar =
le_vbar ->text();
1411 QString errmsg =
"";
1413 qDebug() <<
"updSolu: manual" << bmanu;
1421 bdens, bvisc, bcmpr, bmanu, errmsg );
1427 bdens, bvisc, bcmpr, bmanu, errmsg );
1433 svbar = QString::number(
vbar );
1434 manual = ( !bmanu.isEmpty() && bmanu ==
"1" );
1441 qDebug() <<
"updSolu: reread manual" <<
manual << bmanu;
1448 "Noise has previously been applied to this triple.<br/>"
1449 "Do you want to retain the previous noise selection?<br/>"
1450 "<ul><li><b>Yes</b> to retain the applied noise selection;</li>"
1451 "<li><b>No </b> to apply a new noise selection.</li></ul>" );
1453 QMessageBox msgBox(
this );
1454 msgBox.setWindowTitle( tr(
"Noise Already Applied" ) );
1455 msgBox.setTextFormat ( Qt::RichText );
1456 msgBox.setText ( msg );
1457 msgBox.addButton ( QMessageBox::No );
1458 msgBox.addButton ( QMessageBox::Yes );
1459 msgBox.setDefaultButton( QMessageBox::Yes );
1461 bool retain = ( msgBox.exec() == QMessageBox::Yes );
1487 QString pfdir = QString( files[ 0 ] ).section(
"/", 0, -2 );
1490 query <<
"get_editID" << edata->
editGUID;
1493 int idEdit = db.value( 0 ).toString().toInt();
1505 qDebug() <<
"*ERROR* saveFileDocuments, status" << st;
1512 QFile f_rep( dsfname );
1514 bool is_ok = f_rep.open( QIODevice::WriteOnly | QIODevice::Truncate );
1519 QTextStream ts( &f_rep );
1524 QString title =
"US_Analysis_Base";
1525 QString head1 = tr(
"General Data Set Information" );
1531 ts <<
indent( 2 ) +
"</body>\n</html>\n";
1539 const QString fname )
1543 if ( fname.contains(
".svg" ) )
1544 flist << QString( fname ).section(
".", 0, -2 ) +
".png";