slsDetectorGui:added subexptime and subperiod to gui

This commit is contained in:
maliakal_d 2018-05-17 15:34:35 +02:00
parent b4d9a6a09d
commit 563b1bb8b7
3 changed files with 415 additions and 6 deletions

View File

@ -256,7 +256,7 @@ Plots Trimbits from Detector. This will take time.
<x>25</x>
<y>25</y>
<width>696</width>
<height>199</height>
<height>208</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_3">
@ -977,7 +977,7 @@ An extension given by the modules serial number will be attached.
<x>25</x>
<y>25</y>
<width>686</width>
<height>128</height>
<height>148</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
@ -1357,7 +1357,7 @@ An extension given by the modules serial number will be attached.
<x>35</x>
<y>15</y>
<width>686</width>
<height>128</height>
<height>146</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
@ -1750,7 +1750,7 @@ An extension given by the modules serial number will be attached.
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Others</string>
<string>Acquisition</string>
</attribute>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
@ -1758,10 +1758,48 @@ An extension given by the modules serial number will be attached.
<x>14</x>
<y>13</y>
<width>367</width>
<height>39</height>
<height>110</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="spinSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
@ -1791,7 +1829,80 @@ An extension given by the modules serial number will be attached.
</property>
</widget>
</item>
<item row="0" column="2">
<item row="1" column="0">
<widget class="QLabel" name="lblSubExpTime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Exposure Time:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QComboBox" name="comboSubExpTimeUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subexptime#
&lt;/nobr&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumStoragecells">
<property name="enabled">
<bool>false</bool>
@ -1831,6 +1942,123 @@ An extension given by the modules serial number will be attached.
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lblSubPeriod">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Sub Frame Period:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="spinSubPeriod">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals">
<number>9</number>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QComboBox" name="comboSubPeriodUnit">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
Default value is 0. A value less than the required minimum is ignored.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#subperiod#
&lt;/nobr&gt;</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<item>
<property name="text">
<string>hr</string>
</property>
</item>
<item>
<property name="text">
<string>min</string>
</property>
</item>
<item>
<property name="text">
<string>s</string>
</property>
</item>
<item>
<property name="text">
<string>ms</string>
</property>
</item>
<item>
<property name="text">
<string>us</string>
</property>
</item>
<item>
<property name="text">
<string>ns</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>

View File

@ -201,6 +201,13 @@ private slots:
/** Set storage cells */
void SetNumStoragecells(int value);
/** Set sub frame exposure time */
void SetSubExposureTime();
/** Set sub frame period */
void SetSubPeriod();
private:
/** The multi detector object */
multiSlsDetector *myDet;
@ -245,7 +252,11 @@ private:
vector <QSpinBox*> spinToY;
int numRois;
/** sub period tool tip variables*/
QString acqSubPeriodTip;
QString errSubPeriodTip;
void CheckAcqPeriodGreaterThanExp();
};

View File

