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>
</rect>
</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">
<string>Interval between Plots</string>
</property>

View File

@ -50,35 +50,13 @@ public:
public slots:
/** Disable Positions
* @param enable true if to disable
* */
void EnablePositions(bool enable);
/** Disable Positions
* @param enable true if to disable
* */
void EnablePositions(bool enable);
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 */
multiSlsDetector *myDet;
@ -124,21 +102,46 @@ private:
QIcon *iconPlus;
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:
/** To Expand the Action Widget
* */
void Expand(QAbstractButton *button);
/** To Expand the Action Widget
* */
void Expand(QAbstractButton *button);
/** Sets the positions list and the number of positions
* */
void SetPosition();
/** Sets the positions list and the number of positions
* */
void SetPosition();
/** Deletes current position
* */
void DeletePosition();
/** Deletes current position
* */
void DeletePosition();
signals:
void EnableScanBox();
void EnableScanBox();
};

View File

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

View File

@ -48,8 +48,43 @@ public:
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
*/
void SetupWidgetWindow();
@ -66,91 +101,52 @@ private:
public slots:
/** Set frequency between plots*/
void SetFrequency();
/** Enable Scan box
*/
void EnableScanBox();
/** Set frequency between plots*/
void SetFrequency();
/** a variable is set when timing mode has been changed.
* 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
* @param enable enable/disable
*/
void EnableNthFrame(bool enable){enableNFrame = enable;};
/** Disables scanbox while running
* @param disable true to disable
*/
//void DisableScanBoxWhileRunning(bool disable);
/** Enable Scan box
*/
void EnableScanBox();
private slots:
/** Selects the plot to display, enables/disables widgets
* @param b true to select plot dimension 1, else false to select 2D
*/
void Select1DPlot(bool b);
/** Selects the plot to display, enables/disables widgets
* @param b true to select plot dimension 1, else false to select 2D
*/
void Select1DPlot(bool b);
/**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable);
/**Enables Persistency depending on Superimpose checkbox */
void EnablePersistency(bool enable);
/**Sets the titles in plot axis */
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();
/**Sets the titles in plot axis */
void SetTitles();
/** Enables/Sets default Titles to default */
void EnableTitles();
private:
/** The sls detector object */
multiSlsDetector *myDet;
/** Enables range of the axes */
void EnableRange();
/** The Plot widget */
qDrawPlot *myPlot;
/** Sets the range of the x and y axes */
void SetAxesRange();
/** 1d/2d plot */
bool isOneD;
bool isOrginallyOneD;
/** Sets the range of the z axis */
void SetZRange();
/**whether to enable nth frame according to timing mode*/
bool enableNFrame;
/** Enables the range of the z axis */
void EnableZRange();
QStackedLayout *stackedLayout;
QSpinBox *spinNthFrame;
QDoubleSpinBox *spinTimeGap;
QComboBox *comboTimeGapUnit;
QButtonGroup *btnGroupScan;
/** Set Plot to none, data graph, histogram*/
void SetPlot();
/** 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:
void DisableZoomSignal(bool);
void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool);
void DisableZoomSignal(bool);
void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool);
};

View File

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

View File

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

View File

@ -54,18 +54,10 @@ qTabPlot::~qTabPlot(){
void qTabPlot::SetupWidgetWindow(){
//check if nth frame should be enabled
enableNFrame = true;
//according to timing mode
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode();
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;
//error for interval between plots
red = new QPalette();;
red->setColor(QPalette::Active,QPalette::WindowText,Qt::red);
intervalTip = boxFrequency->toolTip();
@ -155,6 +147,7 @@ void qTabPlot::SetupWidgetWindow(){
//to check if this should be enabled
EnableScanBox();
}
@ -442,23 +435,43 @@ void qTabPlot::SetFrequency(){
disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
double timeMS,acqPeriodMS;
double minPlotTimer = myPlot->GetMinimumPlotTimer();
char cplotms[200];
sprintf(cplotms,"%f ms",minPlotTimer);
char cMin[200];
sprintf(cMin,"%f ms",minPlotTimer);
stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
switch(comboFrequency->currentIndex()){
case 0:
// Get the time interval from gui in ms
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 "
"must be atleast "+string(cplotms)+".","Plot");
if((int)timeMS==0){
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);
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
myPlot->SetFrameFactor(0);
// Setting the timer value(ms) between plots
@ -469,19 +482,49 @@ void qTabPlot::SetFrequency(){
break;
case 1:
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
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){
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>"
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms."
"<br><br>Nth image adjusted to minimum, "
"for the chosen Acquisition Period.","Plot");
spinNthFrame->setValue(minFrame);
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>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
myPlot->SetFrameFactor(spinNthFrame->value());
#ifdef VERBOSE
cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl;
#endif
@ -491,12 +534,12 @@ void qTabPlot::SetFrequency(){
connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::EnableScanBox(){
#ifdef VERYVERBOSE
cout << "Entering Enable Scan Box()" << endl;
@ -545,7 +588,7 @@ void qTabPlot::EnableScanBox(){
}
}
}
else EnablingNthFrameFunction(enableNFrame);
else EnablingNthFrameFunction(true);
//positions
if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);