python and gui fix for parallel, gui: clkdivider also for jungfrau and parallel also for m3

This commit is contained in:
maliakal_d 2020-09-08 16:53:42 +02:00
parent aecde086a0
commit 8e09b50c5e
4 changed files with 269 additions and 291 deletions

View File

@ -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()

View File

@ -413,23 +413,129 @@ Directory where one saves the data.
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="boxCorrection_2">
<property name="title">
<string>Options</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QRadioButton" name="radioDefaultDeadtime">
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblClkDivider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Clock Divider:</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QComboBox" name="comboClkDivider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Full Speed</string>
</property>
</item>
<item>
<property name="text">
<string>Half Speed</string>
</property>
</item>
<item>
<property name="text">
<string>Quarter Speed</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QCheckBox" name="chkParallel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Default Dead Time</string>
<string>Parallel Readout</string>
</property>
</widget>
</item>
<item row="0" column="0">
</layout>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="chkTenGiga">
<property name="enabled">
<bool>false</bool>
@ -446,7 +552,55 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</property>
</widget>
</item>
<item row="1" column="4">
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="chkRate">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Rate:</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioDefaultDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Default Dead Time</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QRadioButton" name="radioCustomDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom Dead Time:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinCustomDeadTime">
<property name="enabled">
<bool>false</bool>
@ -480,43 +634,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</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:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QRadioButton" name="radioCustomDeadtime">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Custom Dead Time:</string>
</property>
</widget>
</item>
<item row="1" column="5">
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@ -532,163 +650,19 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</property>
</spacer>
</item>
<item row="2" column="0" colspan="6">
<widget class="QWidget" name="widgetEiger" native="true">
<property name="enabled">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridEiger">
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QComboBox" name="comboEigerClkDivider">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Full Speed</string>
</property>
</item>
<item>
<property name="text">
<string>Half Speed</string>
</property>
</item>
<item>
<property name="text">
<string>Quarter Speed</string>
</property>
</item>
</widget>
</item>
<item row="1" column="4">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblEigerFlags">
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Flags:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblClkDivider">
<property name="maximumSize">
<size>
<width>105</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Clock Divider:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QComboBox" name="comboEigerParallelFlag">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>Parallel</string>
</property>
</item>
<item>
<property name="text">
<string>Non Parallel</string>
</property>
</item>
</widget>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>comboDetector</tabstop>
<tabstop>dispOutputDir</tabstop>
<tabstop>btnOutputBrowse</tabstop>
<tabstop>comboFileFormat</tabstop>
<tabstop>chkOverwriteEnable</tabstop>
<tabstop>chkTenGiga</tabstop>
<tabstop>chkRate</tabstop>
<tabstop>radioDefaultDeadtime</tabstop>
<tabstop>radioCustomDeadtime</tabstop>
<tabstop>spinCustomDeadTime</tabstop>
<tabstop>comboEigerClkDivider</tabstop>
</tabstops>
<resources>
<include location="../include/icons.qrc"/>

View File

@ -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 };
};

View File

@ -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<int>(retval));
comboClkDivider->setCurrentIndex(static_cast<int>(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<slsDetectorDefs::speedLevel>(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";