[us-commits] r2833 - in trunk: programs/us_convert programs/us_xpn_viewer utils

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Sun Sep 22 08:56:02 MDT 2019


Author: gegorbet
Date: 2019-09-22 14:56:01 +0000 (Sun, 22 Sep 2019)
New Revision: 2833

Modified:
   trunk/programs/us_convert/us_convert_gui.cpp
   trunk/programs/us_convert/us_convertio.cpp
   trunk/programs/us_xpn_viewer/us_xpn_run_auc.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
   trunk/utils/us_xpn_data.cpp
   trunk/utils/us_xpn_data.h
Log:
convert--download timestate if needed + proper lambda range adjust, xpn_viewer--fix crash + warn with ScanMask,#scans discrepancy

Modified: trunk/programs/us_convert/us_convert_gui.cpp
===================================================================
--- trunk/programs/us_convert/us_convert_gui.cpp	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/programs/us_convert/us_convert_gui.cpp	2019-09-22 14:56:01 UTC (rev 2833)
@@ -43,7 +43,7 @@
 #endif
 
 
-US_ConvertGui::US_ConvertGui(QString auto_mode) : US_Widgets()
+US_ConvertGui::US_ConvertGui( QString auto_mode ) : US_Widgets()
 {
    ExpData.invID = US_Settings::us_inv_ID();
 
@@ -1520,6 +1520,7 @@
 void US_ConvertGui::import()
 {
    impType     = getImports();
+DbgLv(1) << "CGui:IMP: impType" << impType;
 
    if ( impType == 1 )
    {
@@ -1540,6 +1541,7 @@
    le_status->setText( tr( "Importing experimental data ..." ) );
 
    success = read();                // Read the legacy data
+DbgLv(1) << "CGui:IMP: read success" << success;
 
    if ( ! success ) return;
 
@@ -1551,11 +1553,13 @@
 
    // Figure out all the triple combinations and convert data
    success = convert();
+DbgLv(1) << "CGui:IMP: convert success" << success;
 
    if ( ! success ) return;
 
    // Initialize export data pointers vector
    success = init_output_data();
+DbgLv(1) << "CGui:IMP: initout success" << success;
 
    if ( ! success ) return;
 
@@ -1589,9 +1593,9 @@
    {
       referenceDefined = false;
       pb_reference->setEnabled( true );
-DbgLv(1) << "CGui: (2)referDef=" << referenceDefined;
+DbgLv(1) << "CGui:IMP: (2)referDef=" << referenceDefined;
    }
-DbgLv(1) << "CGui: import: RTN";
+DbgLv(1) << "CGui:IMP: import: RTN";
    le_status->setText( tr( "Legacy data has been imported." ) );
 }
 
@@ -1782,7 +1786,7 @@
    QString importDir = currentDir;
    QDir readDir( importDir );
 
-   qDebug() << "CURRENT DIR_1: " << importDir;
+DbgLv(1) << "CGui:iA: CURRENT DIR_1: " << importDir;
 
    QApplication::setOverrideCursor( QCursor( Qt::WaitCursor ) );
    le_status->setText( tr( "Loading AUC data ..." ) );
@@ -1805,7 +1809,7 @@
       // Give it a new unique GUID, since we are making a copy
       QString uuidst = US_Util::new_guid();
       US_Util::uuid_parse( uuidst, (unsigned char*)&rdata.rawGUID );
-DbgLv(1) << "rIA: trx" << trx << "uuid" << uuidst << importDir;
+DbgLv(1) << "CGui:iA:  trx" << trx << "uuid" << uuidst << importDir;
 
       // Save the raw data for this triple
       allData << rdata;
@@ -1832,9 +1836,9 @@
 
    // //TEMP
    //runID += QString("-test");
+
+DbgLv(1) << "CGui:iA:  RUNID from files[0]: files[0]" << fname << ", runID: " << runID;
      
-   qDebug() << "RUNID from files[0]: files[0]" << fname << ", runID: " << runID;
-     
    le_runID2->setText( runID );
    le_runID ->setText( runID );
    scanTolerance = 5.0;
@@ -1931,7 +1935,7 @@
 
    // Point to any existing time state file
    QDir ddir( currentDir );
-   qDebug() << "CURRENT DIR_2: " << currentDir;
+DbgLv(1) << "CGui:iA:  CURRENT DIR_2: " << currentDir;
    QStringList tmsfs = ddir.entryList( QStringList( "*.time_state.*" ),
          QDir::Files, QDir::Name );
    QString defs_fnamei;
@@ -1971,11 +1975,11 @@
       tmst_fnamei.clear();
    }
 
-   if (!us_convert_auto_mode)
-     {
-       //le_status->setText( tr( "AUC data import IS COMPLETE." ) );
-       le_status->setText( tr( "Loading Data from Disk Successful." ) );
-     }
+   if ( !us_convert_auto_mode )
+   {
+      //le_status->setText( tr( "AUC data import IS COMPLETE." ) );
+      le_status->setText( tr( "Loading Data from Disk Successful." ) );
+   }
      
    pb_showTmst->setEnabled( ! tmst_fnamei.isEmpty() );
 }
