Changeset 2828


Ignore:
Timestamp:
Aug 30, 2019 3:20:14 AM (2 months ago)
Author:
alexey
Message:

us_convert: a bug fixed for MWL data while setting lambda_start/end and lambda_plot...

Location:
trunk/programs/us_convert
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/programs/us_convert/us_convert_gui.cpp

    r2798 r2828  
    40154015      {  // A change in lambda range requires a general reset
    40164016         setTripleInfo();
     4017
     4018   qDebug() << "Calling setTripleInfo()";
    40174019      }
    40184020   }
     
    40804082         cb_lambplot->setCurrentIndex( nlambda / 2 );
    40814083
    4082         show_mwl_control( true );
     4084  show_mwl_control( true );
    40834085         mwl_connect( true );
    40844086      }
     
    41144116      cb_lambplot->clear();
    41154117
     4118      // //ALEXEY: also clear cb_lambstrt && cb_lambstop
     4119      // cb_lambstrt->clear();
     4120      // cb_lambstop->clear();
     4121
    41164122      for ( int wvx = 0; wvx < nlambda; wvx++ )
    41174123      {  // Rebuild the plot lambda list
     4124 
    41184125         int ilamb      = exp_lambdas[ wvx ];
    41194126         cb_lambplot->addItem( QString::number( ilamb ) );
    41204127
     4128   // //ALEXEY: Also regenerate cb_lambstrt && cb_lambstop - for selected channel:
     4129   // cb_lambstrt->addItem( QString::number( ilamb ) );
     4130   // cb_lambstop->addItem( QString::number( ilamb ) );
     4131
     4132   
    41214133         if ( ilamb == plambda )  pltx = wvx;
     4134
     4135   qDebug() << "Lambda MWL " << wvx << ": " << exp_lambdas[ wvx ] << "; INDEX: " << pltx;
    41224136      }
    41234137
    41244138      // Re-do selections for lambda start,stop,plot
     4139
     4140      //ALEXEY: set lambstart/stop based on selected channel, not all wavelengths
     4141      // cb_lambstrt->setCurrentIndex( 0 );
     4142      // cb_lambstop->setCurrentIndex( nlambda - 1 );
    41254143      cb_lambstrt->setCurrentIndex( all_lambdas.indexOf( slambda ) );
    41264144      cb_lambstop->setCurrentIndex( all_lambdas.indexOf( elambda ) );
     4145
     4146     
     4147     
     4148     
    41274149      cb_lambplot->setCurrentIndex( pltx );
    41284150      mwl_connect( true );
     4151
     4152      qDebug() << "Inside setTripleInfo(); cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex();
    41294153   }
    41304154
     
    64176441{
    64186442DbgLv(1) << "lambdaStartChanged" << value;
     6443
     6444   //ALEXEY: compare slambda to the cb_lambplot->index(0).value: if <, setCurrentIndex() to index corresponding to this upper value
     6445   tripListx          = lw_triple->currentRow();
     6446   int slambda_lambplot = slambdas_per_channel[tripListx];
     6447   
    64196448   slambda       = cb_lambstrt->itemText( value ).toInt();
    64206449   elambda       = cb_lambstop->currentText()    .toInt();
    6421    tripListx     = lw_triple->currentRow();
     6450
     6451   qDebug() << "LAMBDA_STR_CHANGE: slambda_lambplot, slambda: " << slambda_lambplot << ", " << slambda;
     6452
     6453   if ( slambda < slambda_lambplot )
     6454   //if ( slambda < 280 )
     6455     {
     6456       int index_lambstrt = cb_lambstrt->findText( QString::number(slambda_lambplot) );
     6457
     6458       qDebug() << "LAMBDA_STR_CHANGE: index_lambstrt " << index_lambstrt;
     6459       slambda = slambda_lambplot;
     6460
     6461       cb_lambstrt->disconnect();
     6462       cb_lambstrt->setCurrentIndex( index_lambstrt );
     6463       connect( cb_lambstrt,  SIGNAL( currentIndexChanged( int    ) ),
     6464          this,         SLOT  ( lambdaStartChanged ( int    ) ) );
     6465   
     6466     }
     6467
     6468   //slambda       = cb_lambstrt->itemText( value ).toInt();
     6469   //elambda       = cb_lambstop->currentText()    .toInt();
     6470   //tripListx     = lw_triple->currentRow();
     6471   /***************************************************************************************************/
     6472   
    64226473   int currChan  = out_chaninfo[ tripListx ].channelID;
    64236474DbgLv(1) << "lambdaStartChanged" << value << "sl el tLx cCh"
     
    64456496{
    64466497DbgLv(1) << "lambdaEndChanged" << value;
     6498
     6499     //ALEXEY: compare slambda to the cb_lambplot->index(0).value: if <, setCurrentIndex() to index corresponding to this upper value
     6500   tripListx            = lw_triple->currentRow();
     6501   int elambda_lambplot = elambdas_per_channel[tripListx];
     6502   
     6503   elambda       = cb_lambstop->itemText( value ).toInt();
    64476504   slambda       = cb_lambstrt->currentText()    .toInt();
    6448    elambda       = cb_lambstop->itemText( value ).toInt();
    6449    tripListx     = lw_triple->currentRow();
     6505
     6506   qDebug() << "LAMBDA_STOP_CHANGE: elambda_lambplot, elambda: " << elambda_lambplot << ", " << elambda;
     6507
     6508   if ( elambda > elambda_lambplot )
     6509     {
     6510       int index_lambstop = cb_lambstop->findText( QString::number(elambda_lambplot) );
     6511
     6512       qDebug() << "LAMBDA_STOP_CHANGE: index_lambstrt " << index_lambstop;
     6513       elambda = elambda_lambplot;
     6514
     6515       cb_lambstop->disconnect();
     6516       cb_lambstop->setCurrentIndex( index_lambstop );
     6517       connect( cb_lambstop,  SIGNAL( currentIndexChanged( int    ) ),
     6518          this,         SLOT  ( lambdaEndChanged ( int    ) ) );
     6519   
     6520     }
     6521
     6522   //slambda       = cb_lambstrt->itemText( value ).toInt();
     6523   //elambda       = cb_lambstop->currentText()    .toInt();
     6524   //tripListx     = lw_triple->currentRow();
     6525   /***************************************************************************************************/
     6526 
     6527
     6528
    64506529   int currChan  = out_chaninfo[ tripListx ].channelID;
    64516530DbgLv(1) << "lEnChg:  val" << value << "sl el tLx cCh"
     
    64906569   int wvxmax  = cb_lambplot->count() - 1;
    64916570   int wvx     = qMin( wvxmax, cb_lambplot->currentIndex() + 1 );
     6571
     6572
     6573   qDebug() << "LAMBDA_NEXT: wvxmax  = cb_lambplot->count() - 1: " <<  wvxmax
     6574      << ", cb_lambplot->currentIndex() + 1: " << cb_lambplot->currentIndex() + 1
     6575      << ", wvx     = qMin( wvxmax, cb_lambplot->currentIndex() + 1 ): " << wvx;
    64926576
    64936577   cb_lambplot->setCurrentIndex( wvx );
     
    65276611      tripDatax      = tripx1 + cb_lambplot->currentIndex();
    65286612
     6613      qDebug() << "TRIPLE_Index(): "
     6614         << "tripnext = " << tripnext
     6615         << ", tripx1 = " << tripx1
     6616         << ", tripx2 = " << tripx2
     6617         << ", tripDatax = tripx1 + cb_lambplot->currentIndex(): " << tripx1 << " + " << cb_lambplot->currentIndex();
     6618
     6619
     6620      //ALEXEY: the following part is buggy: commented out for now - seems to help with plotting/selecting triples for non-first channel for MWL case
     6621      //Ask Gary (if this section in place, it causes incorrect placement of cb_lambplot indexes, so no plots generated...)
     6622      /*
    65296623      if ( tripDatax >= tripx2 )
    65306624      {  // Less wavelengths in this channel than in the previous one
     
    65326626         mwl_connect( false );
    65336627         cb_lambplot->setCurrentIndex( ( tripDatax - tripx1 ) );
     6628
     6629
     6630         qDebug() << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex();
     6631     
    65346632         mwl_connect( true  );
    65356633      }
     6634      */
     6635     
     6636      qDebug() << "Inside triple_index(): cb_lambplot->currentIndex() = " << cb_lambplot->currentIndex();
     6637     
    65366638   }
    65376639
     
    67556857      QString clamb = QString::number( exp_lambdas[ ii ] );
    67566858      cb_lambplot->addItem( clamb );
     6859
     6860      qDebug() << "MWL_SETUP: exp_lambda " << ii << ", " << clamb;
    67576861   }
    67586862
    67596863   cb_lambplot->setCurrentIndex( nlambda / 2 );
     6864
     6865   //ALEXEY: need initial (non-modified by changing start/end lambdas) lambda boundaries for each channel
     6866   int nchans_int     = out_channels.count();
     6867   slambdas_per_channel.clear();
     6868   elambdas_per_channel.clear();
     6869   
     6870   if ( slambdas_per_channel.size() != nchans_int )
     6871     slambdas_per_channel.resize( nchans_int);
     6872
     6873   if ( elambdas_per_channel.size() != nchans_int )
     6874     elambdas_per_channel.resize( nchans_int);
     6875
     6876   
     6877   for ( int ccx = 0; ccx < nchans_int; ccx++ )
     6878     { 
     6879       int nlambda_per_channel        = mwl_data.lambdas( exp_lambdas, ccx );
     6880       if ( nlambda_per_channel  < 1 )
     6881         {
     6882     break;
     6883         }
     6884       slambdas_per_channel[ccx]    = exp_lambdas[ 0 ];
     6885       elambdas_per_channel[ccx]    = exp_lambdas[ nlambda_per_channel - 1 ];
     6886     }
     6887   /****************************************************************************************************/
     6888   
    67606889
    67616890   show_mwl_control( true );
  • trunk/programs/us_convert/us_convert_gui.h

    r2798 r2828  
    246246      int           dbg_level;                 // Debug level
    247247      int           impType;                   // Import type flag: 0,1,2 == Beck,MWL,AUC
     248
     249      QVector<int> slambdas_per_channel;
     250      QVector<int> elambdas_per_channel;
    248251
    249252      QString       currentDir;                // Current data file directory
Note: See TracChangeset for help on using the changeset viewer.