compression enabled in gui

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@262 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2014-02-27 10:53:27 +00:00
parent d0b12f4197
commit e7d22b1b39
4 changed files with 254 additions and 176 deletions

View File

@ -37,11 +37,11 @@
<x>20</x>
<y>160</y>
<width>731</width>
<height>166</height>
<height>171</height>
</rect>
</property>
<property name="title">
<string>Correction</string>
<string>Options</string>
</property>
<widget class="QWidget" name="gridLayoutWidget_2">
<property name="geometry">
@ -49,13 +49,23 @@
<x>15</x>
<y>25</y>
<width>701</width>
<height>126</height>
<height>141</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="verticalSpacing">
<number>3</number>
</property>
<item row="2" column="0">
<widget class="QCheckBox" name="chkAngular">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Angular Conversion</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="chkFlatField">
<property name="toolTip">
@ -63,7 +73,7 @@
#flatfield# filename</string>
</property>
<property name="text">
<string>Flat Field File:</string>
<string>Flat Field Correction File:</string>
</property>
</widget>
</item>
@ -97,51 +107,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate Correction:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioAuto">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Auto</string>
</property>
</widget>
</item>
<item row="1" column="6" colspan="3">
<widget class="QDoubleSpinBox" name="spinDeadTime">
<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="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string> ns</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="6">
<spacer name="horizontalSpacer_5">
<property name="orientation">
@ -158,21 +123,22 @@
</property>
</spacer>
</item>
<item row="3" column="4">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="3" column="0">
<widget class="QCheckBox" name="chkDiscardBad">
<property name="text">
<string>Discard Bad Channels</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</widget>
</item>
<item row="1" column="2">
<widget class="QRadioButton" name="radioAuto">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>Auto</string>
</property>
</spacer>
</widget>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer_7">
@ -190,38 +156,6 @@
</property>
</spacer>
</item>
<item row="3" column="8">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="7">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="8">
<widget class="QPushButton" name="btnFlatField">
<property name="enabled">
@ -256,20 +190,100 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="chkAngular">
<item row="3" column="8">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="7">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="6" colspan="3">
<widget class="QDoubleSpinBox" name="spinDeadTime">
<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="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string> ns</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Angular Conversion</string>
<string>Rate Correction:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkDiscardBad">
<item row="3" column="4">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkCompression">
<property name="toolTip">
<string>&lt;nobr&gt;
Compression using Root. Available only for Gotthard in Expert Mode.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
#r_compression#
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Discard Bad Channels</string>
<string>Compression</string>
</property>
</widget>
</item>

View File

@ -45,6 +45,11 @@ public:
*/
int VerifyOutputDirectory();
/** To enable expert mode
* @param enable to enable if true
*/
void SetExpertMode(bool enable);
private:
/** The sls detector object */
@ -53,6 +58,7 @@ private:
/** detector type */
slsDetectorDefs::detectorType detType;
QString flatFieldTip;
QString errFlatFieldTip;
QString outDirTip;
@ -72,6 +78,9 @@ private:
*/
void PopulateDetectors();
/** Get Compression */
void GetCompression();
private slots:
@ -105,6 +114,9 @@ void SetOutputDir();
/** set output directory*/
void GetOutputDir();
/** set compression */
void SetCompression(bool enable);
signals:
/**signal to enable/disable positions in Actions*/
void AngularConversionSignal(bool);

View File

