enhancement:plotting interval changed to red for error

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@88 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-10-10 15:42:23 +00:00
parent 55f7145b1b
commit ad171a3257
7 changed files with 182 additions and 139 deletions

View File

@ -1095,6 +1095,15 @@
<height>49</height> <height>49</height>
</rect> </rect>
</property> </property>
<property name="toolTip">
<string>&lt;nobr&gt;
Interval between plots has 2 modes. A condition to be satisfied, in order to avoid losing images:
&lt;/nobr&gt;&lt;br&gt;&lt;br&gt;&lt;nobr&gt;
&lt;b&gt;Time Interval&lt;/b&gt;: (Acquisition Period) * (nth Image) &gt;= 250ms.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
&lt;b&gt;Every nth Image&lt;/b&gt;: minimum of 250ms.
&lt;/nobr&gt;</string>
</property>
<property name="title"> <property name="title">
<string>Interval between Plots</string> <string>Interval between Plots</string>
</property> </property>

View File

@ -50,35 +50,13 @@ public:
public slots: public slots:
/** Disable Positions /** Disable Positions
* @param enable true if to disable * @param enable true if to disable
* */ * */
void EnablePositions(bool enable); void EnablePositions(bool enable);
private: private:
/** Sets up the widget */
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
/** creates the Num Positions object */
void CreatePositionsWidget();
/** Returns the index in each of the classes
* of actionwidget and scanwidget
* @param index the index in the list of all widgets
* returns actual index of the class
*/
int GetActualIndex(int index);
/** Updates to green color if collapsed and mode not none
*/
void UpdateCollapseColors();
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
@ -124,21 +102,46 @@ private:
QIcon *iconPlus; QIcon *iconPlus;
QIcon *iconMinus; QIcon *iconMinus;
/** Sets up the widget */
void SetupWidgetWindow();
/** Sets up all the slots and signals */
void Initialization();
/** creates the Num Positions object */
void CreatePositionsWidget();
/** Returns the index in each of the classes
* of actionwidget and scanwidget
* @param index the index in the list of all widgets
* returns actual index of the class
*/
int GetActualIndex(int index);
/** Updates to green color if collapsed and mode not none
*/
void UpdateCollapseColors();
private slots: private slots:
/** To Expand the Action Widget /** To Expand the Action Widget
* */ * */
void Expand(QAbstractButton *button); void Expand(QAbstractButton *button);
/** Sets the positions list and the number of positions /** Sets the positions list and the number of positions
* */ * */
void SetPosition(); void SetPosition();
/** Deletes current position
* */
void DeletePosition();
/** Deletes current position
* */
void DeletePosition();
signals: signals:
void EnableScanBox(); void EnableScanBox();
}; };

View File

@ -177,7 +177,6 @@ signals:
void StartSignal(); void StartSignal();
void StopSignal(); void StopSignal();
void CheckPlotIntervalSignal(); void CheckPlotIntervalSignal();
void EnableNthFrameSignal(bool);
}; };

View File

@ -48,8 +48,43 @@ public:
private: private:
/** The sls detector object */
multiSlsDetector *myDet;
/** The Plot widget */
qDrawPlot *myPlot;
/** 1d/2d plot */
bool isOneD;
bool isOrginallyOneD;
/**is set if its a possible wrong interval between plots*/
bool wrongInterval;
QStackedLayout *stackedLayout;
QSpinBox *spinNthFrame;
QDoubleSpinBox *spinTimeGap;
QComboBox *comboTimeGapUnit;
QButtonGroup *btnGroupScan;
/** some Default Values */
static QString defaultPlotTitle;
static QString defaultHistXAxisTitle;
static QString defaultHistYAxisTitle;
static QString defaultImageXAxisTitle;
static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle;
/** scans */
static const QString modeNames[5];
/** error palette*/
QPalette *red;
QString intervalTip;
/** methods */
/** Sets up the widget /** Sets up the widget
*/ */
void SetupWidgetWindow(); void SetupWidgetWindow();
@ -66,91 +101,52 @@ private:
public slots: public slots:
/** Set frequency between plots*/ /** Set frequency between plots*/
void SetFrequency(); void SetFrequency();
/** Enable Scan box
*/
void EnableScanBox();
/** a variable is set when timing mode has been changed. /** Enable Scan box
* This variable is also disabled if exptime>acq period to be on safe side */
* Its to check whether to enabled nth frame for frequency plot void EnableScanBox();
* @param enable enable/disable
*/
void EnableNthFrame(bool enable){enableNFrame = enable;};
/** Disables scanbox while running
* @param disable true to disable
*/
//void DisableScanBoxWhileRunning(bool disable);
private slots: private slots:
/** Selects the plot to display, enables/disables widgets /** Selects the plot to display, enables/disables widgets
* @param b true to select plot dimension 1, else false to select 2D * @param b true to select plot dimension 1, else false to select 2D
*/ */
void Select1DPlot(bool b); void Select1DPlot(bool b);
/**Enables Persistency depending on Superimpose checkbox */ /**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable); void EnablePersistency(bool enable);
/**Sets the titles in plot axis */ /**Sets the titles in plot axis */
void SetTitles(); void SetTitles();
/** Enables/Sets default Titles to default */
void EnableTitles();
/** Enables range of the axes */
void EnableRange();
/** Sets the range of the x and y axes */
void SetAxesRange();
/** Sets the range of the z axis */
void SetZRange();
/** Enables the range of the z axis */
void EnableZRange();
/** Set Plot to none, data graph, histogram*/
void SetPlot();
/** Enables/Sets default Titles to default */
void EnableTitles();
private: /** Enables range of the axes */
/** The sls detector object */ void EnableRange();
multiSlsDetector *myDet;
/** The Plot widget */ /** Sets the range of the x and y axes */
qDrawPlot *myPlot; void SetAxesRange();
/** 1d/2d plot */ /** Sets the range of the z axis */
bool isOneD; void SetZRange();
bool isOrginallyOneD;
/**whether to enable nth frame according to timing mode*/ /** Enables the range of the z axis */
bool enableNFrame; void EnableZRange();
QStackedLayout *stackedLayout; /** Set Plot to none, data graph, histogram*/
QSpinBox *spinNthFrame; void SetPlot();
QDoubleSpinBox *spinTimeGap;
QComboBox *comboTimeGapUnit;
QButtonGroup *btnGroupScan;
/** some Default Values */
static QString defaultPlotTitle;
static QString defaultHistXAxisTitle;
static QString defaultHistYAxisTitle;
static QString defaultImageXAxisTitle;
static QString defaultImageYAxisTitle;
static QString defaultImageZAxisTitle;
/** scans */
static const QString modeNames[5];
signals: signals:
void DisableZoomSignal(bool); void DisableZoomSignal(bool);
void SetZRangeSignal(double,double); void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool); void EnableZRangeSignal(bool);
}; };