@ -72,6 +72,14 @@ void qTabAdvanced::SetupWidgetWindow(){
rxrOnlineTip = comboRxrOnline->toolTip();
errOnlineTip = QString("<nobr><br><br><font color=\"red\"><nobr>It is offline!</nobr></font>");
acqSubPeriodTip = spinSubPeriod->toolTip();
errSubPeriodTip = acqSubPeriodTip +
QString("<nobr><br><br><font color=\"red\"><b>Sub Frame Period</b> "
"should be greater than or equal to "
"<b>Sub Frame Exposure Time</b>.</font></nobr>");
detType = myDet->getDetectorsType();
switch(detType){
case slsDetectorDefs::MYTHEN:
@ -91,6 +99,12 @@ void qTabAdvanced::SetupWidgetWindow(){
dispMAC->setEnabled(true);
boxRxr->setEnabled(true);
boxSetAllTrimbits->setEnabled(true);
lblSubExpTime->setEnabled(true);
spinSubExpTime->setEnabled(true);
comboSubExpTimeUnit->setEnabled(true);
lblSubPeriod->setEnabled(true);
spinSubPeriod->setEnabled(true);
comboSubPeriodUnit->setEnabled(true);
break;
case slsDetectorDefs::MOENCH:
isEnergy = false;
@ -212,6 +226,18 @@ void qTabAdvanced::SetupWidgetWindow(){
lblNumStoragecells->setEnabled(true);
spinNumStoragecells->setEnabled(true);
spinNumStoragecells->setValue((int)myDet->setTimer(slsDetectorDefs::STORAGE_CELL_NUMBER,-1));
} else if (detType == slsDetectorDefs::EIGER) {
//subexptime
qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,-1)*(1E-9))));
spinSubExpTime->setValue(time);
comboSubExpTimeUnit->setCurrentIndex((int)unit);
//period
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
spinSubPeriod->setValue(time);
comboSubPeriodUnit->setCurrentIndex((int)unit);
CheckAcqPeriodGreaterThanExp();
}
Initialization();
@ -303,6 +329,14 @@ void qTabAdvanced::Initialization(){
if(detType == slsReceiverDefs::JUNGFRAU) {
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
} else if (detType == slsDetectorDefs::EIGER) {
//Exposure Time
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
//Frame Period between exposures
connect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));
connect(comboSubPeriodUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubPeriod()));
}
}
@ -1253,6 +1287,110 @@ void qTabAdvanced::SetNumStoragecells(int value) {
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetSubExposureTime() {
disconnect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
disconnect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubExposureTime()));
//Get the value of timer in ns
double timeNS = qDefs::getNSTime(
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(),
spinSubExpTime->value());
// set value
#ifdef VERBOSE
cout << "Setting sub frame acquisition time to " << timeNS << " clocks" <<
"/" << spinSubExpTime->value() <<
qDefs::getUnitString((qDefs::timeUnit)comboSubExpTimeUnit->currentIndex()) << endl;
#endif
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,(int64_t)timeNS);
qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubExposureTime");
// update value in gui
qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,-1)*(1E-9))));
spinSubExpTime->setValue(time);
comboSubExpTimeUnit->setCurrentIndex((int)unit);
// highlight if period < exptime
CheckAcqPeriodGreaterThanExp();
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubExposureTime");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetSubPeriod() {
disconnect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));
disconnect(comboSubPeriodUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubPeriod()));
//Get the value of timer in ns
double timeNS = qDefs::getNSTime(
(qDefs::timeUnit)comboSubPeriodUnit->currentIndex(),
spinSubPeriod->value());
// set value
#ifdef VERBOSE
cout << "Setting sub frame period to " << timeNS << " clocks" <<
"/" << spinSubPeriod->value() <<
qDefs::getUnitString((qDefs::timeUnit)comboSubPeriodUnit->currentIndex()) << endl;
#endif
myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,(int64_t)timeNS);
qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubPeriod");
// update value in gui
qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(
myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
spinSubPeriod->setValue(time);
comboSubPeriodUnit->setCurrentIndex((int)unit);
// highlight if period < exptime
CheckAcqPeriodGreaterThanExp();
connect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));
connect(comboSubPeriodUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubPeriod()));
qDefs::checkErrorMessage(myDet,"qTabAdvanced::SetSubPeriod");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::CheckAcqPeriodGreaterThanExp(){
double exptimeNS = qDefs::getNSTime(
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex(),
spinSubExpTime->value());
double acqtimeNS = qDefs::getNSTime(
(qDefs::timeUnit)comboSubPeriodUnit->currentIndex(),
spinSubPeriod->value());
if(exptimeNS>acqtimeNS && acqtimeNS > 0) {
spinSubPeriod->setToolTip(errSubPeriodTip);
lblSubPeriod->setToolTip(errSubPeriodTip);
lblSubPeriod->setPalette(red);
lblSubPeriod->setText("Sub Frame Period:*");
}
else {
spinSubPeriod->setToolTip(acqSubPeriodTip);
lblSubPeriod->setToolTip(acqSubPeriodTip);
lblSubPeriod->setPalette(lblExpTime->palette());
lblSubPeriod->setText("Sub Frame Period:");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){
@ -1449,6 +1587,38 @@ void qTabAdvanced::Refresh(){
connect(spinNumStoragecells,SIGNAL(valueChanged(int)), this, SLOT(SetNumStoragecells(int)));
}
// sub exptime and sub period
else if (detType == slsReceiverDefs::EIGER) {
disconnect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
disconnect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubExposureTime()));
disconnect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));
disconnect(comboSubPeriodUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubPeriod()));
#ifdef VERBOSE
cout << "Getting Sub Exposure time and Sub Period" << endl;
#endif
// subexptime
qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(
myDet->setTimer(slsDetectorDefs::SUBFRAME_ACQUISITION_TIME,-1)*(1E-9))));
spinSubExpTime->setValue(time);
comboSubExpTimeUnit->setCurrentIndex((int)unit);
// subperiod
time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::SUBFRAME_PERIOD,-1)*(1E-9))));
spinSubPeriod->setValue(time);
comboSubPeriodUnit->setCurrentIndex((int)unit);
// highlight if period < exptime
CheckAcqPeriodGreaterThanExp();
connect(spinSubExpTime,SIGNAL(valueChanged(double)), this, SLOT(SetSubExposureTime()));
connect(comboSubExpTimeUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetSubExposureTime()));
connect(spinSubPeriod,SIGNAL(valueChanged(double)), this, SLOT(SetSubPeriod()));
connect(comboSubPeriodUnit,SIGNAL(currentIndexChanged(int)),this, SLOT(SetSubPeriod()));
}
#ifdef VERBOSE
cout << "**Updated Advanced Tab" << endl << endl;
#endif