Formatted package
This commit is contained in:
Dhanya Thattil
2022-08-05 15:39:34 +02:00
committed by GitHub
parent 7173785b29
commit 6bf9dbf6d3
89 changed files with 1366 additions and 1210 deletions

View File

@ -8,8 +8,8 @@
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_marker.h>
#include <qwt_scale_div.h>
#include <qwt_plot_shapeitem.h>
#include <qwt_scale_div.h>
class QPen;
class QwtSymbol;
@ -140,7 +140,7 @@ class SlsQt1DPlot : public QwtPlot {
void SetLogX(bool yes = 1);
void SetLogY(bool yes = 1);
void EnableRoiBox(std::array<int, 4> roi);
void EnableRoiBox(std::array<int, 4> roi);
void DisableRoiBox();
private:
@ -176,5 +176,3 @@ class SlsQt1DPlot : public QwtPlot {
} // namespace sls
#endif

View File

@ -5,8 +5,8 @@
#include "SlsQt2DZoomer.h"
#include <qlist.h>
#include <qwt_plot.h>
#include <qwt_plot_spectrogram.h>
#include <qwt_plot_shapeitem.h>
#include <qwt_plot_spectrogram.h>
class QwtPlotPanner;
class QwtScaleWidget;
@ -70,7 +70,7 @@ class SlsQt2DPlot : public QwtPlot {
void SetLogz(bool enable, bool isMin, bool isMax, double min, double max);
void SetZRange(bool isMin, bool isMax, double min, double max);
void LogZ(bool on = 1);
void EnableRoiBox(std::array<int, 4> roi);
void EnableRoiBox(std::array<int, 4> roi);
void DisableRoiBox();
public slots:

View File

@ -444,17 +444,16 @@ void SlsQt1DPlot::SetLog(int axisId, bool yes) {
Update();
}
void SlsQt1DPlot::EnableRoiBox(std::array<int, 4> roi) {
if (roiBox == nullptr) {
roiBox = new QwtPlotShapeItem();
roiBox->attach(this);
roiBox->setPen(QColor(Qt::yellow), 2.0, Qt::SolidLine);
}
}
// TopLeft - BottomRight (max points are +1 on graph)
QRect myRect(QPoint(roi[0], roi[2]), QPoint(roi[1] - 1, roi[3] - 1));
roiBox->setRect( QRectF(myRect) );
roiBox->setRect(QRectF(myRect));
replot();
}
@ -465,7 +464,6 @@ void SlsQt1DPlot::DisableRoiBox() {
}
}
void SlsQt1DPlot::UnZoom() {
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());

View File