View File

@ -235,7 +235,6 @@ void qDetectorMain::Initialization(){
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition())); connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency())); connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
// Data Output Tab // Data Output Tab
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool))); connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
//enable scanbox( for angles) //enable scanbox( for angles)

View File

@ -440,17 +440,14 @@ void qTabMeasurement::setAcquisitionPeriod(){
lblPeriod->setToolTip(errPeriodTip); lblPeriod->setToolTip(errPeriodTip);
lblPeriod->setPalette(red); lblPeriod->setPalette(red);
lblPeriod->setText("Acquisition Period:*"); lblPeriod->setText("Acquisition Period:*");
emit EnableNthFrameSignal(false);
} }
else { else {
spinPeriod->setToolTip(acqPeriodTip); spinPeriod->setToolTip(acqPeriodTip);
lblPeriod->setToolTip(acqPeriodTip); lblPeriod->setToolTip(acqPeriodTip);
lblPeriod->setPalette(lblTimingMode->palette()); lblPeriod->setPalette(lblTimingMode->palette());
lblPeriod->setText("Acquisition Period:"); lblPeriod->setText("Acquisition Period:");
emit EnableNthFrameSignal(true);
} }
//Check if the interval between plots is ok //Check if the interval between plots is ok
emit CheckPlotIntervalSignal(); emit CheckPlotIntervalSignal();
} }
@ -709,10 +706,7 @@ void qTabMeasurement::SetTimingMode(int mode){
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled()); myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
//check if period is enabled and alright, only then the nth frame frequency is enabled emit CheckPlotIntervalSignal();
if((lblPeriod->isEnabled())&&(lblPeriod->text()=="Acquisition Period:"))
emit EnableNthFrameSignal(true);
else emit EnableNthFrameSignal(false);
return; return;
} }

View File

