From 8e09b50c5e59b9ee9f369ad05082ba09e0a6ce05 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 8 Sep 2020 16:53:42 +0200 Subject: [PATCH] python and gui fix for parallel, gui: clkdivider also for jungfrau and parallel also for m3 --- python/slsdet/detector.py | 2 +- slsDetectorGui/forms/form_tab_dataoutput.ui | 478 +++++++++----------- slsDetectorGui/include/qTabDataOutput.h | 6 +- slsDetectorGui/src/qTabDataOutput.cpp | 74 +-- 4 files changed, 269 insertions(+), 291 deletions(-) diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index dcbb837a4..2fd78f6a6 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1315,7 +1315,7 @@ class Detector(CppDetectorApi): @element def parallel(self): """ - [Eiger] Enable or disable the parallel readout mode of Eiger. + [Eiger][Mythen3] Enable or disable the parallel readout mode of detector. """ return self.getParallelMode() diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index d6f8d5225..a7b0bb707 100755 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -413,252 +413,6 @@ Directory where one saves the data. - - - - Options - - - - - - false - - - Default Dead Time - - - - - - - false - - - <nobr> -Compression using Root. Available only for Gotthard in Expert Mode. -</nobr><br><nobr> - #r_compression# -</nobr> - - - 10GbE - - - - - - - false - - - - 0 - 0 - - - - - 0 - 25 - - - - false - - - ns - - - -1 - - - 200000000 - - - 0 - - - - - - - false - - - Rate: - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - false - - - Custom Dead Time: - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 10 - 20 - - - - - - - - false - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 10 - 20 - - - - - - - - - 0 - 25 - - - - - 200 - 16777215 - - - - - Full Speed - - - - - Half Speed - - - - - Quarter Speed - - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 10 - 20 - - - - - - - - - 105 - 16777215 - - - - Flags: - - - - - - - - 105 - 16777215 - - - - Clock Divider: - - - - - - - - 0 - 25 - - - - - 200 - 16777215 - - - - - Parallel - - - - - Non Parallel - - - - - - - - - - @@ -675,6 +429,232 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + Options + + + + + + + + false + + + + 105 + 16777215 + + + + Clock Divider: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + false + + + + 0 + 25 + + + + + 200 + 16777215 + + + + + Full Speed + + + + + Half Speed + + + + + Quarter Speed + + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 10 + 20 + + + + + + + + + + + + false + + + Parallel Readout + + + + + + + + + false + + + <nobr> +Compression using Root. Available only for Gotthard in Expert Mode. +</nobr><br><nobr> + #r_compression# +</nobr> + + + 10GbE + + + + + + + + + false + + + Rate: + + + + + + + false + + + Default Dead Time + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + false + + + Custom Dead Time: + + + + + + + false + + + + 0 + 0 + + + + + 0 + 25 + + + + false + + + ns + + + -1 + + + 200000000 + + + 0 + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 10 + 20 + + + + + + + + + @@ -683,12 +663,6 @@ Compression using Root. Available only for Gotthard in Expert Mode. btnOutputBrowse comboFileFormat chkOverwriteEnable - chkTenGiga - chkRate - radioDefaultDeadtime - radioCustomDeadtime - spinCustomDeadTime - comboEigerClkDivider diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index e1cdf5fcb..a1ca5e513 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -21,7 +21,7 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject { void EnableRateCorrection(); void SetRateCorrection(); void SetSpeed(int speed); - void SetFlags(); + void SetParallel(bool enable); private: void SetupWidgetWindow(); @@ -35,11 +35,9 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject { void GetTenGigaEnable(); void GetRateCorrection(); void GetSpeed(); - void GetFlags(); + void GetParallel(); sls::Detector *det; // Button group for radiobuttons for rate QButtonGroup *btnGroupRate; - // enum for the Eiger Parallel flag - enum { PARALLEL, NONPARALLEL }; }; diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 9767e519a..f750b7cba 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -32,12 +32,20 @@ void qTabDataOutput::SetupWidgetWindow() { radioDefaultDeadtime->setEnabled(true); radioCustomDeadtime->setEnabled(true); // flags and speed - widgetEiger->setVisible(true); - widgetEiger->setEnabled(true); + lblClkDivider->setEnabled(true); + comboClkDivider->setEnabled(true); + chkParallel->setEnabled(true); break; case slsDetectorDefs::MOENCH: chkTenGiga->setEnabled(true); break; + case slsDetectorDefs::MYTHEN3: + chkParallel->setEnabled(true); + break; + case slsDetectorDefs::JUNGFRAU: + lblClkDivider->setEnabled(true); + comboClkDivider->setEnabled(true); + break; default: break; } @@ -74,12 +82,15 @@ void qTabDataOutput::Initialization() { connect(spinCustomDeadTime, SIGNAL(valueChanged(int)), this, SLOT(SetRateCorrection())); } - // flags, speed - if (widgetEiger->isEnabled()) { - connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, + // parallel + if (chkParallel->isEnabled()) { + connect(chkParallel, SIGNAL(toggled(bool)), this, + SLOT(SetParallel(bool))); + } + // speed + if (comboClkDivider->isEnabled()) { + connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); - connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, - SLOT(SetFlags())); } } @@ -359,22 +370,21 @@ void qTabDataOutput::SetRateCorrection() { void qTabDataOutput::GetSpeed() { LOG(logDEBUG) << "Getting Speed"; - disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, + disconnect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); try { auto retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors."); - comboEigerClkDivider->setCurrentIndex(static_cast(retval)); + comboClkDivider->setCurrentIndex(static_cast(retval)); } CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed") - connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, + connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int))); } void qTabDataOutput::SetSpeed(int speed) { LOG(logINFO) << "Setting Speed to " - << comboEigerClkDivider->currentText().toAscii().data(); - ; + << comboClkDivider->currentText().toAscii().data(); try { det->setSpeed(static_cast(speed)); } @@ -382,34 +392,28 @@ void qTabDataOutput::SetSpeed(int speed) { &qTabDataOutput::GetSpeed) } -void qTabDataOutput::GetFlags() { - LOG(logDEBUG) << "Getting readout flags"; - disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, - SLOT(SetFlags())); +void qTabDataOutput::GetParallel() { + LOG(logDEBUG) << "Getting parallel readout"; + disconnect(chkParallel, SIGNAL(toggled(bool)), this, + SLOT(SetParallel(bool))); try { auto retval = det->getParallelMode().tsquash( "Parallel Flag is inconsistent for all detectors."); - // parallel or non parallel - if (retval) - comboEigerParallelFlag->setCurrentIndex(PARALLEL); - else - comboEigerParallelFlag->setCurrentIndex(NONPARALLEL); + chkParallel->setChecked(retval); } - CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags") - connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, - SLOT(SetFlags())); + CATCH_DISPLAY("Could not get parallel readout.", + "qTabDataOutput::GetParallel") + connect(chkParallel, SIGNAL(toggled(bool)), this, SLOT(SetParallel(bool))); } -void qTabDataOutput::SetFlags() { - auto mode = - comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false; +void qTabDataOutput::SetParallel(bool enable) { + LOG(logINFO) << "Setting PArallel readout to " << enable; try { - LOG(logINFO) << "Setting Readout Flags to " - << comboEigerParallelFlag->currentText().toAscii().data(); - det->setParallelMode(mode); + det->setParallelMode(enable); } - CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags", - this, &qTabDataOutput::GetFlags) + CATCH_HANDLE("Could not set parallel readout.", + "qTabDataOutput::SetParallel", this, + &qTabDataOutput::GetParallel) } void qTabDataOutput::Refresh() { @@ -427,9 +431,11 @@ void qTabDataOutput::Refresh() { if (chkTenGiga->isEnabled()) { GetTenGigaEnable(); } - if (widgetEiger->isEnabled()) { + if (chkParallel->isEnabled()) { + GetParallel(); + } + if (comboClkDivider->isEnabled()) { GetSpeed(); - GetFlags(); } LOG(logDEBUG) << "**Updated DataOutput Tab";