@ -362,6 +362,7 @@ void qDetectorMain::EnableModes(QAction *action){
actionSaveCalibration->setVisible(enable);
tab_measurement->SetExpertMode(enable);
tab_settings->SetExpertMode(enable);
tab_dataoutput->SetExpertMode(enable);
#ifdef VERBOSE
cout << "Setting Expert Mode to " << enable << endl;
#endif

View File

@ -73,6 +73,8 @@ void qTabDataOutput::SetupWidgetWindow(){
outDirTip = boxOutDir->toolTip();
//expert mode is not enabled initially
chkCompression->setEnabled(false);
Initialization();
@ -153,6 +155,19 @@ void qTabDataOutput::Initialization(){
connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection()));
//discard bad channels
connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels()));
//compression
connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool)));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetExpertMode(bool enable){
if((detType == slsDetectorDefs::GOTTHARD) || (detType == slsDetectorDefs::MOENCH)){
chkCompression->setEnabled(enable);
GetCompression();
}
}
@ -456,83 +471,6 @@ void qTabDataOutput::DiscardBadChannels(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating DataOutput Tab" << endl;
#endif
// output dir
#ifdef VERBOSE
cout << "Getting output directory" << endl;
#endif
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
PopulateDetectors();
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
//flat field correction from server
#ifdef VERBOSE
cout << "Getting flat field" << endl;
#endif
UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){
#ifdef VERBOSE
cout << "Getting rate correction" << endl;
#endif
UpdateRateCorrectionFromServer();
}
//update angular conversion from server
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){
#ifdef VERBOSE
cout << "Getting angular conversion" << endl;
#endif
int ang;
if(myDet->getAngularConversion(ang))
chkAngular->setChecked(true);
emit AngularConversionSignal(chkAngular->isChecked());
}
//discard bad channels from server
#ifdef VERBOSE
cout << "Getting bad channel correction" << endl;
// cout << "ff " << myDet->getBadChannelCorrection() << endl;
#endif
disconnect(chkDiscardBad, SIGNAL(toggled(bool)));
if(myDet->getBadChannelCorrection())
chkDiscardBad->setChecked(true);
else
chkDiscardBad->setChecked(false);
connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels()));
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){
btnOutputBrowse->setEnabled(false);
btnOutputBrowse->setToolTip("<font color=\"red\">This button is disabled as receiver PC is different from "
"client PC and hence different directory structures.</font><br><br>" + dispOutputDir->toolTip());
}else{
btnOutputBrowse->setEnabled(true);
btnOutputBrowse->setToolTip(dispOutputDir->toolTip());
}
#ifdef VERBOSE
cout << "**Updated DataOutput Tab" << endl << endl;
#endif
qDefs::checkErrorMessage(myDet,"qTabDataOutput::Refresh");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::PopulateDetectors(){
#ifdef VERBOSE
cout << "Populating detectors" << endl;
@ -769,3 +707,116 @@ void qTabDataOutput::SetOutputDir(){
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::GetCompression(){
disconnect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool)));
int ret = myDet->enableReceiverCompression();
if(ret > 0) chkCompression->setChecked(true);
else chkCompression->setChecked(false);
connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool)));
qDefs::checkErrorMessage(myDet,"qTabDataOutput::GetCompression");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::SetCompression(bool enable){
disconnect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool)));
int ret = myDet->enableReceiverCompression(enable);
if(ret > 0) chkCompression->setChecked(true);
else chkCompression->setChecked(false);
connect(chkCompression, SIGNAL(toggled(bool)), this, SLOT(SetCompression(bool)));
qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetCompression");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabDataOutput::Refresh(){
#ifdef VERBOSE
cout << endl << "**Updating DataOutput Tab" << endl;
#endif
// output dir
#ifdef VERBOSE
cout << "Getting output directory" << endl;
#endif
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
PopulateDetectors();
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
//flat field correction from server
#ifdef VERBOSE
cout << "Getting flat field" << endl;
#endif
UpdateFlatFieldFromServer();
//rate correction - not for charge integrating detectors
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)){
#ifdef VERBOSE
cout << "Getting rate correction" << endl;
#endif
UpdateRateCorrectionFromServer();
}
//update angular conversion from server
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::GOTTHARD)){
#ifdef VERBOSE
cout << "Getting angular conversion" << endl;
#endif
int ang;
if(myDet->getAngularConversion(ang))
chkAngular->setChecked(true);
emit AngularConversionSignal(chkAngular->isChecked());
}
//discard bad channels from server
#ifdef VERBOSE
cout << "Getting bad channel correction" << endl;//cout << "ff " << myDet->getBadChannelCorrection() << endl;
#endif
disconnect(chkDiscardBad, SIGNAL(toggled(bool)));
if(myDet->getBadChannelCorrection())
chkDiscardBad->setChecked(true);
else
chkDiscardBad->setChecked(false);
connect(chkDiscardBad, SIGNAL(toggled(bool)), this, SLOT(DiscardBadChannels()));
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG){
btnOutputBrowse->setEnabled(false);
btnOutputBrowse->setToolTip("<font color=\"red\">This button is disabled as receiver PC is different from "
"client PC and hence different directory structures.</font><br><br>" + dispOutputDir->toolTip());
}else{
btnOutputBrowse->setEnabled(true);
btnOutputBrowse->setToolTip(dispOutputDir->toolTip());
}
//getting compression
if(chkCompression->isEnabled()){
#ifdef VERBOSE
cout << "Getting compression" << endl;
#endif
GetCompression();
}
#ifdef VERBOSE
cout << "**Updated DataOutput Tab" << endl << endl;
#endif
qDefs::checkErrorMessage(myDet,"qTabDataOutput::Refresh");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------