@ -54,18 +54,10 @@ qTabPlot::~qTabPlot(){
void qTabPlot::SetupWidgetWindow(){ void qTabPlot::SetupWidgetWindow(){
//check if nth frame should be enabled //error for interval between plots
enableNFrame = true; red = new QPalette();;
//according to timing mode red->setColor(QPalette::Active,QPalette::WindowText,Qt::red);
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode(); intervalTip = boxFrequency->toolTip();
if( (mode==slsDetectorDefs::GATE_FIX_NUMBER)||
(mode==slsDetectorDefs::TRIGGER_FRAME) ||
(mode==slsDetectorDefs::TRIGGER_WINDOW) ||
((mode==slsDetectorDefs::AUTO_TIMING)&&((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)==1)&&((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)==1)) )
enableNFrame = false;
//according to if exptime > acq period
if((myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))>(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))
enableNFrame = false;
@ -155,6 +147,7 @@ void qTabPlot::SetupWidgetWindow(){
//to check if this should be enabled //to check if this should be enabled
EnableScanBox(); EnableScanBox();
} }
@ -442,23 +435,43 @@ void qTabPlot::SetFrequency(){
disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
double timeMS,acqPeriodMS; double timeMS,acqPeriodMS;
double minPlotTimer = myPlot->GetMinimumPlotTimer(); double minPlotTimer = myPlot->GetMinimumPlotTimer();
char cplotms[200]; char cMin[200];
sprintf(cplotms,"%f ms",minPlotTimer); sprintf(cMin,"%f ms",minPlotTimer);
stackedLayout->setCurrentIndex(comboFrequency->currentIndex()); stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
switch(comboFrequency->currentIndex()){ switch(comboFrequency->currentIndex()){
case 0: case 0:
// Get the time interval from gui in ms // Get the time interval from gui in ms
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6);
if(timeMS<minPlotTimer){
qDefs::Message(qDefs::WARNING,"Interval between Plots - The Time Interval between plots " if((int)timeMS==0){
"must be atleast "+string(cplotms)+".","Plot"); qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots:</nobr><br><nobr>"
"Time Interval must be atleast >= 1 ms. Resetting to minimum plotting time interval.","Plot");
spinTimeGap->setValue(minPlotTimer); spinTimeGap->setValue(minPlotTimer);
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
timeMS=minPlotTimer;
} }
//show red for warning
if(timeMS<minPlotTimer){
qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots: You might be losing Images!</nobr>","Plot");
boxFrequency->setPalette(*red);
boxFrequency->setTitle("Interval between Plots*");
QString errTip = intervalTip + QString("<br><br><font color=\"red\"><nobr>"
"<b>Time Interval</b> Condition: min of ")+QString("%1").arg(minPlotTimer)+
QString("ms.</nobr><br><nobr>You might be losing images!</nobr></font>");
boxFrequency->setToolTip(errTip);
}else{
boxFrequency->setPalette(boxSnapshot->palette());
boxFrequency->setTitle("Interval between Plots");
boxFrequency->setToolTip(intervalTip);
}
//This is done so that its known which one was selected //This is done so that its known which one was selected
myPlot->SetFrameFactor(0); myPlot->SetFrameFactor(0);
// Setting the timer value(ms) between plots // Setting the timer value(ms) between plots
@ -469,19 +482,49 @@ void qTabPlot::SetFrequency(){
break; break;
case 1: case 1:
acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6)); acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6));
//if period is 0, check exptime, if that is also 0, give warning and set to min timer
if(acqPeriodMS==0){
acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-6));
if(acqPeriodMS==0){
qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots:</nobr><br><nobr>"
"<b>Every Nth Image</b>: Period betwen Frames and Exposure Time cannot both be 0 ms.</nobr><br><nobr>"
"Resetting to minimum plotting time interval","Plot");
comboFrequency->setCurrentIndex(0);
stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
spinTimeGap->setValue(minPlotTimer);
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
timeMS=minPlotTimer;
//This is done so that its known which one was selected
myPlot->SetFrameFactor(0);
// Setting the timer value(ms) between plots
myPlot->SetPlotTimer(timeMS);
break;
}
}
// gets the acq period * number of nth frames // gets the acq period * number of nth frames
timeMS = (spinNthFrame->value())*acqPeriodMS; timeMS = (spinNthFrame->value())*acqPeriodMS;
// To make sure the period between plotting is not less than minimum plot timer in ms
//Show red to make sure the period between plotting is not less than minimum plot timer in ms
if(timeMS<minPlotTimer){ if(timeMS<minPlotTimer){
int minFrame = (int)(ceil)(minPlotTimer/acqPeriodMS); int minFrame = (int)(ceil)(minPlotTimer/acqPeriodMS);
qDefs::Message(qDefs::WARNING,"<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>" qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots: You might be losing Images!</nobr>","Plot");
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." boxFrequency->setPalette(*red);
"<br><br>Nth image adjusted to minimum, " boxFrequency->setTitle("Interval between Plots*");
"for the chosen Acquisition Period.","Plot"); QString errTip = intervalTip + QString("<br><br><font color=\"red\"><nobr>"
spinNthFrame->setValue(minFrame); "<b>Every nth Image</b> Condition: min nth Image for this time period: ")+QString("%1").arg(minFrame)+
QString(".</nobr><br><nobr>You might be losing images!</nobr></font>");
boxFrequency->setToolTip(errTip);
}else{
boxFrequency->setPalette(boxSnapshot->palette());
boxFrequency->setTitle("Interval between Plots");
boxFrequency->setToolTip(intervalTip);
} }
// Setting the timer value (nth frames) between plots // Setting the timer value (nth frames) between plots
myPlot->SetFrameFactor(spinNthFrame->value()); myPlot->SetFrameFactor(spinNthFrame->value());
#ifdef VERBOSE #ifdef VERBOSE
cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl; cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl;
#endif #endif
@ -491,12 +534,12 @@ void qTabPlot::SetFrequency(){
connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency())); connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency())); connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
} }
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableScanBox(){ void qTabPlot::EnableScanBox(){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Entering Enable Scan Box()" << endl; cout << "Entering Enable Scan Box()" << endl;
@ -545,7 +588,7 @@ void qTabPlot::EnableScanBox(){
} }
} }
} }
else EnablingNthFrameFunction(enableNFrame); else EnablingNthFrameFunction(true);
//positions //positions
if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false); if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);