mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 10:00:40 +02:00
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:
parent
55f7145b1b
commit
ad171a3257
@ -1095,6 +1095,15 @@
|
||||
<height>49</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Interval between plots has 2 modes. A condition to be satisfied, in order to avoid losing images:
|
||||
</nobr><br><br><nobr>
|
||||
<b>Time Interval</b>: (Acquisition Period) * (nth Image) >= 250ms.
|
||||
</nobr><br><nobr>
|
||||
<b>Every nth Image</b>: minimum of 250ms.
|
||||
</nobr></string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Interval between Plots</string>
|
||||
</property>
|
||||
|
@ -57,28 +57,6 @@ 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,6 +102,30 @@ 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
|
||||
* */
|
||||
@ -137,6 +139,7 @@ void SetPosition();
|
||||
* */
|
||||
void DeletePosition();
|
||||
|
||||
|
||||
signals:
|
||||
void EnableScanBox();
|
||||
|
||||
|
@ -177,7 +177,6 @@ signals:
|
||||
void StartSignal();
|
||||
void StopSignal();
|
||||
void CheckPlotIntervalSignal();
|
||||
void EnableNthFrameSignal(bool);
|
||||
};
|
||||
|
||||
|
||||
|
@ -47,74 +47,6 @@ public:
|
||||
void Refresh();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/** methods */
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** This enabled/disables the nth frame from frequency plot
|
||||
* @param enable enable/disable
|
||||
*/
|
||||
void EnablingNthFrameFunction(bool enable);
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set frequency between plots*/
|
||||
void SetFrequency();
|
||||
/** Enable Scan box
|
||||
*/
|
||||
void EnableScanBox();
|
||||
|
||||
/** 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);
|
||||
|
||||
|
||||
|
||||
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);
|
||||
|
||||
/**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();
|
||||
|
||||
|
||||
private:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
@ -126,8 +58,8 @@ qDrawPlot *myPlot;
|
||||
bool isOneD;
|
||||
bool isOrginallyOneD;
|
||||
|
||||
/**whether to enable nth frame according to timing mode*/
|
||||
bool enableNFrame;
|
||||
/**is set if its a possible wrong interval between plots*/
|
||||
bool wrongInterval;
|
||||
|
||||
QStackedLayout *stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
@ -146,11 +78,75 @@ static QString defaultImageZAxisTitle;
|
||||
/** scans */
|
||||
static const QString modeNames[5];
|
||||
|
||||
/** error palette*/
|
||||
QPalette *red;
|
||||
QString intervalTip;
|
||||
|
||||
|
||||
|
||||
|
||||
/** Sets up the widget
|
||||
*/
|
||||
void SetupWidgetWindow();
|
||||
|
||||
/** Sets up all the slots and signals
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** This enabled/disables the nth frame from frequency plot
|
||||
* @param enable enable/disable
|
||||
*/
|
||||
void EnablingNthFrameFunction(bool enable);
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
/** Set frequency between plots*/
|
||||
void SetFrequency();
|
||||
|
||||
/** 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);
|
||||
|
||||
/**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();
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user