[us-commits] r2761 - in trunk/programs: us_com_project us_convert us_xpn_viewer

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Sat May 11 00:54:33 MDT 2019


Author: alexey
Date: 2019-05-11 06:54:32 +0000 (Sat, 11 May 2019)
New Revision: 2761

Modified:
   trunk/programs/us_com_project/us_com_project_gui.cpp
   trunk/programs/us_convert/us_convert_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
Updates on autoflow:
	* some bug fixed
	* when troples/entire channels are dropped at stage 3, solutions and other passed protocol details are properly updated and Saving to DB proceeds without errors...



Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp	2019-05-10 12:26:51 UTC (rev 2760)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp	2019-05-11 06:54:32 UTC (rev 2761)
@@ -355,9 +355,29 @@
   // QString ProtName                     = protocol_details[ "protocolName" ];
   // QString invID_passed                 = protocol_details[ "invID_passed" ];
 
+
+  // // --------------------------------------------------------------------------------------------
+  
+  // // Amy's exp. Optima 2 !!!
+  // QMap < QString, QString > protocol_details;
+  // protocol_details["experimentId"] = QString("299");   
+  // protocol_details["protocolName"] = QString("data-aquisition-test29");
+  // protocol_details[ "experimentName" ] = QString("some_name");
+  // protocol_details[ "CellChNumber" ] = QString("8");
+  // protocol_details[ "TripleNumber" ] = QString("12");
+  // protocol_details[ "OptimaName" ] = QString("Optima 2");     // <-- Optima 2
+  // protocol_details[ "duration" ]   = QString("300");
+  // protocol_details[ "dataPath" ]   = QString("/home/alexey/ultrascan/imports/data-aquisition-test29-run364");
+  // protocol_details[ "invID_passed" ]  = QString("6");  //Amy's ID
+  
+  // QString stage                        = "LIVE_UPDATE";
+  // QString currDir                      = protocol_details[ "dataPath" ];
+  // QString ProtName                     = protocol_details[ "protocolName" ];
+  // QString invID_passed                 = protocol_details[ "invID_passed" ];
+
   // --------------------------------------------------------------------------------------------
- 
   
+  
   // Query 'autoflow': get count of records
   int autoflow_records = get_autoflow_records();
 
@@ -411,7 +431,7 @@
   QString ProtName     = protocol_details[ "protocolName" ];
   
   