@ -301,7 +301,7 @@ void SlsQt2DPlot::EnableRoiBox(std::array<int, 4> roi) {
// TopLeft - BottomRight (max points are +1 on graph)
QRect myRect(QPoint(roi[0], roi[2]), QPoint(roi[1] - 1, roi[3] - 1));
roiBox->setRect( QRectF(myRect) );
roiBox->setRect(QRectF(myRect));
roiBox->attach(this);
replot();

View File

@ -59,7 +59,8 @@ int main(int argc, char **argv) {
case 'f':
fname = optarg;
LOG(sls::logDEBUG) << long_options[option_index].name << " " << optarg;
LOG(sls::logDEBUG)
<< long_options[option_index].name << " " << optarg;
break;
case 'd':
@ -73,7 +74,7 @@ int main(int argc, char **argv) {
case 'v':
tempval = APIGUI;
LOG(sls::logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
<< std::hex << tempval << ")";
<< std::hex << tempval << ")";
return 0;
case 'h':
@ -101,7 +102,8 @@ int main(int argc, char **argv) {
app.exec();
} catch (const std::exception &e) {
sls::qDefs::Message(sls::qDefs::CRITICAL,
std::string(e.what()) + "\nExiting Gui :'( ", "main");
std::string(e.what()) + "\nExiting Gui :'( ",
"main");
}
return 0;
}
@ -243,16 +245,14 @@ void qDetectorMain::SetUpDetector(const std::string &config_file, int multiID) {
default:
std::ostringstream os;
os << det->getHostname() << " has "
<< ToString(det->getDetectorType().squash())
<< " detector type (" << std::to_string(detType)
<< "). Exiting GUI.";
<< ToString(det->getDetectorType().squash()) << " detector type ("
<< std::to_string(detType) << "). Exiting GUI.";
std::string errorMess = os.str();
throw RuntimeError(errorMess.c_str());
}
std::ostringstream os;
os << "SLS Detector GUI : "
<< ToString(det->getDetectorType().squash()) << " - "
<< det->getHostname();
os << "SLS Detector GUI : " << ToString(det->getDetectorType().squash())
<< " - " << det->getHostname();
std::string title = os.str();
LOG(logINFO) << title;
setWindowTitle(QString(title.c_str()));
@ -344,7 +344,8 @@ void qDetectorMain::EnableModes(QAction *action) {
enable = actionExpert->isChecked();
tabs->setTabEnabled(ADVANCED, enable);
bool visible = enable && (detType == slsDetectorDefs::EIGER || detType == slsDetectorDefs::MYTHEN3);
bool visible = enable && (detType == slsDetectorDefs::EIGER ||
detType == slsDetectorDefs::MYTHEN3);
actionLoadTrimbits->setVisible(visible);
actionSaveTrimbits->setVisible(visible);
tabSettings->SetExportMode(enable);

View File

@ -628,7 +628,6 @@ void qDrawPlot::SetGapPixels(bool enable) {
isGapPixels = enable;
}
void qDrawPlot::GetStatistics(double &min, double &max, double &sum) {
LOG(logDEBUG) << "Calculating Statistics";
double *array = data2d;
@ -778,15 +777,15 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
rxRoi.ymax = data->rxRoi[3];
// only for 2d anyway
if (isGapPixels) {
rxRoi.xmin += ((rxRoi.xmin/1024) * 6 + (rxRoi.xmin/256) * 2);
rxRoi.xmax += ((rxRoi.xmax/1024) * 6 + (rxRoi.xmax/256) * 2);
rxRoi.ymin += ((rxRoi.ymin/512) * 34 + (rxRoi.ymin/256) * 2);
rxRoi.ymax += ((rxRoi.ymax/512) * 34 + (rxRoi.ymax/256) * 2);
LOG(logINFO) << "Rx_roi recalculated with gap pixels: " << ToString(rxRoi);
rxRoi.xmin += ((rxRoi.xmin / 1024) * 6 + (rxRoi.xmin / 256) * 2);
rxRoi.xmax += ((rxRoi.xmax / 1024) * 6 + (rxRoi.xmax / 256) * 2);
rxRoi.ymin += ((rxRoi.ymin / 512) * 34 + (rxRoi.ymin / 256) * 2);
rxRoi.ymax += ((rxRoi.ymax / 512) * 34 + (rxRoi.ymax / 256) * 2);
LOG(logINFO) << "Rx_roi recalculated with gap pixels: "
<< ToString(rxRoi);
}
LOG(logDEBUG) << "Rx_roi: " << ToString(rxRoi);
}
// 1d check if npixelX has changed (m3 for different counters enabled)
if (is1d && static_cast<int>(nPixelsX) != data->nx) {
@ -1034,17 +1033,22 @@ void qDrawPlot::Update1dPlot() {
}
lblRxRoiEnabled->hide();
} else {
plot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, (int)plot1d->GetYMinimum(), (int)plot1d->GetYMaximum()});
plot1d->EnableRoiBox(std::array<int, 4>{
rxRoi.xmin, rxRoi.xmax, (int)plot1d->GetYMinimum(),
(int)plot1d->GetYMaximum()});
if (isGainDataExtracted) {
gainplot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, 0, 3});
gainplot1d->EnableRoiBox(
std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, 0, 3});
}
lblRxRoiEnabled->show();
}
}
// ymin and ymax could change (so replot roi every time)
if (!rxRoi.completeRoi()) {
plot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax, (int)plot1d->GetYMinimum(), (int)plot1d->GetYMaximum()});
}
plot1d->EnableRoiBox(std::array<int, 4>{rxRoi.xmin, rxRoi.xmax,
(int)plot1d->GetYMinimum(),
(int)plot1d->GetYMaximum()});
}
}
void qDrawPlot::Update2dPlot() {

View File

@ -7,8 +7,7 @@
namespace sls {
qTabAdvanced::qTabAdvanced(QWidget *parent, Detector *detector,
qDrawPlot *p)
qTabAdvanced::qTabAdvanced(QWidget *parent, Detector *detector, qDrawPlot *p)
: QWidget(parent), det(detector), plot(p) {
setupUi(this);
SetupWidgetWindow();
@ -445,8 +444,7 @@ void qTabAdvanced::SetDetectorUDPIP(bool force) {
std::string s = dispDetectorUDPIP->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP IP:" << s;
try {
det->setSourceUDPIP(IpAddr{s},
{comboDetector->currentIndex()});
det->setSourceUDPIP(IpAddr{s}, {comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Detector UDP IP.",
"qTabAdvanced::SetDetectorUDPIP", this,
@ -463,8 +461,7 @@ void qTabAdvanced::SetDetectorUDPMAC(bool force) {
std::string s = dispDetectorUDPMAC->text().toAscii().constData();
LOG(logINFO) << "Setting Detector UDP MAC:" << s;
try {
det->setSourceUDPMAC(MacAddr{s},
{comboDetector->currentIndex()});
det->setSourceUDPMAC(MacAddr{s}, {comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Detector UDP MAC.",
"qTabAdvanced::SetDetectorUDPMAC", this,
@ -491,8 +488,7 @@ void qTabAdvanced::SetCltZMQIP(bool force) {
std::string s = dispZMQIP->text().toAscii().constData();
LOG(logINFO) << "Setting Client ZMQ IP:" << s;
try {
det->setClientZmqIp(IpAddr{s},
{comboDetector->currentIndex()});
det->setClientZmqIp(IpAddr{s}, {comboDetector->currentIndex()});
}
CATCH_HANDLE("Could not set Client ZMQ IP.",
"qTabAdvanced::SetCltZMQIP", this,

View File

@ -235,7 +235,7 @@ void qTabDataOutput::GetFileFormat() {
break;
default:
throw RuntimeError(std::string("Unknown file format: ") +
std::to_string(static_cast<int>(retval)));
std::to_string(static_cast<int>(retval)));
}
}
CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")

View File

@ -344,7 +344,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::TEMPERATURE_FPGA;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;
case slsDetectorDefs::GOTTHARD:
@ -371,7 +371,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::TEMPERATURE_FPGA;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;
@ -397,7 +397,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::TEMPERATURE_ADC;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;
@ -421,7 +421,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::IBIAS_SFP;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;
@ -463,7 +463,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::VTHRESHOLD;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;
@ -499,7 +499,7 @@ qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
return slsDetectorDefs::VCOM_ADC2;
default:
throw RuntimeError(std::string("Unknown dac/adc index") +
std::to_string(index));
std::to_string(index));
}
break;

View File

@ -339,7 +339,7 @@ void qTabMeasurement::GetTimingMode() {
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetTimingMode(int)));
try {
slsDetectorDefs::timingMode retval{slsDetectorDefs::AUTO_TIMING};
// m3: remove slave modes (always trigger) before squashing
if (det->getDetectorType().squash() == slsDetectorDefs::MYTHEN3) {
@ -373,7 +373,7 @@ void qTabMeasurement::GetTimingMode() {
break;
default:
throw RuntimeError(std::string("Unknown timing mode: ") +
std::to_string(retval));
std::to_string(retval));
}
}
CATCH_DISPLAY("Could not get timing mode.",
@ -410,7 +410,7 @@ void qTabMeasurement::GetBurstMode() {
break;
default:
throw RuntimeError(std::string("Unknown burst mode: ") +
std::to_string(retval));
std::to_string(retval));
}
}
CATCH_DISPLAY("Could not get burst mode.", "qTabMeasurement::GetBurstMode")

View File

@ -88,7 +88,7 @@ void qTabSettings::SetupWidgetWindow() {
} else if (detType == slsDetectorDefs::EIGER) {
lblSpinHV->show();
spinHV->show();
hvmin = 0;
hvmin = 0;
lblDynamicRange->setEnabled(true);
comboDynamicRange->setEnabled(true);
lblThreshold->setEnabled(true);
@ -103,11 +103,11 @@ void qTabSettings::SetupWidgetWindow() {
lblComboHV->show();
} else if (detType == slsDetectorDefs::MOENCH) {
lblSpinHV->show();
spinHV->show();
spinHV->show();
} else if (detType == slsDetectorDefs::GOTTHARD2) {
lblSpinHV->show();
spinHV->show();
hvmin = 0;
hvmin = 0;
}
// default settings for the disabled
@ -241,10 +241,10 @@ void qTabSettings::GetHighVoltage() {
try {
Result<int> retvals = det->getHighVoltage();
int retval = 0;
int retval = 0;
if (det->getDetectorType().squash() != slsDetectorDefs::EIGER) {
retval = retvals.tsquash("Inconsistent values for high voltage.");
}
}
// eiger slaves return -999
else {
@ -255,14 +255,15 @@ void qTabSettings::GetHighVoltage() {
master_retvals.push_back(retvals[i]);
}
}
retval = master_retvals.tsquash("Inconsistent values for high voltage.");
}
retval =
master_retvals.tsquash("Inconsistent values for high voltage.");
}
// spinHV
if (spinHV->isVisible()) {
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
std::to_string(retval));
}
spinHV->setValue(retval);
}
@ -292,12 +293,11 @@ void qTabSettings::GetHighVoltage() {
break;
default:
throw RuntimeError(std::string("Unknown High Voltage: ") +
std::to_string(retval));
std::to_string(retval));
}
}
}
CATCH_DISPLAY("Could not get high voltage.",
"qTabSettings::GetHighVoltage")
CATCH_DISPLAY("Could not get high voltage.", "qTabSettings::GetHighVoltage")
connect(spinHV, SIGNAL(valueChanged(int)), this, SLOT(SetHighVoltage()));
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
SLOT(SetHighVoltage()));
@ -332,7 +332,7 @@ void qTabSettings::GetSettings() {
default:
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
throw RuntimeError(std::string("Unknown settings: ") +
std::to_string(retval));
std::to_string(retval));
}
comboSettings->setCurrentIndex(retval);
break;
@ -367,7 +367,7 @@ void qTabSettings::GetGainMode() {
"Inconsistent gain mode for all detectors.");
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
throw RuntimeError(std::string("Unknown gain mode: ") +
std::to_string(retval));
std::to_string(retval));
}
// warning when using fix_g0 and not in export mode
if ((int)retval == FIX_G0 && !isVisibleFixG0) {
@ -438,7 +438,7 @@ void qTabSettings::GetDynamicRange() {
break;
default:
throw RuntimeError(std::string("Unknown dynamic range: ") +
std::to_string(retval));
std::to_string(retval));
}
}
CATCH_DISPLAY("Could not get dynamic range.",
@ -469,7 +469,7 @@ void qTabSettings::SetDynamicRange(int index) {
break;
default:
throw RuntimeError(std::string("Unknown dynamic range: ") +
std::to_string(index));
std::to_string(index));
}
}
CATCH_HANDLE("Could not set dynamic range.",
@ -515,8 +515,7 @@ void qTabSettings::SetThresholdEnergies() {
slsDetectorDefs::detectorSettings sett =
static_cast<slsDetectorDefs::detectorSettings>(
comboSettings->currentIndex());
LOG(logINFO) << "Setting Threshold Energies to " << ToString(eV)
<< " (eV)";
LOG(logINFO) << "Setting Threshold Energies to " << ToString(eV) << " (eV)";
try {
det->setThresholdEnergy(eV, sett);
}
@ -555,9 +554,8 @@ void qTabSettings::GetCounterMask() {
// if retval[i] = 2, chkCounter2 is checked
for (auto i : retval) {
if (i > 3) {
throw RuntimeError(
std::string("Unknown counter index : ") +
std::to_string(static_cast<int>(i)));
throw RuntimeError(std::string("Unknown counter index : ") +
std::to_string(static_cast<int>(i)));
}
counters[i]->setChecked(true);
}