@@ -2766,24 +2770,22 @@
    int cellnumber;
    
    if ( isMwl )
-     {
-       qDebug() << "SOLUTION is READ in MWL mode !!! ";
-       for (int i = 0; i < nchans; ++i )
-	 {	   
-	   //Solution
-	   solutionID = ProtInfo.ProtSolutions.chsols[ i ].sol_id.toInt();
-	   solution_auto.readFromDB(solutionID, &db);
+   {
+      qDebug() << "SOLUTION is READ in MWL mode !!! ";
+      for (int i = 0; i < nchans; ++i )
+      {	   
+         //Solution
+	 solutionID = ProtInfo.ProtSolutions.chsols[ i ].sol_id.toInt();
+	 solution_auto.readFromDB(solutionID, &db);
 
 	   qDebug() << "SOLS 0";
-	   
+
 	   out_chaninfo[ i ].solution = solution_auto;
 
 	   qDebug() << "SOLS 0a";
-
 	   qDebug() << "out_chandatx[ i ] + cb_lambplot->currentIndex() " <<  out_chandatx[ i ] << " + " <<  cb_lambplot->currentIndex() << out_chandatx[ i ] + cb_lambplot->currentIndex();
 	   
 	   //out_tripinfo[ out_chandatx[ i ] + cb_lambplot->currentIndex() ].solution = solution_auto; // ALEXEY <-- BUG
-
 	   qDebug() << "SOLS 1";
 	   
 	   //DUPL
@@ -3376,10 +3378,12 @@
  << "centp sol" << cCenterpiece << cSolution.solutionGUID;
    }
 
+DbgLv(1) << "CGui:ldDk:isMwl" << isMwl;
    if ( isMwl )
    {  // If need be, load MWL data object
       mwl_data.load_mwl( allData );
 
+DbgLv(1) << "CGui:ldDk: mwlsetup";
       mwl_setup();
    }
 
@@ -4085,6 +4089,9 @@
          mwl_connect( true );
       }
 
+//      slambdas_per_channel.resize( nchans );
+//      elambdas_per_channel.resize( nchans );
+
       for ( int ccx = 0; ccx < nchans; ccx++ )
       {  // Reformat the triples entries
          nlambda        = mwl_data.lambdas( exp_lambdas, ccx );
@@ -4097,7 +4104,11 @@
          lw_triple->addItem( out_channels[ ccx ]
                            + QString( " / %1-%2 (%3)" )
                            .arg( slambda ).arg( elambda ).arg( nlambda ) );
+//         slambdas_per_channel[ccx]  = slambda;
+//         elambdas_per_channel[ccx]  = elambda;
       }
+DbgLv(1) << " sTi: slams_ch:" << slambdas_per_channel;
+DbgLv(1) << " sTi: elams_ch:" << elambdas_per_channel;
 
       // Get wavelengths for the currently selected cell/channel
       tripListx      = qMax( 0, qMin( trListSave, ( nchans - 1 ) ) );
@@ -6439,23 +6450,27 @@
 // User changed the Lambda Start value
 void US_ConvertGui::lambdaStartChanged( int value )
 {
+   int slambda_lambplot;
 DbgLv(1) << "lambdaStartChanged" << value;
 
    //ALEXEY: compare slambda to the cb_lambplot->index(0).value: if <, setCurrentIndex() to index corresponding to this upper value
-   tripListx          = lw_triple->currentRow();
-   int slambda_lambplot = slambdas_per_channel[tripListx];
-   
-   slambda       = cb_lambstrt->itemText( value ).toInt();
-   elambda       = cb_lambstop->currentText()    .toInt();
+   tripListx     = lw_triple->currentRow();
+   slambda       = cb_lambstrt->currentText().toInt();
+   elambda       = cb_lambstop->currentText().toInt();
+   tripListx     = lw_triple->currentRow();
+   if ( tripListx < slambdas_per_channel.size() )
+      slambda_lambplot  = slambdas_per_channel[ tripListx ];
+   else
+      slambda_lambplot  = slambda;
 
-   qDebug() << "LAMBDA_STR_CHANGE: slambda_lambplot, slambda: " << slambda_lambplot << ", " << slambda;
+DbgLv(1) << "lStChg: LAMBDA_STR_CHANGE: slambda_lambplot, slambda: " << slambda_lambplot << ", " << slambda;
 
    if ( slambda < slambda_lambplot )
    //if ( slambda < 280 )
-     {
+   {
        int index_lambstrt = cb_lambstrt->findText( QString::number(slambda_lambplot) );
 
-       qDebug() << "LAMBDA_STR_CHANGE: index_lambstrt " << index_lambstrt;
+DbgLv(1) << "lStChg: LAMBDA_STR_CHANGE: index_lambstrt " << index_lambstrt;
        slambda = slambda_lambplot;
 
        cb_lambstrt->disconnect();
@@ -6463,15 +6478,10 @@
        connect( cb_lambstrt,  SIGNAL( currentIndexChanged( int    ) ),
        		this,         SLOT  ( lambdaStartChanged ( int    ) ) );
     
-     }
-
-   //slambda       = cb_lambstrt->itemText( value ).toInt();
-   //elambda       = cb_lambstop->currentText()    .toInt();
-   //tripListx     = lw_triple->currentRow();
-   /***************************************************************************************************/
+   }
    
    int currChan  = out_chaninfo[ tripListx ].channelID;
-DbgLv(1) << "lambdaStartChanged" << value << "sl el tLx cCh"
+DbgLv(1) << "lStChg: lambdaStartChanged" << value << "sl el tLx cCh"
  << slambda << elambda << tripListx << currChan;
 
    for ( int trx = 0; trx < all_tripinfo.count(); trx++ )
@@ -6494,38 +6504,35 @@
 // User changed the Lambda End value
 void US_ConvertGui::lambdaEndChanged( int value )
 {
-DbgLv(1) << "lambdaEndChanged" << value;
+   int elambda_lambplot;
+DbgLv(1) << "lEnChg:  lambdaEndChanged" << value;
 
      //ALEXEY: compare slambda to the cb_lambplot->index(0).value: if <, setCurrentIndex() to index corresponding to this upper value
-   tripListx            = lw_triple->currentRow();
-   int elambda_lambplot = elambdas_per_channel[tripListx];
-   
-   elambda       = cb_lambstop->itemText( value ).toInt();
-   slambda       = cb_lambstrt->currentText()    .toInt();
+   slambda       = cb_lambstrt->currentText().toInt();
+   elambda       = cb_lambstop->currentText().toInt();
+   tripListx     = lw_triple->currentRow();
+DbgLv(1) << "lEnChg:  trLx" << tripListx << "elch size" << elambdas_per_channel.size();
+DbgLv(1) << "lEnChg:   elams_ch:" << elambdas_per_channel;
+   if ( tripListx < elambdas_per_channel.size() )
+      elambda_lambplot  = elambdas_per_channel[ tripListx ];
+   else
+      elambda_lambplot  = elambda;
 
-   qDebug() << "LAMBDA_STOP_CHANGE: elambda_lambplot, elambda: " << elambda_lambplot << ", " << elambda;
+DbgLv(1) << "lEnChg: LAMBDA_STOP_CHANGE: elambda_lambplot, elambda: " << elambda_lambplot << ", " << elambda;
 
    if ( elambda > elambda_lambplot )
-     {
-       int index_lambstop = cb_lambstop->findText( QString::number(elambda_lambplot) );
+   {
+       int index_lambstop = cb_lambstop->findText( QString::number( elambda_lambplot ) );
 
-       qDebug() << "LAMBDA_STOP_CHANGE: index_lambstrt " << index_lambstop;
+DbgLv(1) << "lEnChg: LAMBDA_STOP_CHANGE:  index_lambstop " << index_lambstop;
        elambda = elambda_lambplot;
 
        cb_lambstop->disconnect();
        cb_lambstop->setCurrentIndex( index_lambstop );
        connect( cb_lambstop,  SIGNAL( currentIndexChanged( int    ) ),
        		this,         SLOT  ( lambdaEndChanged ( int    ) ) );
-    
-     }
+   }
 
-   //slambda       = cb_lambstrt->itemText( value ).toInt();
-   //elambda       = cb_lambstop->currentText()    .toInt();
-   //tripListx     = lw_triple->currentRow();
-   /***************************************************************************************************/
- 
-
-
    int currChan  = out_chaninfo[ tripListx ].channelID;
 DbgLv(1) << "lEnChg:  val" << value << "sl el tLx cCh"
  << slambda << elambda << tripListx << currChan;
@@ -6609,32 +6616,26 @@
       int tripx1     = out_chandatx[ tripListx ];
       int tripx2     = out_chandatx[ tripnext  ];
       tripDatax      = tripx1 + cb_lambplot->currentIndex();
+DbgLv(1) << "TRIPLE_Index(): "
+ << "tripnext = " << tripnext
+ << ", tripx1 = " << tripx1
+ << ", tripx2 = " << tripx2
+ << ", tripDatax = tripx1 + cb_lambplot->currentIndex(): " << tripx1 << " + " << cb_lambplot->currentIndex();
 
-      qDebug() << "TRIPLE_Index(): "
-	       << "tripnext = " << tripnext
-	       << ", tripx1 = " << tripx1
-	       << ", tripx2 = " << tripx2
-	       << ", tripDatax = tripx1 + cb_lambplot->currentIndex(): " << tripx1 << " + " << cb_lambplot->currentIndex();
-
-
       //ALEXEY: the following part is buggy: commented out for now - seems to help with plotting/selecting triples for non-first channel for MWL case
       //Ask Gary (if this section in place, it causes incorrect placement of cb_lambplot indexes, so no plots generated...)
-      /*
+#if 0
       if ( tripDatax >= tripx2 )
       {  // Less wavelengths in this channel than in the previous one
          tripDatax      = ( tripx1 + tripx2 ) / 2;
          mwl_connect( false );
+DbgLv(1) << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex(); 
          cb_lambplot->setCurrentIndex( ( tripDatax - tripx1 ) );
-
-
-      	 qDebug() << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex(); 
       
          mwl_connect( true  );
       }
-      */
-      
-      qDebug() << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex(); 
-      
+#endif
+DbgLv(1) << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex(); 
    }
 
    else
@@ -6851,13 +6852,13 @@
    cb_lambstop->setCurrentIndex( nlamb_i - 1 );
    nlambda         = mwl_data.lambdas( exp_lambdas );
    cb_lambplot->clear();
+DbgLv(1) << "MwlSet: nlambda nlamb_i" << nlambda << nlamb_i;
 
    for ( int ii = 0; ii < nlambda; ii++ )
    {
       QString clamb = QString::number( exp_lambdas[ ii ] );
       cb_lambplot->addItem( clamb );
-
-      qDebug() << "MWL_SETUP: exp_lambda " << ii << ", " << clamb;
+DbgLv(1) << "MwlSet: exp_lambda " << ii << ", " << clamb;
    }
 
    cb_lambplot->setCurrentIndex( nlambda / 2 );
@@ -6875,16 +6876,19 @@
 
    
    for ( int ccx = 0; ccx < nchans_int; ccx++ )
-     {  
-       int nlambda_per_channel        = mwl_data.lambdas( exp_lambdas, ccx );
-       if ( nlambda_per_channel  < 1 )
-         {
-	   break;
-         }
-       slambdas_per_channel[ccx]    = exp_lambdas[ 0 ];
-       elambdas_per_channel[ccx]    = exp_lambdas[ nlambda_per_channel - 1 ];
-     }
+   {
+      int nlambda_per_channel    = mwl_data.lambdas( exp_lambdas, ccx );
+DbgLv(1) << "MwlSet:   ccx" << ccx << "nlam/ch" << nlambda_per_channel;
+      if ( nlambda_per_channel  < 1 )
+      {
+         break;
+      }
+      slambdas_per_channel[ccx]  = exp_lambdas[ 0 ];
+      elambdas_per_channel[ccx]  = exp_lambdas[ nlambda_per_channel - 1 ];
+   }
    /****************************************************************************************************/
+DbgLv(1) << "MwlSet: slams_ch:" << slambdas_per_channel;
+DbgLv(1) << "MwlSet: elams_ch:" << elambdas_per_channel;
    
 
    show_mwl_control( true );
@@ -7123,7 +7127,11 @@
    {
       US_Convert::TripleInfo* tripinfo = &all_tripinfo[ trx ];
 
-      if ( tripinfo->excluded )  continue;
+      if ( tripinfo->excluded )
+      {
+DbgLv(1) << "CGui: BOD:  trx" << trx << "EXCLUDED";
+         continue;
+      }
 
       outData      << &allData[ trx ];
 

Modified: trunk/programs/us_convert/us_convertio.cpp
===================================================================
--- trunk/programs/us_convert/us_convertio.cpp	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/programs/us_convert/us_convertio.cpp	2019-09-22 14:56:01 UTC (rev 2833)
@@ -378,6 +378,54 @@
    else if ( xmlStatus != US_Convert::OK )
       return( "Unspecified error writing xml file." );
 
+   // Download time state if need be
+   bool needTmst  = false;
+   int tmstID     = 0;
+   int expID      = ExpData.expID;
+   QString tfname = runID + ".time_state.tmst";
+   QString xdefs;
+   QString cksumd;
+   QDateTime datedt;
+   US_TimeState::dbExamine( db, &tmstID, &expID, &tfname,
+                            &xdefs, &cksumd, &datedt );
+qDebug() << "rDBE: expID tmstID tfname cksumd datedt"
+ << expID << tmstID << tfname << cksumd << datedt;
+   if ( tmstID > 0 )
+   {  // There is a time state in the database:  look at local disk
+      QString tfpath = dir + "/" + tfname;
+qDebug() << "rDBE:  HAVE tmst DB: tfpath" << tfpath;
+      if ( QFile( tfpath ).exists() )
+      {  // File exists, so check if it matches DB
+         QString cksumf   = US_Util::md5sum_file( tfpath );
+qDebug() << "rDBE:  HAVE tmst Loc: cksumf" << cksumf;
+         if ( cksumf != cksumd )
+         {  // DB/Local do not match, so overwrite local with download
+            needTmst       = true;
+         }
+      }
+      else
+      {  // No local tmst exists, do need to download it
+         needTmst       = true;
+      }
+
+qDebug() << "rDBE:  needTmst" << needTmst;
+      if ( needTmst )
+      {  // Download the .tmst file
+         US_TimeState::dbDownload( db, tmstID, tfpath );
+         // And write the xdefs sibling file
+         QString xfpath = QString( tfpath ).replace( ".tmst", ".xml" );
+qDebug() << "rDBE:   xfpath" << xfpath;
+         QFile fileo( xfpath );
+         if ( fileo.open( QIODevice::WriteOnly | QIODevice::Text ) )
+         {
+            QTextStream tso( &fileo );
+            tso << xdefs;
+            tso.flush();
+            fileo.close();
+qDebug() << "rDBE:    xdefs WRITTEN";
+         }
+      }
+   }
    return( QString( "" ) );
 }
 

Modified: trunk/programs/us_xpn_viewer/us_xpn_run_auc.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_run_auc.cpp	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/programs/us_xpn_viewer/us_xpn_run_auc.cpp	2019-09-22 14:56:01 UTC (rev 2833)
@@ -99,7 +99,10 @@
 
       if ( ! dfile.exists()  ||
            ! dfile.open( QIODevice::ReadOnly ) )
+      {
+qDebug() << "LdDk:    dfname -- NOT exists/opened" << dpath;
          continue;  // Skip if TMST def file does not exist or can't be opened
+      }
 qDebug() << "LdDk:    dfname -- exists/opened";
 
       QTextStream fsi( &dfile );
@@ -111,7 +114,10 @@
 
       if ( ! xmli.contains( pmatch )  &&
            ! xmli.contains( pmatch2 ) )
+      {
          continue;  // Skip if TMST def has no import_type="Optima"
+qDebug() << "LdDk:      *SKIP* non-Optima";
+      }
 
 
       // Add an eligible run directory to the list
@@ -120,8 +126,8 @@
       rr.runID       = runID;
       rr.date        = date;
       rr.ntriple     = nfiles;
-//qDebug() << "LdDk:   ii" << ii << "     runID date count"
-// << rr.runID << rr.date << rr.nfiles;
+qDebug() << "LdDk:   ii" << ii << "     runID date count"
+ << rr.runID << rr.date << rr.ntriple;
 
       runInfo << rr;
    }

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-09-22 14:56:01 UTC (rev 2833)
@@ -2343,14 +2343,14 @@
 //   US_XpnRunRaw* lddiag = new US_XpnRunRaw( drDesc, runInfo );
 //    if ( lddiag->exec() == QDialog::Rejected )                    //ALEXEY need drDesc but do NOT need dialog
 //    {
-// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog: CANCEL";
+// DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog: CANCEL";
 //       return;
 //    }
 
 //    // Restore area beneath dialog
 //    qApp->processEvents();
-// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog";
-// DbgLv(1) << "RDr:   drDesc" << drDesc;
+// DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog";
+// DbgLv(1) << "RDa:   drDesc" << drDesc;
 
    // See if we need to fix the runID
 
@@ -2411,16 +2411,16 @@
    scanmask          += QString( sMasks ).mid( 2, 1 ) == "1" ? 2 : 0;
    scanmask          += QString( sMasks ).mid( 4, 1 ) == "1" ? 4 : 0;
    scanmask          += QString( sMasks ).mid( 6, 1 ) == "1" ? 8 : 0;
-DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
+DbgLv(1) << "RDa:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
 
- qDebug() << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
-
  //ALEXEY: maybe put in_reload_check_sysdata = true; and then false (after xpn_data->import_data( iRunId, scanmask ); )
  //in_reload_check_sysdata = true; //ALEXEY
- xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
+
+   xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
+
    int ntsrows        = xpn_data->countOf( "scan_rows" );
-DbgLv(1) << "RDr:     ntsrows" << ntsrows;
-DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
+DbgLv(1) << "RDa:     ntsrows" << ntsrows;
+DbgLv(1) << "RDa:      knt(triple)   " << xpn_data->countOf( "triple"    );
  qApp->processEvents();
 
    if ( ntsrows < 1 )
@@ -2474,65 +2474,80 @@
       drtype2            = ( runType2 == "RI" ) ? "Absorbance"   : drtype2;
       drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
       drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
-      opsys << drtype1 << drtype2;
-
       QString msg        = tr( "Multiple scan data types are present:\n" )
                            +   "'" + drtype1 + "'\n or \n"
-                           +   "'" + drtype2 + "' .\n\n"
-                           + tr( "Choose one for initial display." );
-      QMessageBox mbox;
-      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
-      mbox.setText( msg );
-      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
-      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
-      mbox.setEscapeButton ( pb_opt2 );
-      mbox.setDefaultButton( pb_opt1 );
+                           +   "'" + drtype2 + "' .\n";
+DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
+ << xpn_data->countOf( "iscn_rows" )
+ << xpn_data->countOf( "fscn_rows" )
+ << xpn_data->countOf( "wscn_rows" );
+      if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
+           ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
+           ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
+      {
+         msg               += tr( "\nScans are missing so only " ) + drtype1
+                              + tr( " scans are processed." );
+         QMessageBox::warning( this,
+               tr( "Multiple Types with Missing Scans" ),
+               msg );
+      }
 
-      mbox.exec();
-      if ( mbox.clickedButton() == pb_opt2 )
+      else
       {
-         runType            = runType2;
-         optndx             = 1;
+         opsys << drtype1 << drtype2;
+         msg               += tr( "\nChoose one for initial display." );
+         QMessageBox mbox;
+         mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
+         mbox.setText( msg );
+         QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
+         QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
+         mbox.setEscapeButton ( pb_opt2 );
+         mbox.setDefaultButton( pb_opt1 );
+
+         mbox.exec();
+         if ( mbox.clickedButton() == pb_opt2 )
+         {
+            runType            = runType2;
+            optndx             = 1;
+DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
+ << xpn_data->countOf( "iscn_rows" )
+ << xpn_data->countOf( "fscn_rows" )
+ << xpn_data->countOf( "wscn_rows" );
+         }
       }
    }
 
    qApp->processEvents();  //ALEXEY: maybe this will help
-   
-   qDebug() << "1. Crashes HERE!!!!";
+DbgLv(1) << "RDa: 1. Crashes HERE!!!!";
      
    cb_optsys->disconnect();
    cb_optsys->clear();
-
-   qDebug() << "1a. Crashes HERE!!!!";
+DbgLv(1) << "RDa: 1a. Crashes HERE!!!!";
    
    cb_optsys->addItems( opsys );                                  // ALEXEY fill out Optics listbox
-
-   qDebug() << "1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
+DbgLv(1) << "RDa: 1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
    cb_optsys->setCurrentIndex( optndx );
-   qDebug() << "1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
+DbgLv(1) << "RDa: 1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
    
    connect( cb_optsys,    SIGNAL( currentIndexChanged( int ) ),
             this,         SLOT  ( changeOptics( )            ) );
-
-   qDebug() << "1b. Crashes HERE!!!!";
+DbgLv(1) << "RDa: 1b. Crashes HERE!!!!";
    
    runID         = new_runID;
-DbgLv(1) << "RDr:  runID" << runID << "runType" << runType;
+DbgLv(1) << "RDa:  runID" << runID << "runType" << runType;
    xpn_data->set_run_values( runID, runType );                    // ALEXEY
+DbgLv(1) << "RDa: 2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
 
-   qDebug() << "2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
-
    // Build the AUC equivalent
    //QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
    le_status->setText( tr( "Building AUC data ..." ) );
    qApp->processEvents();
 
    xpn_data->build_rawData( allData );                            // ALEXEY Builds Raw Data
-
-   qDebug() << "3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
+DbgLv(1) << "RDa: 3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
    
 double tm2=(double)sttime.msecsTo(QDateTime::currentDateTime())/1000.0;
-DbgLv(1) << "RDr:      build-raw done: tm1 tm2" << tm1 << tm2;
+DbgLv(1) << "RDa:      build-raw done: tm1 tm2" << tm1 << tm2;
 
    QApplication::restoreOverrideCursor();
    QApplication::restoreOverrideCursor();
@@ -2544,10 +2559,10 @@
    nscan         = allData[ 0 ].scanCount();
    npoint        = allData[ 0 ].pointCount();
 
-DbgLv(1) << "RDr: mwr ntriple" << ntriple;
-DbgLv(1) << "RDr: ncellch" << ncellch << cellchans.count();
-DbgLv(1) << "RDr: nscan" << nscan << "npoint" << npoint;
-DbgLv(1) << "RDr:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
+DbgLv(1) << "RDa: mwr ntriple" << ntriple;
+DbgLv(1) << "RDa: ncellch" << ncellch << cellchans.count();
+DbgLv(1) << "RDa: nscan" << nscan << "npoint" << npoint;
+DbgLv(1) << "RDa:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
    cb_cellchn->disconnect();                                      
    cb_cellchn->clear();
    cb_cellchn->addItems( cellchans );                             // ALEXEY fill out Cells/Channels listbox
@@ -2560,7 +2575,7 @@
 #if 0
    ntriple      = nlambda * ncellch;  // Number triples
    ntpoint      = npoint  * nscan;    // Number radius points per triple
-DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple;
    triples.clear();
 
@@ -2574,18 +2589,18 @@
 #endif
 #if 1
    ntriple      = xpn_data->data_triples( triples );              // ALEXEY triples
-DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    << triples.count();
 
- qDebug() << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+ qDebug() << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    << triples.count();
 #endif
 
-DbgLv(1) << "RDr: allData size" << allData.size();
+DbgLv(1) << "RDa: allData size" << allData.size();
 
- qDebug() << "RDr: allData size" << allData.size();
+ qDebug() << "RDa: allData size" << allData.size();
 
  //QApplication::restoreOverrideCursor();
    QString tspath = currentDir + "/" + runID + ".time_state.tmst";
@@ -2749,12 +2764,12 @@
    scanmask          += QString( sMasks ).mid( 6, 1 ) == "1" ? 8 : 0;
 DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
 
- xpn_data->import_data( iRunId, scanmask );                             
+   xpn_data->import_data( iRunId, scanmask );                             
+
    int ntsrows        = xpn_data->countOf( "scan_rows" );
 DbgLv(1) << "RDr:     ntsrows" << ntsrows;
 DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
 
-
    if ( ntsrows < 1 )
    {
       le_status->setText( tr( "Run %1 has no associated data..." )
@@ -2773,7 +2788,7 @@
 
    if ( scanmask == 1  ||  scanmask == 2  ||
         scanmask == 4  ||  scanmask == 8 )
-   {
+   {  // Single type of data present
       runType            = ( scanmask == 2 ) ? "FI" : runType;
       runType            = ( scanmask == 4 ) ? "IP" : runType;
       runType            = ( scanmask == 8 ) ? "WI" : runType;
@@ -2788,7 +2803,7 @@
    }
 
    else if ( ( scanmask & 1 ) != 0 )
-   {
+   {  // Multiple data types present
       QApplication::restoreOverrideCursor();
       QApplication::restoreOverrideCursor();
       QString runType2( "IP" );
@@ -2802,25 +2817,46 @@
       drtype2            = ( runType2 == "RI" ) ? "Absorbance"   : drtype2;
       drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
       drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
-      opsys << drtype1 << drtype2;
-
       QString msg        = tr( "Multiple scan data types are present:\n" )
                            +   "'" + drtype1 + "'\n or \n"
-                           +   "'" + drtype2 + "' .\n\n"
-                           + tr( "Choose one for initial display." );
-      QMessageBox mbox;
-      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
-      mbox.setText( msg );
-      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
-      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
-      mbox.setEscapeButton ( pb_opt2 );
-      mbox.setDefaultButton( pb_opt1 );
+                           +   "'" + drtype2 + "' .\n";
+DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
+ << xpn_data->countOf( "iscn_rows" )
+ << xpn_data->countOf( "fscn_rows" )
+ << xpn_data->countOf( "wscn_rows" );
+      if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
+           ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
+           ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
+      {
+         msg               += tr( "\nScans are missing so only " ) + drtype1
+                              + tr( " scans are processed." );
+         QMessageBox::warning( this,
+               tr( "Multiple Types with Missing Scans" ),
+               msg );
+      }
 
-      mbox.exec();
-      if ( mbox.clickedButton() == pb_opt2 )
+      else
       {
-         runType            = runType2;
-         optndx             = 1;
+         opsys << drtype1 << drtype2;
+         msg               += tr( "\nChoose one for initial display." );
+         QMessageBox mbox;
+         mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
+         mbox.setText( msg );
+         QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
+         QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
+         mbox.setEscapeButton ( pb_opt2 );
+         mbox.setDefaultButton( pb_opt1 );
+
+         mbox.exec();
+         if ( mbox.clickedButton() == pb_opt2 )
+         {
+            runType            = runType2;
+            optndx             = 1;
+DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
+ << xpn_data->countOf( "iscn_rows" )
+ << xpn_data->countOf( "fscn_rows" )
+ << xpn_data->countOf( "wscn_rows" );
+         }
       }
    }
 

Modified: trunk/utils/us_xpn_data.cpp
===================================================================
--- trunk/utils/us_xpn_data.cpp	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/utils/us_xpn_data.cpp	2019-09-22 14:56:01 UTC (rev 2833)
@@ -553,10 +553,10 @@
    bool iscnf    = scanMask & 4;
    bool wscnf    = scanMask & 8;
 
-   int arows     = 0;
-   int frows     = 0;
-   int irows     = 0;
-   int wrows     = 0;
+   arows         = 0;
+   frows         = 0;
+   irows         = 0;
+   wrows         = 0;
 
    // Scan and build data for System Status Data
    int srows     = scan_xpndata( runId, 'S' );
@@ -2306,6 +2306,10 @@
    counts[ "elambda"   ]  = elambda;
    counts[ "scan_all"  ]  = ntscan;
    counts[ "scan_rows" ]  = ntsrow;
+   counts[ "ascn_rows" ]  = arows;
+   counts[ "fscn_rows" ]  = frows;
+   counts[ "iscn_rows" ]  = irows;
+   counts[ "wscn_rows" ]  = wrows;
 
    counts[ "last_rpm"  ]  = qRound( isyrec.speed );
    counts[ "etim_off"  ]  = etimoff;

Modified: trunk/utils/us_xpn_data.h
===================================================================
--- trunk/utils/us_xpn_data.h	2019-09-20 02:22:20 UTC (rev 2832)
+++ trunk/utils/us_xpn_data.h	2019-09-22 14:56:01 UTC (rev 2833)
@@ -434,6 +434,10 @@
       int       mxscnn;              //!< Maximum scan number
       int       ntscan;              //!< Total scans for all triples
       int       ntsrow;              //!< Total (A+F+I+W) scan rows
+      int       arows;               //!< A scan rows
+      int       frows;               //!< F scan rows
+      int       irows;               //!< I scan rows
+      int       wrows;               //!< W scan rows
       
       int       etimoff;             //!< Experimental time offset
       int       fnzstx;              //!< First non-zero-speed time index



More information about the us-commits mailing list