-
+  
   //ALEXEY: if stage=="EDITING" && curDir.isEmpty() (NULL)
   /*
         -- that means that Run Completed but Directory was created on different computer

Modified: trunk/programs/us_convert/us_convert_gui.cpp
===================================================================
--- trunk/programs/us_convert/us_convert_gui.cpp	2019-05-10 12:26:51 UTC (rev 2760)
+++ trunk/programs/us_convert/us_convert_gui.cpp	2019-05-11 06:54:32 UTC (rev 2761)
@@ -485,12 +485,20 @@
    // QString curdir = "/home/alexey/ultrascan/imports/KentonR_coprohenQ-comproject-013119-run221"; // Kenton
    // QString protname = "KentonR_coprohenQ-comproject-013119";
 
-   // QString curdir = "/home/alexey/ultrascan/imports/test-comproject-2wavelength-2cell-2-run227"; // Amy
-   //  QString protname = "test-comproject-2wavelength-2cell-2";
+   // QString curdir = "/home/alexey/ultrascan/imports/RxRPPARhet-PPRE-MWL_180419-run352"; //Nemetchek
+   // QString protname = "RxRPPARhet-PPRE-MWL_180419";
+   // QString invid = "41";
 
-   // import_data_auto(curdir, protname);
+   // QString curdir = "/home/alexey/ultrascan/imports/data-aquisition-test29-run364"; //Amy's
+   // QString protname = "data-aquisition-test29";
+   // QString invid = "6"; //Amy ID
 
+   
+   // import_data_auto(curdir, protname, invid);
 
+   
+   
+
    // qDebug() << "ExpData: ";
 
    // qDebug() << "ExpData.invID " << ExpData.invID;             
@@ -1518,6 +1526,10 @@
    runType       = QString( fname ).section( ".", -5, -5 );
    runID         = QString( fname ).section( ".",  0, -6 );
 
+
+   // //TEMP
+   // runID += QString("-test");
+     
    qDebug() << "RUNID from files[0]: files[0]" << fname << ", runID: " << runID;  
      
    le_runID2->setText( runID );
@@ -1576,7 +1588,9 @@
       tmst_fnamei.clear();
    }
 
-   le_status->setText( tr( "AUC data import IS COMPLETE." ) );
+   if (!us_convert_auto_mode)
+     le_status->setText( tr( "AUC data import IS COMPLETE." ) );
+
    pb_showTmst->setEnabled( ! tmst_fnamei.isEmpty() );
 }
 
@@ -2372,6 +2386,9 @@
 	   out_chaninfo[ i ].solution = solution_auto;
 	   out_tripinfo[ out_chandatx[ i ] + cb_lambplot->currentIndex() ].solution = solution_auto;
 
+	   //DUPL
+	   all_tripinfo[ i ].solution = solution_auto;  
+	   //all_tripinfo[ out_chandatx[ i ] + cb_lambplot->currentIndex() ].solution = solution_auto;
 
 	   //Centerpiece
 	   // if ( i < nchans-1 && i%2 == 0 ) //every second channel, or other # ?
@@ -2399,14 +2416,21 @@
 	   //ALEXEY abstractCenterpieceIDs inferred from cent. name passed from protocol
 	   out_chaninfo[ i ]   .centerpiece     = cpID;
 	   out_chaninfo[ i ]   .centerpieceName = cpName;
+
+	   //DUPL
+	   all_tripinfo[ i ] .centerpiece     = cpID;
+	   all_tripinfo[ i ] .centerpieceName = cpName;
 	   	   
 	   // For MWL, duplicate solution & centerpices to all triples of the channel
 	   int idax   = out_chandatx[ i ];
 	   int ldax   = i + 1;
+	   
 	   ldax       = ldax < out_chandatx.size()
 			       ? out_chandatx[ ldax ]
 			       : out_tripinfo.size();
-	       
+
+	   int diff_ldax_idax = ldax - idax;
+	   
 	   while ( idax < ldax )
 	     {
 	       int jj = idax++;
@@ -2417,22 +2441,39 @@
 	       //Centerpiece
 	       out_tripinfo[ jj ].centerpiece = cpID;  //ALEXEY abstractCenterpieceIDs passed from protocol
 	       //qDebug() << "Centerpiece: " << i << ", " << jj << ", " << out_tripinfo[ jj ].centerpiece;
+
+	       //Centerpiece Name
+	       out_tripinfo[ jj ].centerpieceName = cpName;
+
+	       //DUPL
+	       all_tripinfo[ jj ].solution        = solution_auto;
+	       all_tripinfo[ jj ].centerpiece     = cpID;
+	       all_tripinfo[ jj ].centerpieceName = cpName;
 	     }
 
 	   // Description
 	   triple_desc = ProtInfo.ProtSolutions.chsols[ i ].ch_comment;  //channel's comment from protocol
-	   outData[ out_chandatx[ i ] + cb_lambplot->currentIndex() ]->description = triple_desc;
+	   outData[ out_chandatx[ i ] + cb_lambplot->currentIndex() ]->description = triple_desc;  // ALEXEY : REplicate for all triple in the same channel
 	   //Propagate description to all triples of channel
 	   out_chaninfo[ i ].description   = triple_desc;
-	   int trxs        = out_chandatx[ i ];
-	   int trxe        = trxs + nlambda;
 
-	   qDebug() << "Channel " << i << ": ldax, trxe: " << ldax << ", " << trxe;
+	   //DUPL
+	   allData[ out_chandatx[ i ] + cb_lambplot->currentIndex() ].description = triple_desc;
+	   all_tripinfo[ i ].description   = triple_desc;
 	   
+	   int trxs        = out_chandatx[ i ];
+	   //int trxe        = trxs + nlambda;   //ALEXEY: here was a problem!!
+	   int trxe        = trxs + diff_ldax_idax;
+	   
+	   qDebug() << "Channel " << i << ": diff_ldax_idax, trxs, trxe: " << diff_ldax_idax << ", " << trxs << ", "  << trxe;
+	   
 	   for ( int trx = trxs; trx < trxe; trx++ )
 	     {
 	       outData[ trx ]->description = triple_desc;
-	       //qDebug() << "Triple Description: " << trx << ", " << triple_desc;
+	       qDebug() << "Triple Description for channel #: " << i << ", " << trx << ", " << triple_desc;
+
+	       //DUPL
+	       allData[ trx ].description = triple_desc;
 	     }
 	 }
      }
@@ -2441,6 +2482,7 @@
        qDebug() << "SOLUTION is READ in NON MWL mode !!! ntrips: " << ntrips;
        qDebug() << "SIZE of out_chaninfo.size(): " << out_chaninfo.size() ;
        qDebug() << "SIZE of out_tripinfo.size(): " << out_tripinfo.size() ;
+       qDebug() << "nchans, ntrips: " << nchans << ", " << ntrips;
 
        if (ntrips ==  nchans)
 	 {
@@ -2451,10 +2493,16 @@
 	       solution_auto.readFromDB(solutionID, &db);
 	       out_chaninfo[ i ].solution = solution_auto;
 	       out_tripinfo[ i ].solution = solution_auto;
+
+	       //DUPL
+	       all_tripinfo[ i ].solution = solution_auto;  
 	       
 	       //Description
 	       triple_desc = ProtInfo.ProtSolutions.chsols[ i ].ch_comment;  //channel's comment from protocol
 	       outData[ i ]->description = triple_desc;
+
+	       //DUPL
+	       allData[ i ].description = triple_desc;
 	       
 	       //Centerpiece
 	       // if ( i < ntrips-1 && i%2 == 0 ) //every second channel
@@ -2481,7 +2529,11 @@
 	       
 	       out_chaninfo[ i ].centerpiece     = cpID;    //ALEXEY abstractCenterpieceIDs passed from protocol
 	       out_tripinfo[ i ].centerpiece     = cpID;    //ALEXEY abstractCenterpieceIDs passed from protocol
-	       out_chaninfo[ i ].centerpieceName = cpName; 
+	       out_chaninfo[ i ].centerpieceName = cpName;
+
+	       //DUPL
+	       all_tripinfo[ i ].centerpiece     = cpID;
+	       all_tripinfo[ i ].centerpieceName = cpName;
 	     }
 	 }
        else
@@ -2521,7 +2573,11 @@
 		       
 		       out_chaninfo[ j ].centerpiece     = cpID;   
 		       out_tripinfo[ j ].centerpiece     = cpID;   
-		       out_chaninfo[ j ].centerpieceName = cpName; 
+		       out_chaninfo[ j ].centerpieceName = cpName;
+
+		       //DUPL
+		       all_tripinfo[ j ].centerpiece     = cpID;
+		       all_tripinfo[ j ].centerpieceName = cpName;
 		     }
 		   
 		   if ( out_triples[ j ].section( "/", 0, 1 ).simplified() == out_channels[ i ] )
@@ -2530,6 +2586,12 @@
 		       out_chaninfo[ j ].solution = solution_auto;
 		       out_tripinfo[ j ].solution = solution_auto;
 		       outData[ j ]->description = triple_desc;
+
+		       //DUPL
+		       all_tripinfo[ j ].solution = solution_auto;
+		       allData[ j ].description = triple_desc;
+
+		       
 		     }
 		 }
 	     }
@@ -2547,6 +2609,8 @@
    //le_centerpieceDesc ->setText( QString::number(out_chaninfo[ tripListx ].centerpiece) );
    le_centerpieceDesc ->setText( out_chaninfo[ tripListx ].centerpieceName );
 
+   le_status->setText( tr( "AUC data import IS COMPLETE." ) );
+   
    enableSaveBtn_auto();
 }
 
@@ -3511,18 +3575,23 @@
                     .section( "/", 1, 1 ).simplified();
    pb_dropChan    ->setText( tr( "Drop All Channel '%1's" ).arg( chann ) );
 
+   for ( int i=0; i <  outData.size(); ++i)
+     qDebug() << "i, outData[ i ]->description" << i << ", " << outData[ i ]->description;
+   
    triple_index( );
 DbgLv(1) << "chgTrp: trDx trLx" << tripDatax << tripListx
  << "outDsz chinfsz" << outData.size() << out_chaninfo.size();
 
    le_dir         ->setText( currentDir );
-   le_description ->setText( outData[ tripDatax ]->description );
-   le_solutionDesc->setText( out_chaninfo[ tripListx ].solution.solutionDesc );
 
-   le_centerpieceDesc ->setText( out_chaninfo[ tripListx ].centerpieceName );
-   qDebug() << "Cent. INFO : " << out_chaninfo[ tripListx ].centerpieceName ;
-   
+   // le_description ->setText( outData[ tripDatax ]->description );
+   // le_solutionDesc->setText( out_chaninfo[ tripListx ].solution.solutionDesc );
+   // le_centerpieceDesc ->setText( out_chaninfo[ tripListx ].centerpieceName );
 
+   // qDebug() << "DESCRIPTION      : tripDatax,  outData[ tripDatax ]->description:: " << tripDatax << ", " << outData[ tripDatax ]->description;
+   // qDebug() << "CENTERPIECE INFO : tripListx,  out_chaninfo[ tripListx ].centerpieceName:: " << tripListx << ", " << out_chaninfo[ tripListx ].centerpieceName;
+   // qDebug() << "SOLUTION         : tripListx,  out_chaninfo[ tripListx ].solution.solutionDesc:: " << tripListx << ", " << out_chaninfo[ tripListx ].solution.solutionDesc;
+
    // If MWL, set the cell/channel index and get the lambda range
    if ( isMwl )
    {
@@ -3537,6 +3606,15 @@
    // Reset maximum scan control values
    enableScanControls();
 
+   le_description ->setText( outData[ tripDatax ]->description );
+   le_solutionDesc->setText( out_chaninfo[ tripListx ].solution.solutionDesc );
+   le_centerpieceDesc ->setText( out_chaninfo[ tripListx ].centerpieceName );
+
+   qDebug() << "DESCRIPTION      : tripDatax,  outData[ tripDatax ]->description:: " << tripDatax << ", " << outData[ tripDatax ]->description;
+   qDebug() << "CENTERPIECE INFO : tripListx,  out_chaninfo[ tripListx ].centerpieceName:: " << tripListx << ", " << out_chaninfo[ tripListx ].centerpieceName;
+   qDebug() << "SOLUTION         : tripListx,  out_chaninfo[ tripListx ].solution.solutionDesc:: " << tripListx << ", " << out_chaninfo[ tripListx ].solution.solutionDesc;
+   
+   
    // The centerpiece combo box
    cb_centerpiece->setLogicalIndex( out_chaninfo[ tripListx ].centerpiece );
 
@@ -5950,6 +6028,13 @@
                   : tripListx;
 DbgLv(1) << " triple_index  trLx trDx" << tripListx << tripDatax
  << "  triple" << lw_triple->currentItem()->text();
+
+ if (isMwl) 
+   qDebug() << "CHANGING TRIPLE: out_chandatx[ tripListx ] + cb_lambplot->currentIndex(): " << out_chandatx[ tripListx ] << " + " <<  cb_lambplot->currentIndex();
+ else
+   qDebug() << "CHANGING TRIPLE: tripDatax, tripListx : " << tripDatax << ", " << tripListx;
+
+ qDebug() << "Size of out_chandatx: " << out_chandatx.size();
 }
 
 // Turn MWL connections on or off

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-05-10 12:26:51 UTC (rev 2760)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-05-11 06:54:32 UTC (rev 2761)
@@ -1524,14 +1524,16 @@
 
       // OR
       //Alternativly: put it in separate thread:
-      QThread* sys_thread = new QThread(this);
+      //QThread* sys_thread = new QThread(this);
+      sys_thread = new QThread(this);
       timer_check_sysdata = new QTimer(0); // parent to 0 !
       timer_check_sysdata->setInterval(2000);
       timer_check_sysdata->moveToThread(sys_thread);
       //connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( )  ), Qt::QueuedConnection ) ; //Qt::DirectConnection );
       connect( timer_check_sysdata, SIGNAL(timeout()), this, SLOT( check_for_sysdata( )  ) );//, Qt::QueuedConnection );
       //QThread's started() SIGNAL: before the run()/exec() function is called!!! Is this a potential issue, timer is started from a thread???
-      connect( sys_thread, SIGNAL( started() ), timer_check_sysdata, SLOT( start() ));      
+      connect( sys_thread, SIGNAL( started() ), timer_check_sysdata, SLOT( start() ));
+      connect( sys_thread, SIGNAL( finished() ), timer_check_sysdata, SLOT( stop() ));
       sys_thread->start();
       // How to stop sys_thread?
       
@@ -1798,13 +1800,17 @@
    
   if ( exp_status == 5 )
     {
-      timer_check_sysdata->stop();
+      //timer_check_sysdata->stop();
       //ALEXEY: This timer cannot be stopped from another thread, but can be dealt with signal/slot upon Qthread termination..
       //        disconnection maybe enough...
       disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+      sys_thread->quit(); // ALEXEY: does this emit Qthread's finished() signal??
       
       qDebug() << "ExpStat: 5  - sys_timer STOPPED here: ";
-      
+
+      if ( !timer_check_sysdata->isActive() )
+	 qDebug() << "QTimer timer_check_sysdata STOPPED by quitting the QThread !!! ";
+	
       rpm_box->setSpeed( 0 );
       le_remaining->setText( "00:00:00" );
       qApp->processEvents();
@@ -1833,9 +1839,9 @@
   
   if ( exp_status == 0 ) //ALEXEY should be == 3 as per documentation
     {
-      timer_check_sysdata->stop();
+      //timer_check_sysdata->stop();
       disconnect(timer_check_sysdata, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
-      
+      sys_thread->quit(); // ALEXEY: does this emit Qthread's finished() signal??
       qDebug() << "ExpStat: 3  - sys_timer STOPPED here: ";
       
       rpm_box->setSpeed( 0 );

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-05-10 12:26:51 UTC (rev 2760)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-05-11 06:54:32 UTC (rev 2761)
@@ -268,7 +268,7 @@
      QElapsedTimer*  elapsed_timer;
      
      QTimer*        timer_sys_thread;
-     //QThread*       sys_thread;
+     QThread*       sys_thread;
      
      QMessageBox*   msg_data_avail;
      QString        RunID_to_retrieve;



More information about the us-commits mailing list