From e7d22b1b393e3013f590d6449ef4f92541f220ea Mon Sep 17 00:00:00 2001 From: l_maliakal_d Date: Thu, 27 Feb 2014 10:53:27 +0000 Subject: [PATCH] compression enabled in gui git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@262 af1100a4-978c-4157-bff7-07162d2ba061 --- slsDetectorGui/forms/form_tab_dataoutput.ui | 212 +++++++++++--------- slsDetectorGui/include/qTabDataOutput.h | 12 ++ slsDetectorGui/src/qDetectorMain.cpp | 1 + slsDetectorGui/src/qTabDataOutput.cpp | 205 ++++++++++++------- 4 files changed, 254 insertions(+), 176 deletions(-) diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 50b838b2c..6e3dbd168 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -37,11 +37,11 @@ 20 160 731 - 166 + 171 - Correction + Options @@ -49,13 +49,23 @@ 15 25 701 - 126 + 141 3 + + + + false + + + Angular Conversion + + + @@ -63,7 +73,7 @@ #flatfield# filename - Flat Field File: + Flat Field Correction File: @@ -97,51 +107,6 @@ - - - - false - - - Rate Correction: - - - - - - - false - - - Auto - - - - - - - false - - - - 0 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 6 - - - 2000000000.000000000000000 - - - @@ -158,21 +123,22 @@ - - - - Qt::Horizontal + + + + Discard Bad Channels - - QSizePolicy::Fixed + + + + + + false - - - 40 - 20 - + + Auto - + @@ -190,38 +156,6 @@ - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - @@ -256,20 +190,100 @@ - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + false + + + + 0 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + ns + + + 6 + + + 2000000000.000000000000000 + + + + + false - Angular Conversion + Rate Correction: - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + - Discard Bad Channels + Compression diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 57aaaad88..86cfe431b 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -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); diff --git a/slsDetectorGui/src/qDetectorMain.cpp b/slsDetectorGui/src/qDetectorMain.cpp index 620e1952f..fcd191340 100644 --- a/slsDetectorGui/src/qDetectorMain.cpp +++ b/slsDetectorGui/src/qDetectorMain.cpp @@ -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 diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 7d15b1e01..63d2bff2a 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -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("This button is disabled as receiver PC is different from " - "client PC and hence different directory structures.

" + 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("This button is disabled as receiver PC is different from " + "client PC and hence different directory structures.

" + 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"); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + +