mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-10 14:50:02 +02:00
clang format on gui
This commit is contained in:
parent
bd6529a64c
commit
9ede0629ef
8
slsDetectorGui/include/qCloneWidget.h
Executable file → Normal file
8
slsDetectorGui/include/qCloneWidget.h
Executable file → Normal file
@ -16,10 +16,10 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt1DPlot *gp1, SlsQt2DPlot *gp,
|
||||
QString title, QString filePath, QString fileName,
|
||||
int64_t aIndex, bool displayStats, QString min, QString max,
|
||||
QString sum);
|
||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||
QString filePath, QString fileName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum);
|
||||
|
||||
~qCloneWidget();
|
||||
|
||||
|
4
slsDetectorGui/include/qDacWidget.h
Executable file → Normal file
4
slsDetectorGui/include/qDacWidget.h
Executable file → Normal file
@ -11,7 +11,8 @@ class qDacWidget:public QWidget, private Ui::WidgetDacObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
qDacWidget(QWidget *parent, sls::Detector* detector, bool d, std::string n, slsDetectorDefs::dacIndex i);
|
||||
qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n,
|
||||
slsDetectorDefs::dacIndex i);
|
||||
~qDacWidget();
|
||||
void SetDetectorIndex(int id);
|
||||
|
||||
@ -30,4 +31,3 @@ private:
|
||||
slsDetectorDefs::dacIndex index;
|
||||
int detectorIndex{-1};
|
||||
};
|
||||
|
||||
|
67
slsDetectorGui/include/qDefs.h
Executable file → Normal file
67
slsDetectorGui/include/qDefs.h
Executable file → Normal file
@ -5,22 +5,28 @@
|
||||
#include <QAbstractButton>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
using std::chrono::duration;
|
||||
using std::chrono::duration_cast;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::hours;
|
||||
using std::chrono::microseconds;
|
||||
using std::chrono::milliseconds;
|
||||
using std::chrono::seconds;
|
||||
using std::chrono::minutes;
|
||||
using std::chrono::hours;
|
||||
using std::chrono::nanoseconds;
|
||||
using std::chrono::seconds;
|
||||
|
||||
#define CATCH_DISPLAY(m, s) catch(...) { qDefs::DisplayExceptions(m, s); }
|
||||
#define CATCH_HANDLE(...) catch(...) { qDefs::HandleExceptions(__VA_ARGS__); }
|
||||
#define CATCH_DISPLAY(m, s) \
|
||||
catch (...) { \
|
||||
qDefs::DisplayExceptions(m, s); \
|
||||
}
|
||||
#define CATCH_HANDLE(...) \
|
||||
catch (...) { \
|
||||
qDefs::HandleExceptions(__VA_ARGS__); \
|
||||
}
|
||||
|
||||
class qDefs : public QWidget {
|
||||
public:
|
||||
@ -47,8 +53,8 @@ class qDefs : public QWidget {
|
||||
|
||||
template <class CT> struct NonDeduced { using type = CT; };
|
||||
template <class S, typename RT, typename... CT>
|
||||
static void HandleExceptions(const std::string emsg, const std::string src, S* s,
|
||||
RT (S::*somefunc)(CT...),
|
||||
static void HandleExceptions(const std::string emsg, const std::string src,
|
||||
S *s, RT (S::*somefunc)(CT...),
|
||||
typename NonDeduced<CT>::type... Args) {
|
||||
try {
|
||||
throw;
|
||||
@ -74,13 +80,20 @@ class qDefs : public QWidget {
|
||||
|
||||
static const char *getQFunctionNameFromEnum(enum qFuncNames func) {
|
||||
switch (func) {
|
||||
case QF_GET_DETECTOR_STATUS: return "QF_GET_DETECTOR_STATUS";
|
||||
case QF_START_ACQUISITION: return "QF_START_ACQUISITION";
|
||||
case QF_STOP_ACQUISITION: return "QF_STOP_ACQUISITION";
|
||||
case QF_START_AND_READ_ALL: return "QF_START_AND_READ_ALL";
|
||||
case QF_EXIT_SERVER: return "QF_EXIT_SERVER";
|
||||
case QF_NUM_FUNCTIONS: return "QF_NUM_FUNCTIONS";
|
||||
default: return "Unknown Function";
|
||||
case QF_GET_DETECTOR_STATUS:
|
||||
return "QF_GET_DETECTOR_STATUS";
|
||||
case QF_START_ACQUISITION:
|
||||
return "QF_START_ACQUISITION";
|
||||
case QF_STOP_ACQUISITION:
|
||||
return "QF_STOP_ACQUISITION";
|
||||
case QF_START_AND_READ_ALL:
|
||||
return "QF_START_AND_READ_ALL";
|
||||
case QF_EXIT_SERVER:
|
||||
return "QF_EXIT_SERVER";
|
||||
case QF_NUM_FUNCTIONS:
|
||||
return "QF_NUM_FUNCTIONS";
|
||||
default:
|
||||
return "Unknown Function";
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,11 +124,16 @@ class qDefs : public QWidget {
|
||||
|
||||
static std::string getRangeAsString(enum range r) {
|
||||
switch (r) {
|
||||
case XMIN: return "XMIN";
|
||||
case XMAX: return "XMAX";
|
||||
case YMIN: return "YMIN";
|
||||
case YMAX: return "YMAX";
|
||||
default: return "Unknown";
|
||||
case XMIN:
|
||||
return "XMIN";
|
||||
case XMAX:
|
||||
return "XMAX";
|
||||
case YMIN:
|
||||
return "YMIN";
|
||||
case YMAX:
|
||||
return "YMAX";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
@ -190,7 +208,8 @@ class qDefs : public QWidget {
|
||||
MINUTES);
|
||||
}
|
||||
return std::make_pair(
|
||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(), HOURS);
|
||||
duration_cast<duration<double, std::ratio<3600>>>(tns).count(),
|
||||
HOURS);
|
||||
}
|
||||
|
||||
/** returns the value in ns */
|
||||
@ -299,7 +318,9 @@ class qDefs : public QWidget {
|
||||
static int ExceptionMessage(std::string message,
|
||||
std::string exceptionMessage,
|
||||
std::string source) {
|
||||
return Message(qDefs::WARNING, message + std::string("\nCaught exception:\n") + exceptionMessage, source);
|
||||
return Message(qDefs::WARNING,
|
||||
message + std::string("\nCaught exception:\n") +
|
||||
exceptionMessage,
|
||||
source);
|
||||
}
|
||||
|
||||
};
|
||||
|
3
slsDetectorGui/include/qDetectorMain.h
Executable file → Normal file
3
slsDetectorGui/include/qDetectorMain.h
Executable file → Normal file
@ -20,7 +20,8 @@ class qTabMessages;
|
||||
class QScrollArea;
|
||||
class QResizeEvent;
|
||||
|
||||
/** To Over-ride the QTabWidget class to get the tabBar protected methodTabWidget */
|
||||
/** To Over-ride the QTabWidget class to get the tabBar protected
|
||||
* methodTabWidget */
|
||||
class MyTabWidget : public QTabWidget {
|
||||
public:
|
||||
MyTabWidget(QWidget *parent = 0) { setParent(parent); }
|
||||
|
13
slsDetectorGui/include/qDrawPlot.h
Executable file → Normal file
13
slsDetectorGui/include/qDrawPlot.h
Executable file → Normal file
@ -78,11 +78,16 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
void SetupPlots();
|
||||
void GetStatistics(double &min, double &max, double &sum);
|
||||
void DetachHists();
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
|
||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
|
||||
static void GetAcquisitionFinishedCallBack(double currentProgress,
|
||||
int detectorStatus,
|
||||
void *this_pointer);
|
||||
static void GetDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex, void *this_pointer);
|
||||
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
||||
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
|
||||
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
|
||||
void GetData(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex);
|
||||
void toDoublePixelData(double *dest, char *source, int size, int databytes,
|
||||
int dr, double *gaindest = NULL);
|
||||
void Get1dData(double *rawData);
|
||||
void Get2dData(double *rawData);
|
||||
void Update1dPlot();
|
||||
|
2
slsDetectorGui/include/qTabAdvanced.h
Executable file → Normal file
2
slsDetectorGui/include/qTabAdvanced.h
Executable file → Normal file
@ -65,5 +65,3 @@ private:
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
};
|
||||
|
||||
|
||||
|
6
slsDetectorGui/include/qTabDataOutput.h
Executable file → Normal file
6
slsDetectorGui/include/qTabDataOutput.h
Executable file → Normal file
@ -42,9 +42,5 @@ public:
|
||||
// Button group for radiobuttons for rate
|
||||
QButtonGroup *btnGroupRate;
|
||||
// enum for the Eiger Parallel flag
|
||||
enum {
|
||||
PARALLEL,
|
||||
NONPARALLEL
|
||||
enum { PARALLEL, NONPARALLEL };
|
||||
};
|
||||
};
|
||||
|
||||
|
1
slsDetectorGui/include/qTabDebugging.h
Executable file → Normal file
1
slsDetectorGui/include/qTabDebugging.h
Executable file → Normal file
@ -33,4 +33,3 @@ private:
|
||||
QLabel *lblDetectorFirmware;
|
||||
QLabel *lblDetectorSoftware;
|
||||
};
|
||||
|
||||
|
14
slsDetectorGui/include/qTabDeveloper.h
Executable file → Normal file
14
slsDetectorGui/include/qTabDeveloper.h
Executable file → Normal file
@ -27,23 +27,15 @@ private:
|
||||
void Initialization();
|
||||
void PopulateDetectors();
|
||||
void GetHighVoltage();
|
||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType, int index);
|
||||
slsDetectorDefs::dacIndex getSLSIndex(slsDetectorDefs::detectorType detType,
|
||||
int index);
|
||||
|
||||
sls::Detector *det;
|
||||
std::vector<qDacWidget *> dacWidgets;
|
||||
std::vector<qDacWidget *> adcWidgets;
|
||||
|
||||
enum hvVals {
|
||||
HV_0,
|
||||
HV_90,
|
||||
HV_110,
|
||||
HV_120,
|
||||
HV_150,
|
||||
HV_180,
|
||||
HV_200
|
||||
};
|
||||
enum hvVals { HV_0, HV_90, HV_110, HV_120, HV_150, HV_180, HV_200 };
|
||||
int hvmin;
|
||||
static const int HV_MIN = 60;
|
||||
static const int HV_MAX = 200;
|
||||
};
|
||||
|
||||
|
9
slsDetectorGui/include/qTabMeasurement.h
Executable file → Normal file
9
slsDetectorGui/include/qTabMeasurement.h
Executable file → Normal file
@ -74,17 +74,12 @@ private:
|
||||
signals:
|
||||
void EnableTabsSignal(bool);
|
||||
void FileNameChangedSignal(QString);
|
||||
|
||||
private:
|
||||
sls::Detector *det;
|
||||
qDrawPlot *plot;
|
||||
// enum for the timing mode
|
||||
enum{
|
||||
AUTO,
|
||||
TRIGGER,
|
||||
GATED,
|
||||
BURST_TRIGGER,
|
||||
NUMTIMINGMODES
|
||||
};
|
||||
enum { AUTO, TRIGGER, GATED, BURST_TRIGGER, NUMTIMINGMODES };
|
||||
QTimer *progressTimer;
|
||||
// tool tip variables
|
||||
QString acqPeriodTip;
|
||||
|
1
slsDetectorGui/include/qTabMessages.h
Executable file → Normal file
1
slsDetectorGui/include/qTabMessages.h
Executable file → Normal file
@ -33,4 +33,3 @@ private:
|
||||
QProcess *process;
|
||||
QStringList lastCommand;
|
||||
};
|
||||
|
||||
|
2
slsDetectorGui/include/qTabPlot.h
Executable file → Normal file
2
slsDetectorGui/include/qTabPlot.h
Executable file → Normal file
@ -59,5 +59,3 @@ private:
|
||||
static QString defaultImageYAxisTitle;
|
||||
static QString defaultImageZAxisTitle;
|
||||
};
|
||||
|
||||
|
||||
|
7
slsDetectorGui/include/qTabSettings.h
Executable file → Normal file
7
slsDetectorGui/include/qTabSettings.h
Executable file → Normal file
@ -53,10 +53,5 @@ private:
|
||||
UNINITIALIZED,
|
||||
NUMSETTINGS
|
||||
};
|
||||
enum {
|
||||
DYNAMICRANGE_32,
|
||||
DYNAMICRANGE_16,
|
||||
DYNAMICRANGE_8,
|
||||
DYNAMICRANGE_4
|
||||
};
|
||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||
};
|
||||
|
50
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Executable file → Normal file
50
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DPlot.h
Executable file → Normal file
@ -3,31 +3,26 @@
|
||||
* @author Ian Johnson
|
||||
* @version 1.0
|
||||
* Modifications:
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in and out
|
||||
* without using mouse control:
|
||||
* DisableZoom,
|
||||
* SetXMinMax,SetYMinMax,
|
||||
* 19.06.2012: {Some functions have been added by Dhanya to enable zooming in
|
||||
* and out without using mouse control: DisableZoom, SetXMinMax,SetYMinMax,
|
||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||
* */
|
||||
|
||||
#ifndef SLSQT1DPLOT_H
|
||||
#define SLSQT1DPLOT_H
|
||||
|
||||
|
||||
typedef double double32_t;
|
||||
typedef float float32_t;
|
||||
typedef int int32_t;
|
||||
|
||||
#include "ansi.h"
|
||||
|
||||
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_plot_marker.h>
|
||||
#include <qwt_scale_div.h>
|
||||
#include "SlsQt1DZoomer.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class QPen;
|
||||
class SlsQt1DPlot;
|
||||
@ -71,8 +66,6 @@ class SlsQtH1D:public QwtPlotCurve{
|
||||
|
||||
SlsQtH1D *Add(double v);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
int ndata;
|
||||
int n_array;
|
||||
@ -87,7 +80,6 @@ class SlsQtH1D:public QwtPlotCurve{
|
||||
QPen *pen_ptr{nullptr};
|
||||
};
|
||||
|
||||
|
||||
class SlsQtH1DList {
|
||||
public:
|
||||
SlsQtH1DList(SlsQtH1D *hist = 0);
|
||||
@ -100,13 +92,11 @@ class SlsQtH1DList{
|
||||
SlsQtH1D *Hist() { return the_hist; } // if no hist returns 0
|
||||
SlsQtH1DList *Next() { return the_next; }
|
||||
|
||||
|
||||
private:
|
||||
SlsQtH1DList *the_next;
|
||||
SlsQtH1D *the_hist;
|
||||
};
|
||||
|
||||
|
||||
class SlsQt1DPlot : public QwtPlot {
|
||||
Q_OBJECT
|
||||
|
||||
@ -126,31 +116,41 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void InsertVLine(double v);
|
||||
void RemoveVLine();
|
||||
|
||||
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be able to
|
||||
use zooming functionality without mouse control*/
|
||||
/** This group of functions have been added by Dhanya on 19.06.2012 to be
|
||||
able to use zooming functionality without mouse control*/
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() {setAxisAutoScale(QwtPlot::xBottom, true);Update();};
|
||||
void EnableYAutoScaling() {setAxisAutoScale(QwtPlot::yLeft, true);Update();};
|
||||
void EnableXAutoScaling() {
|
||||
setAxisAutoScale(QwtPlot::xBottom, true);
|
||||
Update();
|
||||
};
|
||||
void EnableYAutoScaling() {
|
||||
setAxisAutoScale(QwtPlot::yLeft, true);
|
||||
Update();
|
||||
};
|
||||
void SetYStep(int step) { ystep = step; };
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
void SetXMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::xBottom, min, max);
|
||||
};
|
||||
void SetYMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::yLeft, min, max);
|
||||
};
|
||||
double GetXMinimum() { return hist_list->Hist()->GetXMin(); };
|
||||
double GetXMaximum() { return hist_list->Hist()->GetXMax(); };
|
||||
double GetYMinimum() { return hist_list->Hist()->GetYMin(); };
|
||||
double GetYMaximum() { return hist_list->Hist()->GetYMax(); };
|
||||
/**---*/
|
||||
|
||||
|
||||
void SetZoom(double xmin, double ymin, double x_width, double y_width);
|
||||
void SetZoomBase(double xmin,double ymin,double x_width, double y_width){ zoomer->SetZoomBase(xmin,ymin,x_width,y_width);}
|
||||
void SetZoomBase(double xmin, double ymin, double x_width, double y_width) {
|
||||
zoomer->SetZoomBase(xmin, ymin, x_width, y_width);
|
||||
}
|
||||
|
||||
void alignScales();
|
||||
|
||||
void SetLogX(bool yes = 1);
|
||||
void SetLogY(bool yes = 1);
|
||||
private:
|
||||
|
||||
private:
|
||||
SlsQtH1DList *hist_list{nullptr};
|
||||
SlsQt1DZoomer *zoomer{nullptr};
|
||||
QwtPlotPanner *panner{nullptr};
|
||||
@ -173,11 +173,9 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
friend void SlsQtH1D::Attach(SlsQt1DPlot *p);
|
||||
friend void SlsQtH1D::Detach(SlsQt1DPlot *p);
|
||||
|
||||
|
||||
public slots:
|
||||
void UnZoom();
|
||||
void Update();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
7
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Executable file → Normal file
7
slsDetectorGui/slsDetectorPlotting/include/SlsQt1DZoomer.h
Executable file → Normal file
@ -7,9 +7,9 @@
|
||||
#ifndef SLSQT1DZOOMER_H
|
||||
#define SLSQT1DZOOMER_H
|
||||
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_global.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
|
||||
class SlsQtH1D;
|
||||
|
||||
@ -43,8 +43,6 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
bool SetLogX(bool yes) { return xIsLog = yes; }
|
||||
bool SetLogY(bool yes) { return yIsLog = yes; }
|
||||
|
||||
|
||||
|
||||
using QwtPlotPicker::trackerText;
|
||||
virtual QwtText trackerText(const QPoint &pos) const {
|
||||
|
||||
@ -54,7 +52,6 @@ class SlsQt1DZoomer:public QwtPlotZoomer{
|
||||
text.setBackgroundBrush(QBrush(bg));
|
||||
return text;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
53
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Executable file → Normal file
53
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DHist.h
Executable file → Normal file
@ -4,24 +4,20 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DHIST_H
|
||||
#define SLSQT2DHIST_H
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x040000
|
||||
#include <qprintdialog.h>
|
||||
#endif
|
||||
#include <qwt_color_map.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include <qwt_scale_draw.h>
|
||||
|
||||
#include <qwt_scale_widget.h>
|
||||
|
||||
class SlsQt2DHist : public QwtRasterData {
|
||||
|
||||
private:
|
||||
|
||||
double x_min, x_max, y_min, y_max;
|
||||
double x_width, y_width;
|
||||
|
||||
@ -34,12 +30,15 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
|
||||
bool interp;
|
||||
|
||||
static double value_between_points(double p1,double v1,double p2,double v2,double p){ //linear extrap
|
||||
static double value_between_points(double p1, double v1, double p2,
|
||||
double v2, double p) { // linear extrap
|
||||
return (v2 - v1) / (p2 - p1) * (p - p1) + v1;
|
||||
}
|
||||
|
||||
public:
|
||||
SlsQt2DHist(int nbinsx=10, double xmin=0, double xmax=10, int nbinsy=10, double ymin=0, double ymax=10, double* d=0,double zmin=0,double zmax=-1);
|
||||
SlsQt2DHist(int nbinsx = 10, double xmin = 0, double xmax = 10,
|
||||
int nbinsy = 10, double ymin = 0, double ymax = 10,
|
||||
double *d = 0, double zmin = 0, double zmax = -1);
|
||||
virtual ~SlsQt2DHist();
|
||||
|
||||
double GetXMin() { return x_min; }
|
||||
@ -60,7 +59,8 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
|
||||
void Interpolate(bool on = 1) { interp = on; }
|
||||
void SetBinValue(int bx, int by, double v);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1);
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||
double ymax, double *d, double zmin = 0, double zmax = -1);
|
||||
|
||||
double SetMinimumToFirstGreaterThanZero();
|
||||
void SetMinimum(double zmin) { z_min = zmin; }
|
||||
@ -69,15 +69,13 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
|
||||
int FindBinIndex(double x, double y);
|
||||
|
||||
|
||||
|
||||
virtual QwtRasterData *copy() const {
|
||||
// this function does not create a new SlsQt2DHistData instance,
|
||||
//just passes a pointer so that data is common to both the copy and the original instance
|
||||
// just passes a pointer so that data is common to both the copy and the
|
||||
// original instance
|
||||
return (QwtRasterData *)this;
|
||||
}
|
||||
|
||||
|
||||
virtual QwtInterval range() const { return QwtInterval(z_min, z_max); }
|
||||
virtual QwtInterval interval(Qt::Axis axis) const {
|
||||
switch (axis) {
|
||||
@ -92,21 +90,26 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
virtual double value(double x, double y) const {
|
||||
// if(!interp){ //default is box like plot
|
||||
int index = int((x-x_min)/x_width) + int((y-y_min)/y_width)*nx;
|
||||
if(index<0||index>nb) index = nb;
|
||||
if(!interp) return data[index];
|
||||
int index =
|
||||
int((x - x_min) / x_width) + int((y - y_min) / y_width) * nx;
|
||||
if (index < 0 || index > nb)
|
||||
index = nb;
|
||||
if (!interp)
|
||||
return data[index];
|
||||
//}
|
||||
|
||||
|
||||
int x_int = int((x - x_min) / x_width - 0.5);
|
||||
if(x_int<0) x_int = 0; else if(x_int>nx-2) x_int = nx-2;
|
||||
if (x_int < 0)
|
||||
x_int = 0;
|
||||
else if (x_int > nx - 2)
|
||||
x_int = nx - 2;
|
||||
int y_int = int((y - y_min) / y_width - 0.5);
|
||||
if(y_int<0) y_int = 0; else if(y_int>ny-2) y_int = ny-2;
|
||||
if (y_int < 0)
|
||||
y_int = 0;
|
||||
else if (y_int > ny - 2)
|
||||
y_int = ny - 2;
|
||||
|
||||
int b00 = x_int * ny + y_int;
|
||||
int b01 = x_int * ny + y_int + 1;
|
||||
@ -120,16 +123,12 @@ class SlsQt2DHist: public QwtRasterData{
|
||||
double right_v = value_between_points(y0, data[b10], y1, data[b11], y);
|
||||
// horazontal extrap
|
||||
|
||||
|
||||
|
||||
return 0.5;
|
||||
|
||||
|
||||
return value_between_points(x_min + (x_int + 0.5) * x_width, left_v,
|
||||
x_min+(x_int+1.5)*x_width,right_v,x);
|
||||
x_min + (x_int + 1.5) * x_width, right_v,
|
||||
x);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
27
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Executable file → Normal file
27
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DPlot.h
Executable file → Normal file
@ -1,20 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
#include <qwt_plot.h>
|
||||
#include <qlist.h>
|
||||
#include <qwt_plot.h>
|
||||
#include <qwt_plot_spectrogram.h>
|
||||
|
||||
#include "SlsQt2DZoomer.h"
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
#include "SlsQt2DZoomer.h"
|
||||
|
||||
class QwtPlotPanner;
|
||||
class QwtScaleWidget;
|
||||
class QwtLinearColorMap;
|
||||
|
||||
|
||||
class SlsQt2DPlot : public QwtPlot {
|
||||
Q_OBJECT
|
||||
|
||||
@ -35,8 +31,12 @@ public:
|
||||
void DisableZoom(bool disable);
|
||||
void EnableXAutoScaling() { setAxisAutoScale(QwtPlot::xBottom, true); };
|
||||
void EnableYAutoScaling() { setAxisAutoScale(QwtPlot::yLeft, true); };
|
||||
void SetXMinMax(double min,double max){setAxisScale(QwtPlot::xBottom,min,max);};
|
||||
void SetYMinMax(double min,double max){setAxisScale(QwtPlot::yLeft,min,max);};
|
||||
void SetXMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::xBottom, min, max);
|
||||
};
|
||||
void SetYMinMax(double min, double max) {
|
||||
setAxisScale(QwtPlot::yLeft, min, max);
|
||||
};
|
||||
double GetXMinimum() { return hist->GetXMin(); };
|
||||
double GetXMaximum() { return hist->GetXMax(); };
|
||||
double GetYMinimum() { return hist->GetYMin(); };
|
||||
@ -44,10 +44,13 @@ public:
|
||||
double GetZMinimum() { return hist->GetMinimum(); }
|
||||
double GetZMaximum() { return hist->GetMaximum(); }
|
||||
void SetZMinMax(double zmin = 0, double zmax = -1);
|
||||
void SetZMinimumToFirstGreaterThanZero(){hist->SetMinimumToFirstGreaterThanZero();}
|
||||
void SetZMinimumToFirstGreaterThanZero() {
|
||||
hist->SetMinimumToFirstGreaterThanZero();
|
||||
}
|
||||
double GetZMean() { return hist->GetMean(); }
|
||||
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax,double *d,double zmin=0, double zmax=-1){
|
||||
void SetData(int nbinsx, double xmin, double xmax, int nbinsy, double ymin,
|
||||
double ymax, double *d, double zmin = 0, double zmax = -1) {
|
||||
hist->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||
}
|
||||
|
||||
@ -65,12 +68,9 @@ public:
|
||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||
void LogZ(bool on = 1);
|
||||
|
||||
|
||||
|
||||
public slots:
|
||||
void showSpectrogram(bool on);
|
||||
|
||||
|
||||
private:
|
||||
void SetupZoom();
|
||||
void SetupColorMap();
|
||||
@ -90,4 +90,3 @@ private:
|
||||
bool disableZoom{false};
|
||||
int isLog;
|
||||
};
|
||||
|
||||
|
22
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Executable file → Normal file
22
slsDetectorGui/slsDetectorPlotting/include/SlsQt2DZoomer.h
Executable file → Normal file
@ -5,18 +5,16 @@
|
||||
* Dhanya-05.12.2012- included an additional header
|
||||
*/
|
||||
|
||||
|
||||
#ifndef SLSQT2DZOOMER_H
|
||||
#define SLSQT2DZOOMER_H
|
||||
|
||||
|
||||
|
||||
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest gcc*/
|
||||
/**included by Dhanya on 05.12.2012 to avoid compile time errors with the latest
|
||||
* gcc*/
|
||||
#include <cstdio>
|
||||
/**end of Change by Dhanya*/
|
||||
|
||||
#include <qwt_plot_zoomer.h>
|
||||
#include <qwt_plot_panner.h>
|
||||
#include <qwt_plot_zoomer.h>
|
||||
|
||||
#include "SlsQt2DHist.h"
|
||||
|
||||
@ -25,36 +23,28 @@ class SlsQt2DZoomer:public QwtPlotZoomer{
|
||||
SlsQt2DHist *hist;
|
||||
|
||||
public:
|
||||
|
||||
SlsQt2DZoomer(QWidget *canvas) : QwtPlotZoomer(canvas) {
|
||||
setTrackerMode(AlwaysOn);
|
||||
}
|
||||
|
||||
void SetHist(SlsQt2DHist* h){
|
||||
hist=h;
|
||||
}
|
||||
|
||||
|
||||
void SetHist(SlsQt2DHist *h) { hist = h; }
|
||||
|
||||
virtual QwtText trackerTextF(const QPointF &pos) const {
|
||||
QColor bg(Qt::white);
|
||||
bg.setAlpha(200);
|
||||
|
||||
|
||||
|
||||
// QwtText text = QwtPlotZoomer::trackerText(pos);
|
||||
|
||||
static QwtText text;
|
||||
if (hist) {
|
||||
static char t[200];
|
||||
sprintf(t,"%3.2f, %3.2f, %3.2f",pos.x(),pos.y(),hist->value(pos.x(),pos.y()));
|
||||
sprintf(t, "%3.2f, %3.2f, %3.2f", pos.x(), pos.y(),
|
||||
hist->value(pos.x(), pos.y()));
|
||||
text.setText(t);
|
||||
} else {
|
||||
|
||||
QPoint p = pos.toPoint();
|
||||
QwtText text = QwtPlotZoomer::trackerText(p);
|
||||
|
||||
|
||||
}
|
||||
text.setBackgroundBrush(QBrush(bg));
|
||||
return text;
|
||||
|
82
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Executable file → Normal file
82
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DPlot.cxx
Executable file → Normal file
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "qwt_symbol.h"
|
||||
#include <iostream>
|
||||
#include <qwt_legend.h>
|
||||
#include <qwt_math.h>
|
||||
@ -14,19 +15,18 @@
|
||||
#include <qwt_scale_draw.h>
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
#include "qwt_symbol.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm
|
||||
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data) : QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double min, double max, double *data)
|
||||
: QwtPlotCurve(title), x(nullptr), y(nullptr), pen_ptr(nullptr) {
|
||||
Initailize();
|
||||
SetData(n, min, max, data);
|
||||
}
|
||||
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y) : QwtPlotCurve(title) {
|
||||
SlsQtH1D::SlsQtH1D(QString title, int n, double *data_x, double *data_y)
|
||||
: QwtPlotCurve(title) {
|
||||
Initailize();
|
||||
SetData(n, data_x, data_y);
|
||||
}
|
||||
@ -139,7 +139,6 @@ void SlsQtH1D::setSymbolMarkers(bool isMarker) {
|
||||
marker->setSize(5, 5);
|
||||
}
|
||||
setSymbol(marker);
|
||||
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
@ -170,9 +169,7 @@ void SlsQtH1D::SetData(int n, double xmin, double xmax, double *data) {
|
||||
firstYgt0 = y[i];
|
||||
}
|
||||
|
||||
|
||||
setRawSamples(x, y, ndata);
|
||||
|
||||
}
|
||||
|
||||
void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
@ -202,7 +199,6 @@ void SlsQtH1D::SetData(int n, double *data_x, double *data_y) {
|
||||
firstYgt0 = y[b];
|
||||
}
|
||||
setRawSamples(x, y, ndata);
|
||||
|
||||
}
|
||||
|
||||
int SlsQtH1D::SetUpArrays(int n) {
|
||||
@ -225,7 +221,9 @@ double SlsQtH1D::FillBin(int bx, double v) {
|
||||
bx = CheckIndex(bx);
|
||||
return SetBinContent(bx, y[bx] + v);
|
||||
}
|
||||
double SlsQtH1D::Fill(double x, double v) { return FillBin(FindBinIndex(x), v); }
|
||||
double SlsQtH1D::Fill(double x, double v) {
|
||||
return FillBin(FindBinIndex(x), v);
|
||||
}
|
||||
|
||||
double SlsQtH1D::SetBinContent(int bx, double v) {
|
||||
bx = CheckIndex(bx);
|
||||
@ -241,7 +239,9 @@ double SlsQtH1D::SetBinContent(int bx, double v) {
|
||||
return y[bx];
|
||||
}
|
||||
|
||||
double SlsQtH1D::SetContent(double x, double v) { return SetBinContent(FindBinIndex(x), v); }
|
||||
double SlsQtH1D::SetContent(double x, double v) {
|
||||
return SetBinContent(FindBinIndex(x), v);
|
||||
}
|
||||
|
||||
int SlsQtH1D::FindBinIndex(double px) {
|
||||
if (dx > 0)
|
||||
@ -261,7 +261,9 @@ int SlsQtH1D::FindBinIndex(double px) {
|
||||
return b;
|
||||
}
|
||||
|
||||
int SlsQtH1D::CheckIndex(int bx) { return (bx < 0 || bx > ndata) ? ndata : bx; } //ndata is the overflow bin
|
||||
int SlsQtH1D::CheckIndex(int bx) {
|
||||
return (bx < 0 || bx > ndata) ? ndata : bx;
|
||||
} // ndata is the overflow bin
|
||||
|
||||
SlsQtH1D *SlsQtH1D::Add(double v) {
|
||||
for (int bx = 0; bx < ndata; bx++)
|
||||
@ -275,10 +277,7 @@ SlsQtH1DList::SlsQtH1DList(SlsQtH1D *hist) {
|
||||
the_next = 0;
|
||||
}
|
||||
|
||||
SlsQtH1DList::~SlsQtH1DList() {
|
||||
|
||||
delete the_next;
|
||||
}
|
||||
SlsQtH1DList::~SlsQtH1DList() { delete the_next; }
|
||||
|
||||
SlsQtH1D *SlsQtH1DList::Add(SlsQtH1D *hist) {
|
||||
SlsQtH1DList *hl = this;
|
||||
@ -304,7 +303,8 @@ void SlsQtH1DList::Print() {
|
||||
SlsQtH1DList *hl = this;
|
||||
int i = 0;
|
||||
while (hl) {
|
||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " " << hl->the_next << '\n';
|
||||
std::cout << " " << i++ << ") " << hl << " " << hl->the_hist << " "
|
||||
<< hl->the_next << '\n';
|
||||
hl = hl->the_next;
|
||||
if (i > 10)
|
||||
break;
|
||||
@ -389,13 +389,9 @@ void SlsQt1DPlot::HistogramDetached(SlsQtH1D *h) {
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::Update() {
|
||||
replot();
|
||||
}
|
||||
void SlsQt1DPlot::Update() { replot(); }
|
||||
|
||||
void SlsQt1DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
void SlsQt1DPlot::SetTitle(QString title) { setTitle(title); }
|
||||
|
||||
void SlsQt1DPlot::SetXTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::xBottom, title);
|
||||
@ -434,7 +430,8 @@ void SlsQt1DPlot::SetLog(int axisId, bool yes) {
|
||||
|
||||
zoomer->ResetZoomBase(); // needs to be done before setting Engine
|
||||
|
||||
//the old ones are deleted by in the setAxisScaleFunction() function see: 128 of file qwt_plot_axis.cpp
|
||||
// the old ones are deleted by in the setAxisScaleFunction() function see:
|
||||
// 128 of file qwt_plot_axis.cpp
|
||||
if (yes)
|
||||
setAxisScaleEngine(axisId, new QwtLog10ScaleEngine());
|
||||
else
|
||||
@ -450,11 +447,13 @@ void SlsQt1DPlot::UnZoom() {
|
||||
setAxisScale(QwtPlot::xBottom, zoomer->x(), zoomer->x() + zoomer->w());
|
||||
setAxisScale(QwtPlot::yLeft, zoomer->y(), zoomer->y() + zoomer->h());
|
||||
|
||||
zoomer->setZoomBase(); //Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
zoomer->setZoomBase(); // Call replot for the attached plot before
|
||||
// initializing the zoomer with its scales.
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
||||
void SlsQt1DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
setAxisScale(QwtPlot::xBottom, xmin, xmin + x_width);
|
||||
setAxisScale(QwtPlot::yLeft, ymin, ymin + y_width);
|
||||
Update();
|
||||
@ -503,9 +502,11 @@ void SlsQt1DPlot::SetupZoom() {
|
||||
zoomer = new SlsQt1DZoomer(canvas());
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
|
||||
@ -546,32 +547,39 @@ void SlsQt1DPlot::alignScales() {
|
||||
|
||||
void SlsQt1DPlot::UnknownStuff() {
|
||||
// We don't need the cache here
|
||||
((QwtPlotCanvas *)canvas())->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
((QwtPlotCanvas *)canvas())
|
||||
->setPaintAttribute(QwtPlotCanvas::BackingStore, false);
|
||||
#ifdef Q_WS_X11
|
||||
// Qt::WA_PaintOnScreen is only supported for X11, but leads
|
||||
// to substantial bugs with Qt 4.2.x/Windows
|
||||
canvas()->setAttribute(Qt::WA_PaintOnScreen, true);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range has been set
|
||||
// Added by Dhanya on 19.06.2012 to disable zooming when any of the axes range
|
||||
// has been set
|
||||
void SlsQt1DPlot::DisableZoom(bool disable) {
|
||||
if (disableZoom != disable) {
|
||||
disableZoom = disable;
|
||||
if (disable) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::NoButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::NoButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::NoButton);
|
||||
} else {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::LeftButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
|
54
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file → Normal file
54
slsDetectorGui/slsDetectorPlotting/src/SlsQt1DZoomer.cxx
Executable file → Normal file
@ -4,7 +4,6 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <qwt_plot.h>
|
||||
@ -13,29 +12,36 @@
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt1DZoomer.h"
|
||||
|
||||
|
||||
void SlsQt1DZoomer::ResetZoomBase() {
|
||||
SetZoomBase(x0,y0,x1-x0,y1-y0); //for going between log and nonlog plots
|
||||
SetZoomBase(x0, y0, x1 - x0,
|
||||
y1 - y0); // for going between log and nonlog plots
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y_width){
|
||||
void SlsQt1DZoomer::SetZoomBase(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
if (xIsLog && xmin <= 0) {
|
||||
double xmax = xmin + x_width;
|
||||
xmin = firstXgt0 * 0.98;
|
||||
if(xmax<=xmin) x_width=firstXgt0;
|
||||
else x_width=xmax-xmin;
|
||||
if (xmax <= xmin)
|
||||
x_width = firstXgt0;
|
||||
else
|
||||
x_width = xmax - xmin;
|
||||
}
|
||||
if (yIsLog && ymin <= 0) {
|
||||
double ymax = ymin + y_width;
|
||||
ymin = firstYgt0 * 0.98;
|
||||
if(ymax<=ymin) y_width=firstYgt0;
|
||||
else y_width=ymax-ymin;
|
||||
if (ymax <= ymin)
|
||||
y_width = firstYgt0;
|
||||
else
|
||||
y_width = ymax - ymin;
|
||||
}
|
||||
|
||||
if (plot()) {
|
||||
if (xIsLog) {
|
||||
double xmin_curr = plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr = plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
double xmin_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::xBottom).lowerBound();
|
||||
double xmax_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::xBottom).upperBound();
|
||||
if (xmin_curr < xmin)
|
||||
xmin_curr = xmin;
|
||||
if (xmax_curr > xmin + x_width)
|
||||
@ -43,8 +49,10 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
|
||||
plot()->setAxisScale(QwtPlot::xBottom, xmin_curr, xmax_curr);
|
||||
}
|
||||
if (yIsLog) {
|
||||
double ymin_curr = plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr = plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
double ymin_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::yLeft).lowerBound();
|
||||
double ymax_curr =
|
||||
plot()->axisScaleDiv(QwtPlot::yLeft).upperBound();
|
||||
if (ymin_curr < ymin)
|
||||
ymin_curr = ymin;
|
||||
if (ymax_curr > ymin + y_width)
|
||||
@ -54,7 +62,6 @@ void SlsQt1DZoomer::SetZoomBase(double xmin,double ymin,double x_width, double y
|
||||
plot()->replot();
|
||||
}
|
||||
setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
|
||||
}
|
||||
|
||||
void SlsQt1DZoomer::SetZoomBase(SlsQtH1D *h) {
|
||||
@ -75,16 +82,19 @@ void SlsQt1DZoomer::ExtendZoomBase(SlsQtH1D* h){
|
||||
double h_y0 = h->GetYMin() < 0 ? h->GetYMin() * 1.02 : h->GetYMin() / 1.02;
|
||||
double h_y1 = h->GetYMax() < 0 ? h->GetYMax() / 1.02 : h->GetYMax() * 1.02;
|
||||
|
||||
if(h_x0<x0) x0 = h_x0;
|
||||
if(h_x1>x1) x1 = h_x1;
|
||||
if(h_y0<y0) y0 = h_y0;
|
||||
if(h_y1>y1) y1 = h_y1;
|
||||
if (h_x0 < x0)
|
||||
x0 = h_x0;
|
||||
if (h_x1 > x1)
|
||||
x1 = h_x1;
|
||||
if (h_y0 < y0)
|
||||
y0 = h_y0;
|
||||
if (h_y1 > y1)
|
||||
y1 = h_y1;
|
||||
|
||||
if(h->GetFirstXgtZero()<firstXgt0) firstXgt0 = h->GetFirstXgtZero();
|
||||
if(h->GetFirstYgtZero()<firstYgt0) firstYgt0 = h->GetFirstYgtZero();
|
||||
if (h->GetFirstXgtZero() < firstXgt0)
|
||||
firstXgt0 = h->GetFirstXgtZero();
|
||||
if (h->GetFirstYgtZero() < firstYgt0)
|
||||
firstYgt0 = h->GetFirstYgtZero();
|
||||
|
||||
ResetZoomBase();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
68
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file → Normal file
68
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DHist.cxx
Executable file → Normal file
@ -4,28 +4,36 @@
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#include "ansi.h"
|
||||
#include <iostream>
|
||||
#include <cmath>
|
||||
#include "SlsQt2DHist.h"
|
||||
#include "ansi.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
|
||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double* d,double zmin,double zmax):QwtRasterData(){
|
||||
x_min=0;x_max=0;y_min=0;y_max=0;
|
||||
SlsQt2DHist::SlsQt2DHist(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||
double ymin, double ymax, double *d, double zmin,
|
||||
double zmax)
|
||||
: QwtRasterData() {
|
||||
x_min = 0;
|
||||
x_max = 0;
|
||||
y_min = 0;
|
||||
y_max = 0;
|
||||
interp = 0;
|
||||
nx_array=ny_array=0;data=0;
|
||||
nx_array = ny_array = 0;
|
||||
data = 0;
|
||||
SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d, zmin, zmax);
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DHist::~SlsQt2DHist() { delete[] data; }
|
||||
|
||||
int SlsQt2DHist::GetBinIndex(int bx, int by) {
|
||||
int b = bx * ny + by;
|
||||
if (b < 0 || b >= nb) {
|
||||
cout<<"GetBinIndex:: Incorrect indicies bx and by returning overflow bin;"<<endl;
|
||||
cout << "GetBinIndex:: Incorrect indicies bx and by returning overflow "
|
||||
"bin;"
|
||||
<< endl;
|
||||
return nb;
|
||||
}
|
||||
return b;
|
||||
@ -39,28 +47,34 @@ double SlsQt2DHist::GetBinValue(int bx,int by){
|
||||
return data[GetBinIndex(bx, by)];
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DHist::SetBinValue(int bx, int by, double v) {
|
||||
z_mean_has_been_calculated = 0;
|
||||
data[GetBinIndex(bx, by)] = v;
|
||||
}
|
||||
|
||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,double ymin, double ymax, double *d,double zmin,double zmax){
|
||||
void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,
|
||||
double ymin, double ymax, double *d, double zmin,
|
||||
double zmax) {
|
||||
z_mean_has_been_calculated = 0;
|
||||
if(xmax<xmin||ymax<ymin) cout<<"Warning input range invalid."<<endl;
|
||||
if (xmax < xmin || ymax < ymin)
|
||||
cout << "Warning input range invalid." << endl;
|
||||
|
||||
x_width = (xmax - xmin) / nbinsx;
|
||||
y_width = (ymax - ymin) / nbinsy;
|
||||
|
||||
if (x_min != xmin || x_max != xmax || y_min != ymin || y_max != ymax) {
|
||||
x_min=xmin;x_max=xmax;
|
||||
y_min=ymin;y_max=ymax;
|
||||
x_min = xmin;
|
||||
x_max = xmax;
|
||||
y_min = ymin;
|
||||
y_max = ymax;
|
||||
setInterval(Qt::XAxis, QwtInterval(xmin, xmax));
|
||||
setInterval(Qt::YAxis, QwtInterval(ymin, ymax));
|
||||
}
|
||||
|
||||
if (nbinsx * nbinsy < 1) {
|
||||
cout<<"Exitting: SlsQt2DHist::SetData() number of bins must be greater than zero."<<endl;
|
||||
cout << "Exitting: SlsQt2DHist::SetData() number of bins must be "
|
||||
"greater than zero."
|
||||
<< endl;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -91,13 +105,21 @@ void SlsQt2DHist::SetMinMax(double zmin,double zmax){
|
||||
z_mean = 0;
|
||||
z_max = data[0];
|
||||
for (int i = 0; i < nb; i++) {
|
||||
if(data[i]<z_min) z_min=data[i];
|
||||
if(data[i]>z_max) z_max=data[i];
|
||||
if (data[i] < z_min)
|
||||
z_min = data[i];
|
||||
if (data[i] > z_max)
|
||||
z_max = data[i];
|
||||
z_mean += data[i];
|
||||
}
|
||||
z_mean /= nb;
|
||||
if(z_min>0) z_min/=1.02; else z_min*=1.02;
|
||||
if(z_max>0) z_max*=1.02; else z_max/=1.02;
|
||||
if (z_min > 0)
|
||||
z_min /= 1.02;
|
||||
else
|
||||
z_min *= 1.02;
|
||||
if (z_max > 0)
|
||||
z_max *= 1.02;
|
||||
else
|
||||
z_max /= 1.02;
|
||||
}
|
||||
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||
}
|
||||
@ -106,7 +128,8 @@ double SlsQt2DHist::GetMean(){
|
||||
if (!z_mean_has_been_calculated) {
|
||||
z_mean_has_been_calculated = 1;
|
||||
z_mean = 0;
|
||||
for(int i=0;i<nb;i++) z_mean+=data[i];
|
||||
for (int i = 0; i < nb; i++)
|
||||
z_mean += data[i];
|
||||
z_mean /= nb;
|
||||
}
|
||||
|
||||
@ -116,13 +139,10 @@ double SlsQt2DHist::GetMean(){
|
||||
double SlsQt2DHist::SetMinimumToFirstGreaterThanZero() {
|
||||
z_min = fabs(z_max) + 1;
|
||||
for (int i = 0; i < nb; i++) {
|
||||
if(data[i]>0 && data[i]<z_min) z_min=data[i];
|
||||
if (data[i] > 0 && data[i] < z_min)
|
||||
z_min = data[i];
|
||||
}
|
||||
setInterval(Qt::ZAxis, QwtInterval(z_min, z_max));
|
||||
|
||||
|
||||
return z_min;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Executable file → Normal file
57
slsDetectorGui/slsDetectorPlotting/src/SlsQt2DPlot.cxx
Executable file → Normal file
@ -19,12 +19,8 @@
|
||||
#include <qwt_scale_engine.h>
|
||||
#include <qwt_scale_widget.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define QwtLog10ScaleEngine QwtLogScaleEngine // hmm remove?
|
||||
|
||||
|
||||
SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
isLog = 0;
|
||||
axisScaleEngine(QwtPlot::yLeft)->setAttribute(QwtScaleEngine::Floating);
|
||||
@ -40,7 +36,6 @@ SlsQt2DPlot::SlsQt2DPlot(QWidget *parent) : QwtPlot(parent) {
|
||||
Update();
|
||||
}
|
||||
|
||||
|
||||
SlsQt2DPlot::~SlsQt2DPlot() {
|
||||
if (d_spectrogram) {
|
||||
d_spectrogram->detach();
|
||||
@ -53,9 +48,7 @@ SlsQt2DPlot::~SlsQt2DPlot() {
|
||||
delete panner;
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetTitle(QString title) {
|
||||
setTitle(title);
|
||||
}
|
||||
void SlsQt2DPlot::SetTitle(QString title) { setTitle(title); }
|
||||
|
||||
void SlsQt2DPlot::SetXTitle(QString title) {
|
||||
setAxisTitle(QwtPlot::xBottom, title);
|
||||
@ -105,7 +98,6 @@ void SlsQt2DPlot::SetupColorMap() {
|
||||
for (double level = 0.5; level < 10.0; level += 1.0)
|
||||
(contourLevelsLog) += (pow(10, 2 * level / 10.0) - 1) / 99.0 * 10;
|
||||
|
||||
|
||||
// A color bar on the right axis
|
||||
rightAxis = axisWidget(QwtPlot::yRight);
|
||||
|
||||
@ -124,7 +116,8 @@ void SlsQt2DPlot::FillTestPlot(int mode) {
|
||||
double dmax = sqrt(pow(nx / 2.0 - 0.5, 2) + pow(ny / 2.0 - 0.5, 2));
|
||||
for (int i = 0; i < nx; i++) {
|
||||
for (int j = 0; j < ny; j++) {
|
||||
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) + pow(ny / 2.0 - (j + 0.5), 2));
|
||||
double d = sqrt(pow(nx / 2.0 - (i + 0.5), 2) +
|
||||
pow(ny / 2.0 - (j + 0.5), 2));
|
||||
|
||||
if (mode % 3)
|
||||
the_data[i + j * nx] = 10 * d / dmax;
|
||||
@ -146,9 +139,11 @@ void SlsQt2DPlot::SetupZoom() {
|
||||
zoomer->SetHist(hist);
|
||||
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton,
|
||||
Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
|
||||
@ -177,12 +172,16 @@ void SlsQt2DPlot::SetupZoom() {
|
||||
|
||||
void SlsQt2DPlot::UnZoom(bool replot) {
|
||||
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(), hist->GetXMax() - hist->GetXMin(), hist->GetYMax() - hist->GetYMin()));
|
||||
zoomer->setZoomBase(replot); //Call replot for the attached plot before initializing the zoomer with its scales.
|
||||
zoomer->setZoomBase(QRectF(hist->GetXMin(), hist->GetYMin(),
|
||||
hist->GetXMax() - hist->GetXMin(),
|
||||
hist->GetYMax() - hist->GetYMin()));
|
||||
zoomer->setZoomBase(replot); // Call replot for the attached plot before
|
||||
// initializing the zoomer with its scales.
|
||||
// zoomer->zoom(0);
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width, double y_width) {
|
||||
void SlsQt2DPlot::SetZoom(double xmin, double ymin, double x_width,
|
||||
double y_width) {
|
||||
zoomer->setZoomBase(QRectF(xmin, ymin, x_width, y_width));
|
||||
}
|
||||
|
||||
@ -198,25 +197,33 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
#endif
|
||||
if (disable) {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::NoButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::NoButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::NoButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::NoButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::NoButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::NoButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::NoButton);
|
||||
} else {
|
||||
if (zoomer) {
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect1,
|
||||
Qt::LeftButton);
|
||||
#if QT_VERSION < 0x040000
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::RightButton, Qt::ControlButton);
|
||||
#else
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect2,
|
||||
Qt::RightButton, Qt::ControlModifier);
|
||||
#endif
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);
|
||||
zoomer->setMousePattern(QwtEventPattern::MouseSelect3,
|
||||
Qt::RightButton);
|
||||
}
|
||||
if (panner)
|
||||
panner->setMouseButton(Qt::MidButton);
|
||||
@ -224,7 +231,6 @@ void SlsQt2DPlot::DisableZoom(bool disable) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SlsQt2DPlot::SetZMinMax(double zmin, double zmax) {
|
||||
hist->SetMinMax(zmin, zmax);
|
||||
}
|
||||
@ -294,7 +300,8 @@ void SlsQt2DPlot::SetContour(bool enable) {
|
||||
Update();
|
||||
}
|
||||
|
||||
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min, double max) {
|
||||
void SlsQt2DPlot::SetLogz(bool enable, bool isMin, bool isMax, double min,
|
||||
double max) {
|
||||
LogZ(enable);
|
||||
SetZRange(isMin, isMax, min, max);
|
||||
}
|
||||
|
61
slsDetectorGui/src/qCloneWidget.cpp
Executable file → Normal file
61
slsDetectorGui/src/qCloneWidget.cpp
Executable file → Normal file
@ -1,7 +1,7 @@
|
||||
#include "qCloneWidget.h"
|
||||
#include "qDefs.h"
|
||||
#include "SlsQt1DPlot.h"
|
||||
#include "SlsQt2DPlot.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QFileDialog>
|
||||
@ -11,10 +11,13 @@
|
||||
|
||||
int qCloneWidget::NumClones{0};
|
||||
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp,
|
||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max, QString sum):
|
||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2,
|
||||
SlsQt1DPlot *gp1, SlsQt2DPlot *gp, QString title,
|
||||
QString fPath, QString fName, int64_t aIndex,
|
||||
bool displayStats, QString min, QString max,
|
||||
QString sum)
|
||||
: QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1),
|
||||
gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||
setupUi(this);
|
||||
id = qCloneWidget::NumClones++;
|
||||
SetupWidgetWindow(title);
|
||||
@ -34,7 +37,8 @@ qCloneWidget::~qCloneWidget() {
|
||||
|
||||
void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
|
||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) + std::string(" - ") + NowTime();
|
||||
std::string winTitle = std::string("Snapshot:") + std::to_string(id) +
|
||||
std::string(" - ") + NowTime();
|
||||
setWindowTitle(QString(winTitle.c_str()));
|
||||
|
||||
boxPlot->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
@ -57,7 +61,8 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
} else {
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1,
|
||||
Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
}
|
||||
connect(actionSaveClone, SIGNAL(triggered()), this, SLOT(SavePlot()));
|
||||
@ -65,15 +70,19 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setMinimumHeight(qDefs::MIN_HEIGHT_GAIN_PLOT_1D);
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
// gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||
// gainplot1d->setFixedHeight(plot1d->height() /
|
||||
// qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
}
|
||||
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max, QString sum) {
|
||||
void qCloneWidget::DisplayStats(bool enable, QString min, QString max,
|
||||
QString sum) {
|
||||
if (enable) {
|
||||
lblMinDisp->setText(QString("%1").arg(min));
|
||||
lblMaxDisp->setText(QString("%1").arg(max));
|
||||
@ -88,20 +97,31 @@ void qCloneWidget::SavePlot() {
|
||||
char cID[10];
|
||||
sprintf(cID, "%d", id);
|
||||
// title
|
||||
QString fName = filePath + QString('/') + fileName + QString("_clone") + QString("%1").arg(id) + QString("_acq") + QString("%1").arg(acqIndex) + QString(".png");
|
||||
QString fName = filePath + QString('/') + fileName + QString("_clone") +
|
||||
QString("%1").arg(id) + QString("_acq") +
|
||||
QString("%1").arg(acqIndex) + QString(".png");
|
||||
FILE_LOG(logINFO) << "Saving Clone:" << fName.toAscii().constData();
|
||||
// save
|
||||
QImage img(centralwidget->size().width(), centralwidget->size().height(), QImage::Format_RGB32);
|
||||
QImage img(centralwidget->size().width(), centralwidget->size().height(),
|
||||
QImage::Format_RGB32);
|
||||
QPainter painter(&img);
|
||||
centralwidget->render(&painter);
|
||||
|
||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName, tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0, QFileDialog::ShowDirsOnly);
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
this, tr("Save Snapshot "), fName,
|
||||
tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
if (!fName.isEmpty()) {
|
||||
if ((img.save(fName))) {
|
||||
qDefs::Message(qDefs::INFORMATION, "The SnapShot has been successfully saved", "qCloneWidget::SavePlot");
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The SnapShot has been successfully saved",
|
||||
"qCloneWidget::SavePlot");
|
||||
FILE_LOG(logINFO) << "The SnapShot has been successfully saved";
|
||||
} else {
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.", "qCloneWidget::SavePlot");
|
||||
qDefs::Message(
|
||||
qDefs::WARNING,
|
||||
"Attempt to save snapshot failed.\n Formats: .png, .jpg, .xpm.",
|
||||
"qCloneWidget::SavePlot");
|
||||
FILE_LOG(logWARNING) << "Attempt to save snapshot failed";
|
||||
}
|
||||
}
|
||||
@ -110,11 +130,14 @@ void qCloneWidget::SavePlot() {
|
||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot1d != nullptr) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->setFixedHeight(plot1d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot2d != nullptr) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
24
slsDetectorGui/src/qDacWidget.cpp
Executable file → Normal file
24
slsDetectorGui/src/qDacWidget.cpp
Executable file → Normal file
@ -3,8 +3,9 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d, std::string n, slsDetectorDefs::dacIndex i) :
|
||||
QWidget(parent), det(detector), isDac(d), index(i){
|
||||
qDacWidget::qDacWidget(QWidget *parent, sls::Detector *detector, bool d,
|
||||
std::string n, slsDetectorDefs::dacIndex i)
|
||||
: QWidget(parent), det(detector), isDac(d), index(i) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow(n);
|
||||
}
|
||||
@ -25,7 +26,6 @@ void qDacWidget::SetupWidgetWindow(std::string name) {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void qDacWidget::Initialization() {
|
||||
if (isDac) {
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
@ -48,19 +48,23 @@ void qDacWidget::GetDac() {
|
||||
// mv
|
||||
retval = det->getDAC(index, 1, {detectorIndex}).squash(-1);
|
||||
lblDacmV->setText(QString("%1mV").arg(retval - 10));
|
||||
} CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index), "qDacWidget::GetDac")
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get dac ") + std::to_string(index),
|
||||
"qDacWidget::GetDac")
|
||||
|
||||
connect(spinDac, SIGNAL(editingFinished()), this, SLOT(SetDac()));
|
||||
}
|
||||
|
||||
|
||||
void qDacWidget::SetDac() {
|
||||
int val = (int)spinDac->value();
|
||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data() << " : " << val;
|
||||
FILE_LOG(logINFO) << "Setting dac:" << lblDac->text().toAscii().data()
|
||||
<< " : " << val;
|
||||
|
||||
try {
|
||||
det->setDAC(index, val, 0, {detectorIndex});
|
||||
} CATCH_DISPLAY (std::string("Could not set dac ") + std::to_string(index), "qDacWidget::SetDac")
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not set dac ") + std::to_string(index),
|
||||
"qDacWidget::SetDac")
|
||||
|
||||
// update mV anyway
|
||||
GetDac();
|
||||
@ -76,8 +80,9 @@ void qDacWidget::GetAdc() {
|
||||
} else {
|
||||
spinDac->setValue(retval);
|
||||
}
|
||||
} CATCH_DISPLAY (std::string("Could not get adc ") + std::to_string(index), "qDacWidget::GetAdc")
|
||||
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get adc ") + std::to_string(index),
|
||||
"qDacWidget::GetAdc")
|
||||
}
|
||||
|
||||
void qDacWidget::Refresh() {
|
||||
@ -87,4 +92,3 @@ void qDacWidget::Refresh() {
|
||||
GetAdc();
|
||||
}
|
||||
}
|
||||
|
||||
|
118
slsDetectorGui/src/qDetectorMain.cpp
Executable file → Normal file
118
slsDetectorGui/src/qDetectorMain.cpp
Executable file → Normal file
@ -1,25 +1,24 @@
|
||||
#include "qDetectorMain.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabAdvanced.h"
|
||||
#include "qTabSettings.h"
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qTabDebugging.h"
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qTabMeasurement.h"
|
||||
#include "qTabMessages.h"
|
||||
#include "qTabPlot.h"
|
||||
#include "qTabSettings.h"
|
||||
|
||||
#include "versionAPI.h"
|
||||
#include "ToString.h"
|
||||
#include "versionAPI.h"
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QFileDialog>
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QResizeEvent>
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -94,7 +93,6 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setStyle(new QPlastiqueStyle);
|
||||
// app.setWindowIcon(QIcon(":/icons/images/mountain.png"));
|
||||
@ -133,7 +131,8 @@ void qDetectorMain::SetUpWidgetWindow() {
|
||||
layoutTabs->addWidget(tabs.get());
|
||||
|
||||
// creating all the other tab widgets
|
||||
tabMeasurement = sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
||||
tabMeasurement =
|
||||
sls::make_unique<qTabMeasurement>(this, det.get(), plot.get());
|
||||
tabDataOutput = sls::make_unique<qTabDataOutput>(this, det.get());
|
||||
tabPlot = sls::make_unique<qTabPlot>(this, det.get(), plot.get());
|
||||
tabSettings = sls::make_unique<qTabSettings>(this, det.get());
|
||||
@ -219,7 +218,8 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
LoadConfigFile(fName);
|
||||
|
||||
// validate detector type (for GUI) and update menu
|
||||
detType = det->getDetectorType().tsquash("Different detector type for all modules.");
|
||||
detType = det->getDetectorType().tsquash(
|
||||
"Different detector type for all modules.");
|
||||
actionLoadTrimbits->setEnabled(false);
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
@ -233,15 +233,17 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
break;
|
||||
default:
|
||||
std::ostringstream os;
|
||||
os << det->getHostname() << " has " <<
|
||||
sls::ToString(det->getDetectorType().squash()) << " detector type (" <<
|
||||
std::to_string(detType) << "). Exiting GUI.";
|
||||
os << det->getHostname() << " has "
|
||||
<< sls::ToString(det->getDetectorType().squash())
|
||||
<< " detector type (" << std::to_string(detType)
|
||||
<< "). Exiting GUI.";
|
||||
std::string errorMess = os.str();
|
||||
throw sls::RuntimeError(errorMess.c_str());
|
||||
}
|
||||
std::ostringstream os;
|
||||
os << "SLS Detector GUI : " << sls::ToString(det->getDetectorType().squash())
|
||||
<< " - " << det->getHostname();
|
||||
os << "SLS Detector GUI : "
|
||||
<< sls::ToString(det->getDetectorType().squash()) << " - "
|
||||
<< det->getHostname();
|
||||
std::string title = os.str();
|
||||
FILE_LOG(logINFO) << title;
|
||||
setWindowTitle(QString(title.c_str()));
|
||||
@ -249,27 +251,36 @@ void qDetectorMain::SetUpDetector(const std::string fName, int multiID) {
|
||||
|
||||
void qDetectorMain::Initialization() {
|
||||
// Dockable Plot
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this, SLOT(ResizeMainWindow(bool)));
|
||||
connect(dockWidgetPlot, SIGNAL(topLevelChanged(bool)), this,
|
||||
SLOT(ResizeMainWindow(bool)));
|
||||
// tabs
|
||||
connect(tabs.get(),SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||
connect(tabs.get(), SIGNAL(currentChanged(int)), this,
|
||||
SLOT(Refresh(int))); //( QWidget*)));
|
||||
// Measurement tab
|
||||
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)), plot.get(), SLOT(SetSaveFileName(QString)));
|
||||
connect(tabMeasurement.get(), SIGNAL(EnableTabsSignal(bool)), this,
|
||||
SLOT(EnableTabs(bool)));
|
||||
connect(tabMeasurement.get(), SIGNAL(FileNameChangedSignal(QString)),
|
||||
plot.get(), SLOT(SetSaveFileName(QString)));
|
||||
// Plot tab
|
||||
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||
connect(tabPlot.get(), SIGNAL(DisableZoomSignal(bool)), this,
|
||||
SLOT(SetZoomToolTip(bool)));
|
||||
|
||||
// Plotting
|
||||
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(), SLOT(AcquireFinished()));
|
||||
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(), SLOT(AbortAcquire()));
|
||||
connect(plot.get(), SIGNAL(AcquireFinishedSignal()), tabMeasurement.get(),
|
||||
SLOT(AcquireFinished()));
|
||||
connect(plot.get(), SIGNAL(AbortSignal()), tabMeasurement.get(),
|
||||
SLOT(AbortAcquire()));
|
||||
|
||||
// menubar
|
||||
// Modes Menu
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this, SLOT(EnableModes(QAction *)));
|
||||
connect(menuModes, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(EnableModes(QAction *)));
|
||||
// Utilities Menu
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteUtilities(QAction *)));
|
||||
connect(menuUtilities, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteUtilities(QAction *)));
|
||||
// Help Menu
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this, SLOT(ExecuteHelp(QAction *)));
|
||||
|
||||
connect(menuHelp, SIGNAL(triggered(QAction *)), this,
|
||||
SLOT(ExecuteHelp(QAction *)));
|
||||
}
|
||||
|
||||
void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
@ -302,7 +313,9 @@ void qDetectorMain::LoadConfigFile(const std::string fName) {
|
||||
} else {
|
||||
try {
|
||||
det->loadConfig(fName);
|
||||
} CATCH_DISPLAY ("Could not load config file.", "qDetectorMain::LoadConfigFile")
|
||||
}
|
||||
CATCH_DISPLAY("Could not load config file.",
|
||||
"qDetectorMain::LoadConfigFile")
|
||||
}
|
||||
}
|
||||
|
||||
@ -313,8 +326,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
if (action == actionDebug) {
|
||||
enable = actionDebug->isChecked();
|
||||
tabs->setTabEnabled(DEBUGGING, enable);
|
||||
FILE_LOG(logINFO) << "Debug Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
FILE_LOG(logINFO) << "Debug Mode: " << qDefs::stringEnable(enable);
|
||||
|
||||
}
|
||||
|
||||
@ -323,9 +335,9 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
enable = actionExpert->isChecked();
|
||||
|
||||
tabs->setTabEnabled(ADVANCED, enable);
|
||||
actionLoadTrimbits->setVisible(enable && detType == slsDetectorDefs::EIGER);
|
||||
FILE_LOG(logINFO) << "Expert Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
actionLoadTrimbits->setVisible(enable &&
|
||||
detType == slsDetectorDefs::EIGER);
|
||||
FILE_LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||
}
|
||||
|
||||
// Set DockableMode
|
||||
@ -337,8 +349,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
dockWidgetPlot->setFloating(false);
|
||||
dockWidgetPlot->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
||||
}
|
||||
FILE_LOG(logINFO) << "Dockable Mode: "
|
||||
<< qDefs::stringEnable(enable);
|
||||
FILE_LOG(logINFO) << "Dockable Mode: " << qDefs::stringEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,8 +366,7 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadConfig(
|
||||
std::string(fName.toAscii().constData()));
|
||||
det->loadConfig(std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Configuration Parameters have been "
|
||||
"configured successfully.",
|
||||
@ -375,19 +385,18 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
refreshTabs = true;
|
||||
det->loadParameters(
|
||||
std::string(fName.toAscii().constData()));
|
||||
det->loadParameters(std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Detector Parameters have been "
|
||||
"configured successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO)
|
||||
<< "Parameters loaded successfully";
|
||||
FILE_LOG(logINFO) << "Parameters loaded successfully";
|
||||
}
|
||||
}
|
||||
|
||||
else if (action == actionLoadTrimbits) {
|
||||
QString fName = QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||
QString fName =
|
||||
QString((det->getSettingsPath().squash("/tmp/")).c_str());
|
||||
FILE_LOG(logDEBUG) << "Loading Trimbits";
|
||||
// so that even nonexisting files can be selected
|
||||
QFileDialog *fileDialog = new QFileDialog(
|
||||
@ -399,18 +408,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
|
||||
// Gets called when cancelled as well
|
||||
if (!fName.isEmpty()) {
|
||||
det->loadTrimbits(
|
||||
std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(
|
||||
qDefs::INFORMATION,
|
||||
det->loadTrimbits(std::string(fName.toAscii().constData()));
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Trimbits have been loaded successfully.",
|
||||
"qDetectorMain::ExecuteUtilities");
|
||||
FILE_LOG(logINFO) << "Trimbits loaded successfully";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} CATCH_DISPLAY ("Could not execute utilities.", "qDetectorMain::ExecuteUtilities")
|
||||
}
|
||||
CATCH_DISPLAY("Could not execute utilities.",
|
||||
"qDetectorMain::ExecuteUtilities")
|
||||
|
||||
Refresh(tabs->currentIndex());
|
||||
if (refreshTabs) {
|
||||
@ -429,13 +436,16 @@ void qDetectorMain::ExecuteUtilities(QAction *action) {
|
||||
|
||||
void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
if (action == actionAbout) {
|
||||
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench detectors";
|
||||
FILE_LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
||||
"Gotthard, Gotthard2 and Moench detectors";
|
||||
|
||||
std::string guiVersion = std::to_string(APIGUI);
|
||||
std::string clientVersion = "unknown";
|
||||
try {
|
||||
clientVersion = std::to_string(det->getClientVersion());
|
||||
} CATCH_DISPLAY ("Could not get client version.", "qDetectorMain::ExecuteHelp")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client version.",
|
||||
"qDetectorMain::ExecuteHelp")
|
||||
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"<p style=\"font-family:verdana;\">"
|
||||
@ -446,7 +456,8 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
clientVersion +
|
||||
"<br><br>"
|
||||
"Common GUI to control the SLS Detectors: "
|
||||
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and Moench.<br><br>"
|
||||
"Jungfrau, Eiger, Mythen3, Gotthard, Gotthard2 and "
|
||||
"Moench.<br><br>"
|
||||
"It can be operated in parallel with the command "
|
||||
"line interface:<br>"
|
||||
"sls_detector_put,<br>sls_detector_get,<br>sls_"
|
||||
@ -553,7 +564,8 @@ void qDetectorMain::EnableTabs(bool enable) {
|
||||
// expert
|
||||
bool expertTab = enable && (actionExpert->isChecked());
|
||||
tabs->setTabEnabled(ADVANCED, expertTab);
|
||||
actionLoadTrimbits->setVisible(expertTab && detType == slsDetectorDefs::EIGER);
|
||||
actionLoadTrimbits->setVisible(expertTab &&
|
||||
detType == slsDetectorDefs::EIGER);
|
||||
|
||||
// moved to here, so that its all in order, instead of signals and different
|
||||
// threads
|
||||
|
323
slsDetectorGui/src/qDrawPlot.cpp
Executable file → Normal file
323
slsDetectorGui/src/qDrawPlot.cpp
Executable file → Normal file
@ -5,15 +5,16 @@
|
||||
#include "detectorData.h"
|
||||
#include "qCloneWidget.h"
|
||||
|
||||
#include "detectorData.h"
|
||||
#include "ToString.h"
|
||||
#include "detectorData.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QPainter>
|
||||
#include <QtConcurrentRun>
|
||||
#include <QResizeEvent>
|
||||
#include <QtConcurrentRun>
|
||||
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
|
||||
qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logINFO) << "Plots ready";
|
||||
@ -21,8 +22,8 @@ qDrawPlot::qDrawPlot(QWidget *parent, sls::Detector *detector) : QWidget(parent)
|
||||
|
||||
qDrawPlot::~qDrawPlot() {
|
||||
DetachHists();
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin();
|
||||
h != hists1d.end(); ++h){
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end();
|
||||
++h) {
|
||||
delete *h;
|
||||
}
|
||||
|
||||
@ -51,14 +52,16 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
gainMask = (3 << 14);
|
||||
gainOffset = 14;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
<< ", Gain Mask:" << gainMask
|
||||
<< ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
pixelMask = ((1 << 12) - 1);
|
||||
gainMask = (3 << 12);
|
||||
gainOffset = 12;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
<< ", Gain Mask:" << gainMask
|
||||
<< ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -70,14 +73,16 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
temp = det->getFileNamePrefix().squash("xxx");
|
||||
fileSaveName = QString(temp.c_str());
|
||||
} catch (const std::exception &e) {
|
||||
qDefs::ExceptionMessage("Could not get file path or file name.", e.what(), "qDrawPlot::SetupWidgetWindow");
|
||||
qDefs::ExceptionMessage("Could not get file path or file name.",
|
||||
e.what(), "qDrawPlot::SetupWidgetWindow");
|
||||
fileSavePath = "/tmp";
|
||||
fileSaveName = "Image";
|
||||
}
|
||||
|
||||
SetupPlots();
|
||||
SetDataCallBack(true);
|
||||
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
||||
det->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),
|
||||
this);
|
||||
Initialization();
|
||||
}
|
||||
|
||||
@ -103,7 +108,8 @@ void qDrawPlot::SetupPlots() {
|
||||
--nPixelsX;
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get quad.", "qDrawPlot::SetupPlots")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get quad.", "qDrawPlot::SetupPlots")
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -139,7 +145,8 @@ void qDrawPlot::SetupPlots() {
|
||||
// setup 1d plot
|
||||
plot1d = new SlsQt1DPlot(boxPlot);
|
||||
plot1d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot1d->SetTitle("");
|
||||
@ -148,7 +155,6 @@ void qDrawPlot::SetupPlots() {
|
||||
h->Attach(plot1d);
|
||||
plot1d->hide();
|
||||
|
||||
|
||||
delete[] gainDatay1d;
|
||||
gainDatay1d = new double[nPixelsX];
|
||||
// default display data
|
||||
@ -162,16 +168,20 @@ void qDrawPlot::SetupPlots() {
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot);
|
||||
gainplot1d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot1d->SetTitle("");
|
||||
gainplot1d->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
QList<double> majorTicks({0, 1, 2, 3});
|
||||
QwtScaleDiv div(0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
gainplot1d->setAxisScaleDiv(QwtPlot::yLeft, div);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
//gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
// gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks,
|
||||
// false);
|
||||
// gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels,
|
||||
// false);
|
||||
gainhist1d->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
gainplot1d->hide();
|
||||
@ -199,10 +209,11 @@ void qDrawPlot::SetupPlots() {
|
||||
sqrt(2);
|
||||
// setup 2d plot
|
||||
plot2d = new SlsQt2DPlot(boxPlot);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||
-0.5, nPixelsY - 0.5, data2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, data2d);
|
||||
plot2d->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
plot2d->SetZFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
@ -212,8 +223,10 @@ void qDrawPlot::SetupPlots() {
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
|
||||
gainplot2d = new SlsQt2DPlot(boxPlot);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
gainplot2d->setTitle("Gain");
|
||||
gainplot2d->SetZTitle("");
|
||||
gainplot2d->enableAxis(QwtPlot::yLeft, false);
|
||||
@ -228,36 +241,32 @@ void qDrawPlot::SetupPlots() {
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1,
|
||||
Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
void qDrawPlot::resizeEvent(QResizeEvent *event) {
|
||||
if (gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
if (gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->setFixedHeight(plot1d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
bool qDrawPlot::GetIsRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
bool qDrawPlot::GetIsRunning() { return isRunning; }
|
||||
|
||||
void qDrawPlot::SetRunning(bool enable) {
|
||||
isRunning = enable;
|
||||
}
|
||||
void qDrawPlot::SetRunning(bool enable) { isRunning = enable; }
|
||||
|
||||
int qDrawPlot::GetProgress() {
|
||||
return progress;
|
||||
}
|
||||
int qDrawPlot::GetProgress() { return progress; }
|
||||
|
||||
int64_t qDrawPlot::GetCurrentFrameIndex() {
|
||||
return currentFrame;
|
||||
}
|
||||
int64_t qDrawPlot::GetCurrentFrameIndex() { return currentFrame; }
|
||||
|
||||
void qDrawPlot::Select1dPlot(bool enable) {
|
||||
if (enable) {
|
||||
@ -284,7 +293,8 @@ void qDrawPlot::SetPlotTitlePrefix(QString title) {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetXAxisTitle(QString title) {
|
||||
FILE_LOG(logINFO) << "Setting X Axis Title to " << title.toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting X Axis Title to "
|
||||
<< title.toAscii().constData();
|
||||
if (is1d) {
|
||||
xTitle1d = title;
|
||||
} else {
|
||||
@ -293,7 +303,8 @@ void qDrawPlot::SetXAxisTitle(QString title) {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetYAxisTitle(QString title) {
|
||||
FILE_LOG(logINFO) << "Setting Y Axis Title to " << title.toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Y Axis Title to "
|
||||
<< title.toAscii().constData();
|
||||
if (is1d) {
|
||||
yTitle1d = title;
|
||||
} else {
|
||||
@ -302,7 +313,8 @@ void qDrawPlot::SetYAxisTitle(QString title) {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetZAxisTitle(QString title) {
|
||||
FILE_LOG(logINFO) << "Setting Z Axis Title to " << title.toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Z Axis Title to "
|
||||
<< title.toAscii().constData();
|
||||
zTitle2d = title;
|
||||
}
|
||||
|
||||
@ -313,7 +325,8 @@ void qDrawPlot::SetXYRangeChanged(bool disable, double* xy, bool* isXY) {
|
||||
std::copy(xy, xy + 4, xyRange);
|
||||
std::copy(isXY, isXY + 4, isXYRange);
|
||||
|
||||
FILE_LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha << disable << std::noboolalpha;
|
||||
FILE_LOG(logDEBUG) << "Setting Disable zoom to " << std::boolalpha
|
||||
<< disable << std::noboolalpha;
|
||||
disableZoom = disable;
|
||||
}
|
||||
|
||||
@ -351,7 +364,8 @@ double qDrawPlot::GetYMaximum() {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetDataCallBack(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting data call back to " << std::boolalpha
|
||||
<< enable << std::noboolalpha;
|
||||
if (enable) {
|
||||
isPlot = true;
|
||||
det->setRxZmqDataStream(true);
|
||||
@ -361,11 +375,11 @@ void qDrawPlot::SetDataCallBack(bool enable) {
|
||||
det->setRxZmqDataStream(false);
|
||||
det->registerDataCallback(nullptr, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void qDrawPlot::SetBinary(bool enable, int from, int to) {
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Binary output from " << from << " to " << to;
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
||||
<< " Binary output from " << from << " to " << to;
|
||||
binaryFrom = from;
|
||||
binaryTo = to;
|
||||
isBinary = enable;
|
||||
@ -378,7 +392,8 @@ void qDrawPlot::SetPersistency(int val) {
|
||||
|
||||
void qDrawPlot::SetLines(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Lines to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
isLines = enable;
|
||||
for (int i = 0; i < nHists; ++i) {
|
||||
SlsQtH1D *h = hists1d.at(i);
|
||||
@ -388,7 +403,8 @@ void qDrawPlot::SetLines(bool enable) {
|
||||
|
||||
void qDrawPlot::SetMarkers(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Markers to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
isMarkers = enable;
|
||||
for (int i = 0; i < nHists; ++i) {
|
||||
SlsQtH1D *h = hists1d.at(i);
|
||||
@ -398,25 +414,29 @@ void qDrawPlot::SetMarkers(bool enable) {
|
||||
|
||||
void qDrawPlot::Set1dLogY(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Log Y to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
plot1d->SetLogY(enable);
|
||||
}
|
||||
|
||||
void qDrawPlot::SetInterpolate(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Interpolate to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
plot2d->SetInterpolate(enable);
|
||||
}
|
||||
|
||||
void qDrawPlot::SetContour(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Countour to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
plot2d->SetContour(enable);
|
||||
}
|
||||
|
||||
void qDrawPlot::SetLogz(bool enable) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable << std::noboolalpha;
|
||||
FILE_LOG(logINFO) << "Setting Log Z to " << std::boolalpha << enable
|
||||
<< std::noboolalpha;
|
||||
plot2d->SetLogz(enable, isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||
}
|
||||
|
||||
@ -447,7 +467,8 @@ void qDrawPlot::ResetAccumulate() {
|
||||
}
|
||||
|
||||
void qDrawPlot::DisplayStatistics(bool enable) {
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " Statistics Display";
|
||||
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling")
|
||||
<< " Statistics Display";
|
||||
displayStatistics = enable;
|
||||
}
|
||||
|
||||
@ -462,7 +483,8 @@ void qDrawPlot::EnableGainPlot(bool enable) {
|
||||
}
|
||||
|
||||
void qDrawPlot::SetSaveFileName(QString val) {
|
||||
FILE_LOG(logDEBUG) << "Setting Clone/Save File Name to " << val.toAscii().constData();
|
||||
FILE_LOG(logDEBUG) << "Setting Clone/Save File Name to "
|
||||
<< val.toAscii().constData();
|
||||
fileSaveName = val;
|
||||
}
|
||||
|
||||
@ -477,10 +499,14 @@ void qDrawPlot::ClonePlot() {
|
||||
if (is1d) {
|
||||
FILE_LOG(logDEBUG) << "Cloning 1D Image";
|
||||
cloneplot1D = new SlsQt1DPlot();
|
||||
cloneplot1D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->setFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetXFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot1D->SetTitle(plot1d->title().text());
|
||||
cloneplot1D->SetXTitle(xTitle1d);
|
||||
cloneplot1D->SetYTitle(yTitle1d);
|
||||
@ -500,8 +526,10 @@ void qDrawPlot::ClonePlot() {
|
||||
h->setSymbolMarkers(isMarkers);
|
||||
h->setItemAttribute(QwtPlotItem::Legend, false);
|
||||
clonegainplot1D = new SlsQt1DPlot();
|
||||
clonegainplot1D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot1D->SetTitle("");
|
||||
clonegainplot1D->SetYTitle("Gain");
|
||||
// set ticks to just 3
|
||||
@ -509,26 +537,32 @@ void qDrawPlot::ClonePlot() {
|
||||
QwtScaleDiv div(0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||
clonegainplot1D->setAxisScaleDiv(QwtPlot::yLeft, div);
|
||||
h->Attach(clonegainplot1D);
|
||||
|
||||
}
|
||||
} else {
|
||||
FILE_LOG(logDEBUG) << "Cloning 2D Image";
|
||||
cloneplot2D = new SlsQt2DPlot();
|
||||
cloneplot2D->setFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetXFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetYFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetZFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->setFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetXFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetYFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->SetZFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
cloneplot2D->setTitle(plot2d->title().text());
|
||||
cloneplot2D->SetXTitle(xTitle2d);
|
||||
cloneplot2D->SetYTitle(yTitle2d);
|
||||
cloneplot2D->SetZTitle(zTitle2d);
|
||||
cloneplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
cloneplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, data2d);
|
||||
cloneplot2D->SetZRange(isZRange[0], isZRange[1], zRange[0], zRange[1]);
|
||||
|
||||
if (isGainDataExtracted) {
|
||||
clonegainplot2D = new SlsQt2DPlot();
|
||||
clonegainplot2D->SetTitleFont(QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitleFont(
|
||||
QFont("Sans Serif", qDefs::Q_FONT_SIZE, QFont::Normal));
|
||||
clonegainplot2D->SetTitle("Gain");
|
||||
clonegainplot2D->SetZTitle("");
|
||||
clonegainplot2D->enableAxis(QwtPlot::yLeft, false);
|
||||
@ -541,13 +575,16 @@ void qDrawPlot::ClonePlot() {
|
||||
clonegainplot2D->enableAxis(0, false);
|
||||
clonegainplot2D->enableAxis(1, false);
|
||||
clonegainplot2D->enableAxis(2, false);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
clonegainplot2D->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY,
|
||||
-0.5, nPixelsY - 0.5, gainData);
|
||||
}
|
||||
}
|
||||
|
||||
new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D,
|
||||
clonegainplot2D, boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
|
||||
clonegainplot2D, boxPlot->title(), fileSavePath,
|
||||
fileSaveName, currentAcqIndex, displayStatistics,
|
||||
lblMinDisp->text(), lblMaxDisp->text(),
|
||||
lblSumDisp->text());
|
||||
}
|
||||
|
||||
void qDrawPlot::SavePlot() {
|
||||
@ -556,26 +593,31 @@ void qDrawPlot::SavePlot() {
|
||||
QPainter painter(&savedImage);
|
||||
render(&painter);
|
||||
|
||||
QString fName = fileSavePath + QString('/') +
|
||||
fileSaveName +
|
||||
QString('_') + (is1d ? plot1d->title().text() : plot2d->title().text()) +
|
||||
QString fName = fileSavePath + QString('/') + fileSaveName + QString('_') +
|
||||
(is1d ? plot1d->title().text() : plot2d->title().text()) +
|
||||
QString('_') + QString("%1").arg(currentAcqIndex) +
|
||||
QString(".png");
|
||||
|
||||
fName = QFileDialog::getSaveFileName(0, tr("Save Image"), fName, tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
|
||||
fName = QFileDialog::getSaveFileName(
|
||||
0, tr("Save Image"), fName,
|
||||
tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"), 0,
|
||||
QFileDialog::ShowDirsOnly);
|
||||
|
||||
if (!fName.isEmpty()) {
|
||||
if (savedImage.save(fName)) {
|
||||
qDefs::Message(qDefs::INFORMATION, "The Image has been successfully saved", "qDrawPlot::SavePlot");
|
||||
qDefs::Message(qDefs::INFORMATION,
|
||||
"The Image has been successfully saved",
|
||||
"qDrawPlot::SavePlot");
|
||||
fileSavePath = fName.section('/', 0, -2);
|
||||
} else {
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save image failed.\n Formats: .png, .jpg, .xpm.", "qDrawPlot::SavePlot");
|
||||
qDefs::Message(
|
||||
qDefs::WARNING,
|
||||
"Attempt to save image failed.\n Formats: .png, .jpg, .xpm.",
|
||||
"qDrawPlot::SavePlot");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qDrawPlot::GetStatistics(double &min, double &max, double &sum) {
|
||||
FILE_LOG(logDEBUG) << "Calculating Statistics";
|
||||
double *array = data2d;
|
||||
@ -594,7 +636,8 @@ void qDrawPlot::GetStatistics(double &min, double &max, double &sum) {
|
||||
}
|
||||
|
||||
void qDrawPlot::DetachHists() {
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end(); ++h) {
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end();
|
||||
++h) {
|
||||
(*h)->Detach(plot1d);
|
||||
}
|
||||
if (gainhist1d) {
|
||||
@ -615,7 +658,9 @@ void qDrawPlot::StartAcquisition() {
|
||||
if (!det->getRxZmqDataStream().squash(false)) {
|
||||
det->setRxZmqDataStream(true);
|
||||
}
|
||||
} CATCH_DISPLAY("Could not enable data streaming in Receiver.", "qDrawPlot::StartAcquisition");
|
||||
}
|
||||
CATCH_DISPLAY("Could not enable data streaming in Receiver.",
|
||||
"qDrawPlot::StartAcquisition");
|
||||
}
|
||||
|
||||
// refixing all the zooming
|
||||
@ -637,71 +682,94 @@ void qDrawPlot::AcquireThread() {
|
||||
mess = std::string(e.what());
|
||||
}
|
||||
FILE_LOG(logINFO) << "Acquisition Finished";
|
||||
// exception in acquire will not call acquisition finished call back, so handle it
|
||||
// exception in acquire will not call acquisition finished call back, so
|
||||
// handle it
|
||||
if (!mess.empty()) {
|
||||
FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
|
||||
qDefs::ExceptionMessage("Acquire unsuccessful.", mess, "qDrawPlot::AcquireFinished");
|
||||
FILE_LOG(logERROR) << "Acquisition Finished with an exception: "
|
||||
<< mess;
|
||||
qDefs::ExceptionMessage("Acquire unsuccessful.", mess,
|
||||
"qDrawPlot::AcquireFinished");
|
||||
try {
|
||||
det->stopDetector();
|
||||
} CATCH_DISPLAY("Could not stop detector acquisition.", "qDrawPlot::AcquireFinished");
|
||||
}
|
||||
CATCH_DISPLAY("Could not stop detector acquisition.",
|
||||
"qDrawPlot::AcquireFinished");
|
||||
try {
|
||||
det->stopReceiver();
|
||||
} CATCH_DISPLAY("Could not stop receiver.", "qDrawPlot::AcquireFinished");
|
||||
}
|
||||
CATCH_DISPLAY("Could not stop receiver.", "qDrawPlot::AcquireFinished");
|
||||
emit AbortSignal();
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "End of Acquisition Finished";
|
||||
}
|
||||
|
||||
void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer) {
|
||||
((qDrawPlot *)this_pointer)->AcquisitionFinished(currentProgress, detectorStatus);
|
||||
void qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,
|
||||
int detectorStatus,
|
||||
void *this_pointer) {
|
||||
((qDrawPlot *)this_pointer)
|
||||
->AcquisitionFinished(currentProgress, detectorStatus);
|
||||
FILE_LOG(logDEBUG) << "Acquisition Finished Call back successful";
|
||||
}
|
||||
|
||||
void qDrawPlot::GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer) {
|
||||
void qDrawPlot::GetDataCallBack(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex, void *this_pointer) {
|
||||
((qDrawPlot *)this_pointer)->GetData(data, frameIndex, subFrameIndex);
|
||||
FILE_LOG(logDEBUG) << "Get Data Call back successful";
|
||||
}
|
||||
|
||||
void qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus) {
|
||||
void qDrawPlot::AcquisitionFinished(double currentProgress,
|
||||
int detectorStatus) {
|
||||
progress = currentProgress;
|
||||
std::string status = sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||
std::string status =
|
||||
sls::ToString(static_cast<slsDetectorDefs::runStatus>(detectorStatus));
|
||||
|
||||
if (detectorStatus == slsDetectorDefs::ERROR) {
|
||||
qDefs::Message(qDefs::WARNING, std::string("<nobr>The acquisiton has ended abruptly. Current Detector Status: ") + status + std::string(".</nobr>"), "qDrawPlot::AcquisitionFinished");
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
std::string("<nobr>The acquisiton has ended abruptly. "
|
||||
"Current Detector Status: ") +
|
||||
status + std::string(".</nobr>"),
|
||||
"qDrawPlot::AcquisitionFinished");
|
||||
FILE_LOG(logERROR) << "Acquisition finished [Status: ERROR]";
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Acquisition finished [ Status:" << status << ", Progress: " << currentProgress << " ]" ;
|
||||
FILE_LOG(logINFO) << "Acquisition finished [ Status:" << status
|
||||
<< ", Progress: " << currentProgress << " ]";
|
||||
}
|
||||
emit AcquireFinishedSignal();
|
||||
}
|
||||
|
||||
void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex) {
|
||||
void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex,
|
||||
uint32_t subFrameIndex) {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "* GetData Callback *" << std::endl
|
||||
FILE_LOG(logDEBUG) << "* GetData Callback *" << std::endl
|
||||
<< " frame index: " << frameIndex << std::endl
|
||||
<< " sub frame index: " << (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex) << std::endl
|
||||
<< " sub frame index: "
|
||||
<< (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex)
|
||||
<< std::endl
|
||||
<< " Data [" << std::endl
|
||||
<< " \t progress: " << data->progressIndex << std::endl
|
||||
<< " \t file name: " << data->fileName << std::endl
|
||||
<< " \t nx: " << data->nx << std::endl
|
||||
<< " \t ny: " << data->ny << std::endl
|
||||
<< " \t data bytes: " << data->databytes << std::endl
|
||||
<< " \t dynamic range: " << data->dynamicRange << std::endl
|
||||
<< " \t dynamic range: " << data->dynamicRange
|
||||
<< std::endl
|
||||
<< " \t file index: " << data->fileIndex << std::endl
|
||||
<< " ]";
|
||||
|
||||
progress = (int)data->progressIndex;
|
||||
currentAcqIndex = data->fileIndex;
|
||||
currentFrame = frameIndex;
|
||||
FILE_LOG(logDEBUG) << "[ Progress:" << progress << ", Frame:" << currentFrame << " ]";
|
||||
FILE_LOG(logDEBUG) << "[ Progress:" << progress
|
||||
<< ", Frame:" << currentFrame << " ]";
|
||||
|
||||
// 2d (only image, not gain data, not pedestalvals),
|
||||
// check if npixelsX and npixelsY is the same (quad is different)
|
||||
if (!is1d && (static_cast<int>(nPixelsX) != data->nx || static_cast<int>(nPixelsY) != data->ny)) {
|
||||
if (!is1d && (static_cast<int>(nPixelsX) != data->nx ||
|
||||
static_cast<int>(nPixelsY) != data->ny)) {
|
||||
nPixelsX = data->nx;
|
||||
nPixelsY = data->ny;
|
||||
FILE_LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:" << nPixelsX << " nPixelsY:" << nPixelsY;
|
||||
FILE_LOG(logINFO) << "Change in Detector Shape:\n\tnPixelsX:"
|
||||
<< nPixelsX << " nPixelsY:" << nPixelsY;
|
||||
|
||||
delete[] data2d;
|
||||
data2d = new double[nPixelsY * nPixelsX];
|
||||
@ -712,16 +780,18 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
||||
unsigned int nPixels = nPixelsX * (is1d ? 1 : nPixelsY);
|
||||
double *rawData = new double[nPixels];
|
||||
if (hasGainData) {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange,
|
||||
is1d ? gainDatay1d : gainData);
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes,
|
||||
data->dynamicRange, is1d ? gainDatay1d : gainData);
|
||||
isGainDataExtracted = true;
|
||||
} else {
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
|
||||
toDoublePixelData(rawData, data->data, nPixels, data->databytes,
|
||||
data->dynamicRange);
|
||||
isGainDataExtracted = false;
|
||||
}
|
||||
|
||||
// title and frame index titles
|
||||
plotTitle = plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
|
||||
plotTitle =
|
||||
plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
|
||||
indexTitle = QString("%1").arg(frameIndex);
|
||||
if ((int)subFrameIndex != -1) {
|
||||
indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex);
|
||||
@ -750,9 +820,11 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
|
||||
}
|
||||
// calculate the pedestal value
|
||||
if (pedestalCount == NUM_PEDESTAL_FRAMES) {
|
||||
FILE_LOG(logINFO) << "Pedestal Calculated after " << NUM_PEDESTAL_FRAMES << " frames";
|
||||
FILE_LOG(logINFO) << "Pedestal Calculated after "
|
||||
<< NUM_PEDESTAL_FRAMES << " frames";
|
||||
for (unsigned int px = 0; px < nPixels; ++px)
|
||||
tempPedestalVals[px] = tempPedestalVals[px] / (double)NUM_PEDESTAL_FRAMES;
|
||||
tempPedestalVals[px] =
|
||||
tempPedestalVals[px] / (double)NUM_PEDESTAL_FRAMES;
|
||||
memcpy(pedestalVals, tempPedestalVals, nPixels * sizeof(double));
|
||||
pedestalCount++;
|
||||
}
|
||||
@ -875,7 +947,8 @@ void qDrawPlot::Update1dPlot() {
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
if (!gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width());
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->setFixedHeight(plot1d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->show();
|
||||
}
|
||||
} else if (gainplot1d->isVisible()) {
|
||||
@ -893,12 +966,16 @@ void qDrawPlot::Update2dPlot() {
|
||||
plot2d->SetXTitle(xTitle2d);
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, data2d);
|
||||
if (isGainDataExtracted) {
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, gainData);
|
||||
gainplot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5,
|
||||
nPixelsY - 0.5, gainData);
|
||||
if (!gainplot2d->isVisible()) {
|
||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedWidth(plot2d->width() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->setFixedHeight(plot2d->height() /
|
||||
qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot2d->show();
|
||||
}
|
||||
} else if (gainplot2d->isVisible()) {
|
||||
@ -916,16 +993,20 @@ void qDrawPlot::Update1dXYRange() {
|
||||
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
||||
plot1d->EnableXAutoScaling();
|
||||
} else {
|
||||
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot1d->GetXMinimum());
|
||||
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot1d->GetXMaximum());
|
||||
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN]
|
||||
: plot1d->GetXMinimum());
|
||||
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX]
|
||||
: plot1d->GetXMaximum());
|
||||
plot1d->SetXMinMax(xmin, xmax);
|
||||
}
|
||||
|
||||
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
||||
plot1d->EnableYAutoScaling();
|
||||
} else {
|
||||
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot1d->GetYMinimum());
|
||||
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot1d->GetYMaximum());
|
||||
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN]
|
||||
: plot1d->GetYMinimum());
|
||||
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX]
|
||||
: plot1d->GetYMaximum());
|
||||
plot1d->SetYMinMax(ymin, ymax);
|
||||
}
|
||||
plot1d->Update();
|
||||
@ -935,22 +1016,27 @@ void qDrawPlot::Update2dXYRange() {
|
||||
if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
|
||||
plot2d->EnableXAutoScaling();
|
||||
} else {
|
||||
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN] : plot2d->GetXMinimum());
|
||||
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX] : plot2d->GetXMaximum());
|
||||
double xmin = (isXYRange[qDefs::XMIN] ? xyRange[qDefs::XMIN]
|
||||
: plot2d->GetXMinimum());
|
||||
double xmax = (isXYRange[qDefs::XMAX] ? xyRange[qDefs::XMAX]
|
||||
: plot2d->GetXMaximum());
|
||||
plot2d->SetXMinMax(xmin, xmax);
|
||||
}
|
||||
|
||||
if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
|
||||
plot2d->EnableYAutoScaling();
|
||||
} else {
|
||||
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN] : plot2d->GetYMinimum());
|
||||
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX] : plot2d->GetYMaximum());
|
||||
double ymin = (isXYRange[qDefs::YMIN] ? xyRange[qDefs::YMIN]
|
||||
: plot2d->GetYMinimum());
|
||||
double ymax = (isXYRange[qDefs::YMAX] ? xyRange[qDefs::YMAX]
|
||||
: plot2d->GetYMaximum());
|
||||
plot2d->SetYMinMax(ymin, ymax);
|
||||
}
|
||||
plot2d->Update();
|
||||
}
|
||||
|
||||
void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest) {
|
||||
void qDrawPlot::toDoublePixelData(double *dest, char *source, int size,
|
||||
int databytes, int dr, double *gaindest) {
|
||||
int ichan = 0;
|
||||
int ibyte = 0;
|
||||
int halfbyte = 0;
|
||||
@ -1025,7 +1111,6 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qDrawPlot::UpdatePlot() {
|
||||
std::lock_guard<std::mutex> lock(mPlots);
|
||||
FILE_LOG(logDEBUG) << "Update Plot";
|
||||
|
204
slsDetectorGui/src/qTabAdvanced.cpp
Executable file → Normal file
204
slsDetectorGui/src/qTabAdvanced.cpp
Executable file → Normal file
@ -1,11 +1,12 @@
|
||||
#include "qTabAdvanced.h"
|
||||
#include "network_utils.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
#include "network_utils.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
||||
qTabAdvanced::qTabAdvanced(QWidget *parent, sls::Detector *detector,
|
||||
qDrawPlot *p)
|
||||
: QWidget(parent), det(detector), plot(p) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
@ -88,7 +89,8 @@ void qTabAdvanced::Initialization() {
|
||||
|
||||
// roi
|
||||
if (tab_roi->isEnabled()) {
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
connect(btnSetRoi, SIGNAL(clicked()), this, SLOT(SetROI()));
|
||||
connect(btnClearRoi, SIGNAL(clicked()), this, SLOT(ClearROI()));
|
||||
}
|
||||
@ -122,7 +124,8 @@ void qTabAdvanced::PopulateDetectors() {
|
||||
FILE_LOG(logDEBUG) << "Populating detectors";
|
||||
disconnect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector()));
|
||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
disconnect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
|
||||
comboDetector->clear();
|
||||
comboReadout->clear();
|
||||
@ -136,7 +139,8 @@ void qTabAdvanced::PopulateDetectors() {
|
||||
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDetector()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this, SLOT(GetROI()));
|
||||
connect(comboReadout, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetROI()));
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetControlPort() {
|
||||
@ -147,7 +151,9 @@ void qTabAdvanced::GetControlPort() {
|
||||
try {
|
||||
int retval = det->getControlPort({comboDetector->currentIndex()})[0];
|
||||
spinControlPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get detector control port.", "qTabAdvanced::GetControlPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector control port.",
|
||||
"qTabAdvanced::GetControlPort")
|
||||
|
||||
connect(spinControlPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetControlPort(int)));
|
||||
@ -161,7 +167,9 @@ void qTabAdvanced::GetStopPort() {
|
||||
try {
|
||||
int retval = det->getStopPort({comboDetector->currentIndex()})[0];
|
||||
spinStopPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get detector stop port.", "qTabAdvanced::GetStopPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector stop port.",
|
||||
"qTabAdvanced::GetStopPort")
|
||||
|
||||
connect(spinStopPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStopPort(int)));
|
||||
@ -173,9 +181,12 @@ void qTabAdvanced::GetDetectorUDPIP() {
|
||||
SLOT(SetDetectorUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval = det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval =
|
||||
det->getSourceUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get detector UDP IP.", "qTabAdvanced::GetDetectorUDPIP")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector UDP IP.",
|
||||
"qTabAdvanced::GetDetectorUDPIP")
|
||||
|
||||
connect(dispDetectorUDPIP, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPIP()));
|
||||
@ -187,9 +198,12 @@ void qTabAdvanced::GetDetectorUDPMAC() {
|
||||
SLOT(SetDetectorUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval = det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
auto retval =
|
||||
det->getSourceUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispDetectorUDPMAC->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get detector UDP MAC.", "qTabAdvanced::GetDetectorUDPMAC")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get detector UDP MAC.",
|
||||
"qTabAdvanced::GetDetectorUDPMAC")
|
||||
|
||||
connect(dispDetectorUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetDetectorUDPMAC()));
|
||||
@ -201,10 +215,11 @@ void qTabAdvanced::GetCltZMQPort() {
|
||||
SLOT(SetCltZMQPort(int)));
|
||||
|
||||
try {
|
||||
int retval =
|
||||
det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||
int retval = det->getClientZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinZMQPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get client zmq port.", "qTabAdvanced::GetCltZMQPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client zmq port.",
|
||||
"qTabAdvanced::GetCltZMQPort")
|
||||
|
||||
connect(spinZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetCltZMQPort(int)));
|
||||
@ -218,7 +233,8 @@ void qTabAdvanced::GetCltZMQIP() {
|
||||
auto retval =
|
||||
det->getClientZmqIp({comboDetector->currentIndex()})[0].str();
|
||||
dispZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client zmq ip.", "qTabAdvanced::GetCltZMQIP")
|
||||
|
||||
connect(dispZMQIP, SIGNAL(editingFinished()), this, SLOT(SetCltZMQIP()));
|
||||
}
|
||||
@ -231,7 +247,9 @@ void qTabAdvanced::GetRxrHostname() {
|
||||
try {
|
||||
auto retval = det->getRxHostname({comboDetector->currentIndex()})[0];
|
||||
dispRxrHostname->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabAdvanced::GetRxrHostname")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||
"qTabAdvanced::GetRxrHostname")
|
||||
|
||||
connect(dispRxrHostname, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrHostname()));
|
||||
@ -245,7 +263,9 @@ void qTabAdvanced::GetRxrTCPPort() {
|
||||
try {
|
||||
int retval = det->getRxPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrTCPPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver tcp port.", "qTabAdvanced::GetRxrTCPPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver tcp port.",
|
||||
"qTabAdvanced::GetRxrTCPPort")
|
||||
|
||||
connect(spinRxrTCPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrTCPPort(int)));
|
||||
@ -257,9 +277,12 @@ void qTabAdvanced::GetRxrUDPPort() {
|
||||
SLOT(SetRxrUDPPort(int)));
|
||||
|
||||
try {
|
||||
int retval = det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||
int retval =
|
||||
det->getDestinationUDPPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrUDPPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver udp port.", "qTabAdvanced::GetRxrUDPPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp port.",
|
||||
"qTabAdvanced::GetRxrUDPPort")
|
||||
|
||||
connect(spinRxrUDPPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrUDPPort(int)));
|
||||
@ -271,9 +294,11 @@ void qTabAdvanced::GetRxrUDPIP() {
|
||||
SLOT(SetRxrUDPIP()));
|
||||
|
||||
try {
|
||||
auto retval = det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval =
|
||||
det->getDestinationUDPIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp ip.", "qTabAdvanced::GetRxrUDPIP")
|
||||
|
||||
connect(dispRxrUDPIP, SIGNAL(editingFinished()), this, SLOT(SetRxrUDPIP()));
|
||||
}
|
||||
@ -284,9 +309,12 @@ void qTabAdvanced::GetRxrUDPMAC() {
|
||||
SLOT(SetRxrUDPMAC()));
|
||||
|
||||
try {
|
||||
auto retval = det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
auto retval =
|
||||
det->getDestinationUDPMAC({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrUDPMAC->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver udp mac.", "qTabAdvanced::GetRxrUDPMAC")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver udp mac.",
|
||||
"qTabAdvanced::GetRxrUDPMAC")
|
||||
|
||||
connect(dispRxrUDPMAC, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRxrUDPMAC()));
|
||||
@ -298,10 +326,11 @@ void qTabAdvanced::GetRxrZMQPort() {
|
||||
SLOT(SetRxrZMQPort(int)));
|
||||
|
||||
try {
|
||||
int retval =
|
||||
det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||
int retval = det->getRxZmqPort({comboDetector->currentIndex()})[0];
|
||||
spinRxrZMQPort->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq port.", "qTabAdvanced::GetRxrZMQPort")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver zmq port.",
|
||||
"qTabAdvanced::GetRxrZMQPort")
|
||||
|
||||
connect(spinRxrZMQPort, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRxrZMQPort(int)));
|
||||
@ -313,10 +342,10 @@ void qTabAdvanced::GetRxrZMQIP() {
|
||||
SLOT(SetRxrZMQIP()));
|
||||
|
||||
try {
|
||||
auto retval =
|
||||
det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||
auto retval = det->getRxZmqIP({comboDetector->currentIndex()})[0].str();
|
||||
dispRxrZMQIP->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver zmq ip.", "qTabAdvanced::GetRxrZMQIP")
|
||||
|
||||
connect(dispRxrZMQIP, SIGNAL(editingFinished()), this, SLOT(SetRxrZMQIP()));
|
||||
}
|
||||
@ -346,7 +375,8 @@ void qTabAdvanced::SetControlPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Control Port:" << port;
|
||||
try {
|
||||
det->setControlPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||
}
|
||||
CATCH_HANDLE("Could not set control port.", "qTabAdvanced::SetControlPort",
|
||||
this, &qTabAdvanced::GetControlPort)
|
||||
}
|
||||
|
||||
@ -354,7 +384,8 @@ void qTabAdvanced::SetStopPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Stop Port:" << port;
|
||||
try {
|
||||
det->setStopPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||
}
|
||||
CATCH_HANDLE("Could not set stop port.", "qTabAdvanced::SetStopPort", this,
|
||||
&qTabAdvanced::GetStopPort)
|
||||
}
|
||||
|
||||
@ -363,7 +394,8 @@ void qTabAdvanced::SetDetectorUDPIP() {
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP IP:" << s;
|
||||
try {
|
||||
det->setSourceUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP IP.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Detector UDP IP.",
|
||||
"qTabAdvanced::SetDetectorUDPIP", this,
|
||||
&qTabAdvanced::GetDetectorUDPIP)
|
||||
}
|
||||
@ -373,7 +405,8 @@ void qTabAdvanced::SetDetectorUDPMAC() {
|
||||
FILE_LOG(logINFO) << "Setting Detector UDP MAC:" << s;
|
||||
try {
|
||||
det->setSourceUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Detector UDP MAC.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Detector UDP MAC.",
|
||||
"qTabAdvanced::SetDetectorUDPMAC", this,
|
||||
&qTabAdvanced::GetDetectorUDPMAC)
|
||||
}
|
||||
@ -382,7 +415,8 @@ void qTabAdvanced::SetCltZMQPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ Port:" << port;
|
||||
try {
|
||||
det->setClientZmqPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ port.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ port.",
|
||||
"qTabAdvanced::SetCltZMQPort", this,
|
||||
&qTabAdvanced::GetCltZMQPort)
|
||||
}
|
||||
@ -392,9 +426,9 @@ void qTabAdvanced::SetCltZMQIP() {
|
||||
FILE_LOG(logINFO) << "Setting Client ZMQ IP:" << s;
|
||||
try {
|
||||
det->setClientZmqIp(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetCltZMQIP", this,
|
||||
&qTabAdvanced::GetCltZMQIP)
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetCltZMQIP",
|
||||
this, &qTabAdvanced::GetCltZMQIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrHostname() {
|
||||
@ -402,9 +436,9 @@ void qTabAdvanced::SetRxrHostname() {
|
||||
FILE_LOG(logINFO) << "Setting Receiver Hostname:" << s;
|
||||
try {
|
||||
det->setRxHostname(s, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Client ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrHostname", this,
|
||||
&qTabAdvanced::GetRxrHostname)
|
||||
}
|
||||
CATCH_HANDLE("Could not set Client ZMQ IP.", "qTabAdvanced::SetRxrHostname",
|
||||
this, &qTabAdvanced::GetRxrHostname)
|
||||
|
||||
// update all network widgets (receiver mainly)
|
||||
SetDetector();
|
||||
@ -414,7 +448,8 @@ void qTabAdvanced::SetRxrTCPPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver TCP Port:" << port;
|
||||
try {
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver TCP port.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver TCP port.",
|
||||
"qTabAdvanced::SetRxrTCPPort", this,
|
||||
&qTabAdvanced::GetRxrTCPPort)
|
||||
}
|
||||
@ -423,7 +458,8 @@ void qTabAdvanced::SetRxrUDPPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP Port:" << port;
|
||||
try {
|
||||
det->setRxPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP port.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP port.",
|
||||
"qTabAdvanced::SetRxrUDPPort", this,
|
||||
&qTabAdvanced::GetRxrUDPPort)
|
||||
}
|
||||
@ -432,18 +468,21 @@ void qTabAdvanced::SetRxrUDPIP() {
|
||||
std::string s = dispRxrUDPIP->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP IP:" << s;
|
||||
try {
|
||||
det->setDestinationUDPIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP IP.",
|
||||
"qTabAdvanced::SetRxrUDPIP", this,
|
||||
&qTabAdvanced::GetRxrUDPIP)
|
||||
det->setDestinationUDPIP(sls::IpAddr{s},
|
||||
{comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP IP.", "qTabAdvanced::SetRxrUDPIP",
|
||||
this, &qTabAdvanced::GetRxrUDPIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetRxrUDPMAC() {
|
||||
std::string s = dispRxrUDPMAC->text().toAscii().constData();
|
||||
FILE_LOG(logINFO) << "Setting Receiver UDP MAC:" << s;
|
||||
try {
|
||||
det->setDestinationUDPMAC(sls::MacAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver UDP MAC.",
|
||||
det->setDestinationUDPMAC(sls::MacAddr{s},
|
||||
{comboDetector->currentIndex()});
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver UDP MAC.",
|
||||
"qTabAdvanced::SetRxrUDPMAC", this,
|
||||
&qTabAdvanced::GetRxrUDPMAC)
|
||||
}
|
||||
@ -452,7 +491,8 @@ void qTabAdvanced::SetRxrZMQPort(int port) {
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ Port:" << port;
|
||||
try {
|
||||
det->setRxZmqPort(port, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ port.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver ZMQ port.",
|
||||
"qTabAdvanced::SetRxrZMQPort", this,
|
||||
&qTabAdvanced::GetRxrZMQPort)
|
||||
}
|
||||
@ -462,18 +502,20 @@ void qTabAdvanced::SetRxrZMQIP() {
|
||||
FILE_LOG(logINFO) << "Setting Receiver ZMQ IP:" << s;
|
||||
try {
|
||||
det->setRxZmqIP(sls::IpAddr{s}, {comboDetector->currentIndex()});
|
||||
} CATCH_HANDLE ("Could not set Receiver ZMQ IP.",
|
||||
"qTabAdvanced::SetRxrZMQIP", this,
|
||||
&qTabAdvanced::GetRxrZMQIP)
|
||||
}
|
||||
CATCH_HANDLE("Could not set Receiver ZMQ IP.", "qTabAdvanced::SetRxrZMQIP",
|
||||
this, &qTabAdvanced::GetRxrZMQIP)
|
||||
}
|
||||
|
||||
void qTabAdvanced::GetROI() {
|
||||
FILE_LOG(logDEBUG) << "Getting ROI";
|
||||
try {
|
||||
slsDetectorDefs::ROI roi = det->getROI({comboReadout->currentIndex()})[0];
|
||||
slsDetectorDefs::ROI roi =
|
||||
det->getROI({comboReadout->currentIndex()})[0];
|
||||
spinXmin->setValue(roi.xmin);
|
||||
spinXmax->setValue(roi.xmax);
|
||||
} CATCH_DISPLAY ("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get ROI.", "qTabAdvanced::GetROI")
|
||||
}
|
||||
|
||||
void qTabAdvanced::ClearROI() {
|
||||
@ -491,11 +533,12 @@ void qTabAdvanced::SetROI() {
|
||||
roi.xmax = spinXmax->value();
|
||||
|
||||
// set roi
|
||||
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax << "]";
|
||||
FILE_LOG(logINFO) << "Setting ROI: [" << roi.xmin << ", " << roi.xmax
|
||||
<< "]";
|
||||
try {
|
||||
det->setROI(roi, {comboReadout->currentIndex()});
|
||||
} CATCH_DISPLAY ("Could not set these ROIs.",
|
||||
"qTabAdvanced::SetROI")
|
||||
}
|
||||
CATCH_DISPLAY("Could not set these ROIs.", "qTabAdvanced::SetROI")
|
||||
|
||||
// update corrected list
|
||||
GetROI();
|
||||
@ -509,7 +552,8 @@ void qTabAdvanced::GetAllTrimbits() {
|
||||
try {
|
||||
int retval = det->getAllTrimbits().squash(-1);
|
||||
spinSetAllTrimbits->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get all trimbits.", "qTabAdvanced::GetAllTrimbits")
|
||||
|
||||
connect(spinSetAllTrimbits, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetAllTrimbits()));
|
||||
@ -521,7 +565,8 @@ void qTabAdvanced::SetAllTrimbits() {
|
||||
|
||||
try {
|
||||
det->setAllTrimbits(value);
|
||||
} CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||
}
|
||||
CATCH_HANDLE("Could not set all trimbits.", "qTabAdvanced::SetAllTrimbits",
|
||||
this, &qTabAdvanced::GetAllTrimbits)
|
||||
}
|
||||
|
||||
@ -531,10 +576,11 @@ void qTabAdvanced::GetNumStoragecells() {
|
||||
SLOT(SetNumStoragecells(int)));
|
||||
|
||||
try {
|
||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash("Inconsistent values for number of addditional storage cells.");
|
||||
auto retval = det->getNumberOfAdditionalStorageCells().tsquash(
|
||||
"Inconsistent values for number of addditional storage cells.");
|
||||
spinNumStoragecells->setValue(retval);
|
||||
} CATCH_DISPLAY (
|
||||
"Could not get number of additional storage cells.",
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of additional storage cells.",
|
||||
"qTabAdvanced::GetNumStoragecells")
|
||||
|
||||
connect(spinNumStoragecells, SIGNAL(valueChanged(int)), this,
|
||||
@ -546,8 +592,8 @@ void qTabAdvanced::SetNumStoragecells(int value) {
|
||||
<< value;
|
||||
try {
|
||||
det->setNumberOfAdditionalStorageCells(value);
|
||||
} CATCH_HANDLE (
|
||||
"Could not set number of additional storage cells.",
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of additional storage cells.",
|
||||
"qTabAdvanced::SetNumStoragecells", this,
|
||||
&qTabAdvanced::GetNumStoragecells)
|
||||
}
|
||||
@ -559,12 +605,13 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
disconnect(comboSubExpTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
try {
|
||||
auto retval =
|
||||
det->getSubExptime().tsquash("Subexptime is inconsistent for all detectors.");
|
||||
auto retval = det->getSubExptime().tsquash(
|
||||
"Subexptime is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubExpTime->setValue(time.first);
|
||||
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get sub exposure time.",
|
||||
}
|
||||
CATCH_DISPLAY("Could not get sub exposure time.",
|
||||
"qTabSettings::GetSubExposureTime")
|
||||
connect(spinSubExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubExposureTime()));
|
||||
@ -573,7 +620,9 @@ void qTabAdvanced::GetSubExposureTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubExposureTime() {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubExpTime->value(), static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinSubExpTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboSubExpTimeUnit->currentIndex())));
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame acquisition time to " << timeNS.count() << " ns"
|
||||
<< "/" << spinSubExpTime->value()
|
||||
@ -581,7 +630,8 @@ void qTabAdvanced::SetSubExposureTime() {
|
||||
(qDefs::timeUnit)comboSubExpTimeUnit->currentIndex());
|
||||
try {
|
||||
det->setSubExptime(timeNS);
|
||||
} CATCH_DISPLAY ("Could not set sub exposure time.",
|
||||
}
|
||||
CATCH_DISPLAY("Could not set sub exposure time.",
|
||||
"qTabAdvanced::SetSubExposureTime")
|
||||
|
||||
GetSubExposureTime();
|
||||
@ -594,12 +644,13 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
disconnect(comboSubDeadTimeUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
try {
|
||||
auto retval = det->getSubDeadTime().tsquash("Sub dead time is inconsistent for all detectors.");
|
||||
auto retval = det->getSubDeadTime().tsquash(
|
||||
"Sub dead time is inconsistent for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinSubDeadTime->setValue(time.first);
|
||||
comboSubDeadTimeUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get sub dead time.",
|
||||
comboSubDeadTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get sub dead time.",
|
||||
"qTabSettings::GetSubDeadTime")
|
||||
connect(spinSubDeadTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetSubDeadTime()));
|
||||
@ -608,7 +659,9 @@ void qTabAdvanced::GetSubDeadTime() {
|
||||
}
|
||||
|
||||
void qTabAdvanced::SetSubDeadTime() {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(spinSubDeadTime->value(), static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinSubDeadTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboSubDeadTimeUnit->currentIndex())));
|
||||
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting sub frame dead time to " << timeNS.count() << " ns"
|
||||
@ -617,7 +670,8 @@ void qTabAdvanced::SetSubDeadTime() {
|
||||
(qDefs::timeUnit)comboSubDeadTimeUnit->currentIndex());
|
||||
try {
|
||||
det->setSubDeadTime(timeNS);
|
||||
} CATCH_DISPLAY ("Could not set sub dead time.",
|
||||
}
|
||||
CATCH_DISPLAY("Could not set sub dead time.",
|
||||
"qTabAdvanced::SetSubDeadTime")
|
||||
GetSubDeadTime();
|
||||
}
|
||||
|
235
slsDetectorGui/src/qTabDataOutput.cpp
Executable file → Normal file
235
slsDetectorGui/src/qTabDataOutput.cpp
Executable file → Normal file
@ -1,24 +1,22 @@
|
||||
#include "qTabDataOutput.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QFileDialog>
|
||||
#include <QStandardItemModel>
|
||||
#include <QButtonGroup>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||
qTabDataOutput::qTabDataOutput(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector), btnGroupRate(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "DataOutput ready";
|
||||
}
|
||||
|
||||
qTabDataOutput::~qTabDataOutput() {
|
||||
delete btnGroupRate;
|
||||
}
|
||||
qTabDataOutput::~qTabDataOutput() { delete btnGroupRate; }
|
||||
|
||||
void qTabDataOutput::SetupWidgetWindow() {
|
||||
// button group for rate
|
||||
@ -52,24 +50,34 @@ void qTabDataOutput::SetupWidgetWindow() {
|
||||
|
||||
void qTabDataOutput::Initialization() {
|
||||
// ourdir, fileformat, overwrite enable
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetOutputDir()));
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetOutputDir()));
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(BrowseOutputDir()));
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
// rate
|
||||
if (chkRate->isEnabled()) {
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
}
|
||||
// flags, speed
|
||||
if (widgetEiger->isEnabled()) {
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +98,9 @@ void qTabDataOutput::EnableBrowse() {
|
||||
FILE_LOG(logDEBUG) << "Getting browse enable";
|
||||
try {
|
||||
btnOutputBrowse->setEnabled(false); // exception default
|
||||
std::string rxHostname = det->getRxHostname({comboDetector->currentIndex() - 1}).squash("none");
|
||||
std::string rxHostname =
|
||||
det->getRxHostname({comboDetector->currentIndex() - 1})
|
||||
.squash("none");
|
||||
if (rxHostname == "none") {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
} else if (rxHostname == "localhost") {
|
||||
@ -109,50 +119,66 @@ void qTabDataOutput::EnableBrowse() {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get receiver hostname.", "qTabDataOutput::EnableBrowse")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get receiver hostname.",
|
||||
"qTabDataOutput::EnableBrowse")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||
try {
|
||||
boxFileWriteEnabled->setEnabled(true); // exception default
|
||||
auto retval = det->getFileWrite().tsquash("File write is inconsistent for all detectors.");
|
||||
auto retval = det->getFileWrite().tsquash(
|
||||
"File write is inconsistent for all detectors.");
|
||||
boxFileWriteEnabled->setEnabled(retval);
|
||||
} CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file enable.", "qTabDataOutput::GetFileWrite")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileName() {
|
||||
FILE_LOG(logDEBUG) << "Getting file name";
|
||||
try {
|
||||
auto retval = det->getFileNamePrefix().tsquash("File name is inconsistent for all detectors.");
|
||||
auto retval = det->getFileNamePrefix().tsquash(
|
||||
"File name is inconsistent for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabDataOutput::GetFileName")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file name prefix.",
|
||||
"qTabDataOutput::GetFileName")
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Getting file path";
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
disconnect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
try {
|
||||
std::string path = det->getFilePath({comboDetector->currentIndex() - 1}).tsquash("File path is different for all detectors.");
|
||||
std::string path =
|
||||
det->getFilePath({comboDetector->currentIndex() - 1})
|
||||
.tsquash("File path is different for all detectors.");
|
||||
dispOutputDir->setText(QString(path.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(SetOutputDir()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file path.", "qTabDataOutput::GetOutputDir")
|
||||
connect(dispOutputDir, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetOutputDir()));
|
||||
}
|
||||
|
||||
void qTabDataOutput::BrowseOutputDir() {
|
||||
FILE_LOG(logDEBUG) << "Browsing output directory";
|
||||
QString directory = QFileDialog::getExistingDirectory(this, tr("Choose Output Directory "), dispOutputDir->text());
|
||||
QString directory = QFileDialog::getExistingDirectory(
|
||||
this, tr("Choose Output Directory "), dispOutputDir->text());
|
||||
if (!directory.isEmpty())
|
||||
dispOutputDir->setText(directory);
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOutputDir() {
|
||||
QString path = dispOutputDir->text();
|
||||
FILE_LOG(logDEBUG) << "Setting output directory to " << path.toAscii().constData();
|
||||
FILE_LOG(logDEBUG) << "Setting output directory to "
|
||||
<< path.toAscii().constData();
|
||||
|
||||
// empty
|
||||
if (path.isEmpty()) {
|
||||
qDefs::Message(qDefs::WARNING, "Invalid Output Path. Must not be empty.", "qTabDataOutput::SetOutputDir");
|
||||
qDefs::Message(qDefs::WARNING,
|
||||
"Invalid Output Path. Must not be empty.",
|
||||
"qTabDataOutput::SetOutputDir");
|
||||
FILE_LOG(logWARNING) << "Invalid Output Path. Must not be empty.";
|
||||
GetOutputDir();
|
||||
} else {
|
||||
@ -165,84 +191,122 @@ void qTabDataOutput::SetOutputDir() {
|
||||
std::string spath = std::string(path.toAscii().constData());
|
||||
try {
|
||||
det->setFilePath(spath, {comboDetector->currentIndex() - 1});
|
||||
} CATCH_HANDLE ("Could not set output file path.", "qTabDataOutput::SetOutputDir", this, &qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
CATCH_HANDLE("Could not set output file path.",
|
||||
"qTabDataOutput::SetOutputDir", this,
|
||||
&qTabDataOutput::GetOutputDir)
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileFormat() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
try {
|
||||
auto retval = det->getFileFormat().tsquash("File format is inconsistent for all detectors.");
|
||||
auto retval = det->getFileFormat().tsquash(
|
||||
"File format is inconsistent for all detectors.");
|
||||
switch (retval) {
|
||||
case slsDetectorDefs::BINARY:
|
||||
case slsDetectorDefs::HDF5:
|
||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown file format: ") + std::to_string(static_cast<int>(retval)));
|
||||
throw sls::RuntimeError(std::string("Unknown file format: ") +
|
||||
std::to_string(static_cast<int>(retval)));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file format.", "qTabDataOutput::GetFileFormat")
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFileFormat(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetFileFormat(int format) {
|
||||
FILE_LOG(logINFO) << "Setting File Format to " << comboFileFormat->currentText().toAscii().data();
|
||||
FILE_LOG(logINFO) << "Setting File Format to "
|
||||
<< comboFileFormat->currentText().toAscii().data();
|
||||
try {
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(comboFileFormat->currentIndex()));
|
||||
} CATCH_HANDLE ("Could not set file format.", "qTabDataOutput::SetFileFormat", this, &qTabDataOutput::GetFileFormat)
|
||||
det->setFileFormat(static_cast<slsDetectorDefs::fileFormat>(
|
||||
comboFileFormat->currentIndex()));
|
||||
}
|
||||
CATCH_HANDLE("Could not set file format.", "qTabDataOutput::SetFileFormat",
|
||||
this, &qTabDataOutput::GetFileFormat)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFileOverwrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Over Write Enable";
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
disconnect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getFileOverWrite().tsquash("File over write is inconsistent for all detectors.");
|
||||
auto retval = det->getFileOverWrite().tsquash(
|
||||
"File over write is inconsistent for all detectors.");
|
||||
chkOverwriteEnable->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabDataOutput::GetFileOverwrite")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file over write enable.",
|
||||
"qTabDataOutput::GetFileOverwrite")
|
||||
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this, SLOT(SetOverwriteEnable(bool)));
|
||||
connect(chkOverwriteEnable, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetOverwriteEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetOverwriteEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting File Over Write Enable to " << enable;
|
||||
try {
|
||||
det->setFileOverWrite(enable);
|
||||
} CATCH_HANDLE ("Could not set file over write enable.", "qTabDataOutput::SetOverwriteEnable", this, &qTabDataOutput::GetFileOverwrite)
|
||||
}
|
||||
CATCH_HANDLE("Could not set file over write enable.",
|
||||
"qTabDataOutput::SetOverwriteEnable", this,
|
||||
&qTabDataOutput::GetFileOverwrite)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetTenGigaEnable() {
|
||||
FILE_LOG(logDEBUG) << "Getting 10GbE enable";
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
disconnect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
try {
|
||||
auto retval = det->getTenGiga().tsquash("10GbE enable is inconsistent for all detectors.");
|
||||
auto retval = det->getTenGiga().tsquash(
|
||||
"10GbE enable is inconsistent for all detectors.");
|
||||
chkTenGiga->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get 10GbE enable.", "qTabDataOutput::GetTenGigaEnable")
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get 10GbE enable.",
|
||||
"qTabDataOutput::GetTenGigaEnable")
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting 10GbE to " << enable;
|
||||
try {
|
||||
det->setTenGiga(enable);
|
||||
} CATCH_HANDLE ("Could not set 10GbE enable.", "qTabDataOutput::SetTenGigaEnable", this, &qTabDataOutput::GetTenGigaEnable)
|
||||
}
|
||||
CATCH_HANDLE("Could not set 10GbE enable.",
|
||||
"qTabDataOutput::SetTenGigaEnable", this,
|
||||
&qTabDataOutput::GetTenGigaEnable)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetRateCorrection() {
|
||||
FILE_LOG(logDEBUG) << "Getting Rate Correction";
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
try {
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
int64_t retval = det->getRateCorrection().tsquash("Rate correction (enable/tau) is inconsistent for all detectors.").count();
|
||||
int64_t retval = det->getRateCorrection()
|
||||
.tsquash("Rate correction (enable/tau) is "
|
||||
"inconsistent for all detectors.")
|
||||
.count();
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
} CATCH_DISPLAY("Could not get rate correction.", "qTabDataOutput::GetRateCorrection")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get rate correction.",
|
||||
"qTabDataOutput::GetRateCorrection")
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetRateCorrection()));
|
||||
}
|
||||
|
||||
void qTabDataOutput::EnableRateCorrection() {
|
||||
@ -255,7 +319,10 @@ void qTabDataOutput::EnableRateCorrection() {
|
||||
// disable
|
||||
try {
|
||||
det->setRateCorrection(sls::ns(0));
|
||||
} CATCH_HANDLE ("Could not switch off rate correction.", "qTabDataOutput::EnableRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
CATCH_HANDLE("Could not switch off rate correction.",
|
||||
"qTabDataOutput::EnableRateCorrection", this,
|
||||
&qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetRateCorrection() {
|
||||
@ -267,55 +334,77 @@ void qTabDataOutput::SetRateCorrection() {
|
||||
// custom dead time
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
int64_t deadtime = spinCustomDeadTime->value();
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with custom dead time: " << deadtime;
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting Rate Correction with custom dead time: "
|
||||
<< deadtime;
|
||||
det->setRateCorrection(sls::ns(deadtime));
|
||||
}
|
||||
// default dead time
|
||||
else {
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with default dead time";
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting Rate Correction with default dead time";
|
||||
det->setDefaultRateCorrection();
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set rate correction.", "qTabDataOutput::SetRateCorrection", this, &qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
CATCH_HANDLE("Could not set rate correction.",
|
||||
"qTabDataOutput::SetRateCorrection", this,
|
||||
&qTabDataOutput::GetRateCorrection)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
FILE_LOG(logDEBUG) << "Getting Speed";
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
try {
|
||||
auto retval = det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||
auto retval =
|
||||
det->getSpeed().tsquash("Speed is inconsistent for all detectors.");
|
||||
comboEigerClkDivider->setCurrentIndex(static_cast<int>(retval));
|
||||
} CATCH_DISPLAY ("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get speed.", "qTabDataOutput::GetSpeed")
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSpeed(int)));
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << comboEigerClkDivider->currentText().toAscii().data();;
|
||||
FILE_LOG(logINFO) << "Setting Speed to "
|
||||
<< comboEigerClkDivider->currentText().toAscii().data();
|
||||
;
|
||||
try {
|
||||
det->setSpeed(static_cast<slsDetectorDefs::speedLevel>(speed));
|
||||
} CATCH_HANDLE ("Could not set speed.", "qTabDataOutput::SetSpeed", this, &qTabDataOutput::GetSpeed)
|
||||
}
|
||||
CATCH_HANDLE("Could not set speed.", "qTabDataOutput::SetSpeed", this,
|
||||
&qTabDataOutput::GetSpeed)
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetFlags() {
|
||||
FILE_LOG(logDEBUG) << "Getting readout flags";
|
||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
disconnect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
try {
|
||||
auto retval = det->getParallelMode().tsquash("Parallel Flag is inconsistent for all detectors.");
|
||||
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);
|
||||
} CATCH_DISPLAY ("Could not get flags.", "qTabDataOutput::GetFlags")
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get flags.", "qTabDataOutput::GetFlags")
|
||||
connect(comboEigerParallelFlag, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetFlags()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetFlags() {
|
||||
auto mode = comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||
auto mode =
|
||||
comboEigerParallelFlag->currentIndex() == PARALLEL ? true : false;
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to " << comboEigerParallelFlag->currentText().toAscii().data();
|
||||
FILE_LOG(logINFO)
|
||||
<< "Setting Readout Flags to "
|
||||
<< comboEigerParallelFlag->currentText().toAscii().data();
|
||||
det->setParallelMode(mode);
|
||||
} CATCH_HANDLE ("Could not set readout flags.", "qTabDataOutput::SetFlags", this, &qTabDataOutput::GetFlags)
|
||||
}
|
||||
CATCH_HANDLE("Could not set readout flags.", "qTabDataOutput::SetFlags",
|
||||
this, &qTabDataOutput::GetFlags)
|
||||
}
|
||||
|
||||
void qTabDataOutput::Refresh() {
|
||||
|
96
slsDetectorGui/src/qTabDebugging.cpp
Executable file → Normal file
96
slsDetectorGui/src/qTabDebugging.cpp
Executable file → Normal file
@ -9,8 +9,10 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector) :
|
||||
QWidget(parent), det(detector), treeDet(nullptr), lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr), lblDetectorSoftware(nullptr) {
|
||||
qTabDebugging::qTabDebugging(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector), treeDet(nullptr),
|
||||
lblDetectorHostname(nullptr), lblDetectorFirmware(nullptr),
|
||||
lblDetectorSoftware(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Debugging ready";
|
||||
@ -23,7 +25,6 @@ qTabDebugging::~qTabDebugging() {
|
||||
delete lblDetectorSoftware;
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::SetupWidgetWindow() {
|
||||
// enabling according to det type
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::EIGER) {
|
||||
@ -40,9 +41,9 @@ void qTabDebugging::SetupWidgetWindow() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::Initialization() {
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(GetDetectorStatus()));
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(GetDetectorStatus()));
|
||||
connect(btnGetInfo, SIGNAL(clicked()), this, SLOT(GetInfo()));
|
||||
if (btnTest->isEnabled()) {
|
||||
connect(btnTest, SIGNAL(clicked()), this, SLOT(TestDetector()));
|
||||
@ -63,11 +64,13 @@ void qTabDebugging::GetDetectorStatus() {
|
||||
FILE_LOG(logDEBUG) << "Getting Status";
|
||||
|
||||
try {
|
||||
std::string status = sls::ToString(det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
std::string status = sls::ToString(
|
||||
det->getDetectorStatus({comboDetector->currentIndex()})[0]);
|
||||
lblStatus->setText(QString(status.c_str()).toUpper());
|
||||
} CATCH_DISPLAY ("Could not get detector status.", "qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
|
||||
CATCH_DISPLAY("Could not get detector status.",
|
||||
"qTabDebugging::GetDetectorStatus")
|
||||
}
|
||||
|
||||
void qTabDebugging::GetInfo() {
|
||||
FILE_LOG(logDEBUG) << "Getting Readout Info";
|
||||
@ -86,34 +89,45 @@ void qTabDebugging::GetInfo() {
|
||||
// to make sure the size is constant
|
||||
lblDetectorFirmware->setFixedWidth(100);
|
||||
layout->addWidget(dispFrame, 0, 1);
|
||||
QString detName = QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||
QString detName =
|
||||
QString(sls::ToString(det->getDetectorType().squash()).c_str());
|
||||
|
||||
switch (det->getDetectorType().squash()) {
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
formLayout->addWidget(new QLabel("Half Module:"), 0, 0);
|
||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(new QLabel("Half Module Firmware Version:"), 1,
|
||||
0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2, 0);
|
||||
formLayout->addWidget(new QLabel("Half Module Software Version:"), 2,
|
||||
0);
|
||||
formLayout->addWidget(lblDetectorSoftware, 2, 2);
|
||||
treeDet->setHeaderLabel("Eiger Detector");
|
||||
// get num modules
|
||||
for (int i = 0; i < comboDetector->count() / 2; ++i)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module %1").arg(i))));
|
||||
items.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)0, QStringList(QString("Module %1").arg(i))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
// gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i) {
|
||||
QList<QTreeWidgetItem *> childItems;
|
||||
childItems.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Half Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
childItems.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)0,
|
||||
QStringList(QString("Half Module (%1)")
|
||||
.arg(comboDetector->itemText(i)))));
|
||||
treeDet->topLevelItem(i * 2)->insertChildren(0, childItems);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
formLayout->addWidget(new QLabel("Module:"), 0, 0);
|
||||
formLayout->addItem(new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0, 1);
|
||||
formLayout->addItem(
|
||||
new QSpacerItem(15, 20, QSizePolicy::Fixed, QSizePolicy::Fixed), 0,
|
||||
1);
|
||||
formLayout->addWidget(lblDetectorHostname, 0, 2);
|
||||
formLayout->addWidget(new QLabel("Module Firmware Version:"), 1, 0);
|
||||
formLayout->addWidget(lblDetectorFirmware, 1, 2);
|
||||
@ -122,28 +136,33 @@ void qTabDebugging::GetInfo() {
|
||||
treeDet->setHeaderLabel(QString(detName + " Detector"));
|
||||
// gets det names
|
||||
for (int i = 0; i < comboDetector->count(); ++i)
|
||||
items.append(new QTreeWidgetItem((QTreeWidget *)0, QStringList(QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
items.append(new QTreeWidgetItem(
|
||||
(QTreeWidget *)0,
|
||||
QStringList(
|
||||
QString("Module (%1)").arg(comboDetector->itemText(i)))));
|
||||
treeDet->insertTopLevelItems(0, items);
|
||||
break;
|
||||
}
|
||||
|
||||
// show and center widget
|
||||
int x = ((parentWidget()->width()) - (popup1->frameGeometry().width())) / 2;
|
||||
int y = ((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
int y =
|
||||
((parentWidget()->height()) - (popup1->frameGeometry().height())) / 2;
|
||||
QDesktopWidget *desktop = QApplication::desktop();
|
||||
int screen = desktop->screenNumber(this);
|
||||
popup1->setWindowModality(Qt::WindowModal);
|
||||
popup1->move((desktop->screenGeometry(screen).x()) + x, (desktop->screenGeometry(screen).y()) + y);
|
||||
popup1->move((desktop->screenGeometry(screen).x()) + x,
|
||||
(desktop->screenGeometry(screen).y()) + y);
|
||||
popup1->show();
|
||||
|
||||
// put the first parameters
|
||||
SetParameters(treeDet->topLevelItem(0));
|
||||
|
||||
// connect to slots
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
connect(treeDet, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
|
||||
SLOT(SetParameters(QTreeWidgetItem *)));
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
// eiger: if half module clicked, others: true always
|
||||
bool ignoreOrHalfModuleClicked = true;
|
||||
@ -160,11 +179,17 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
break;
|
||||
}
|
||||
try {
|
||||
auto retval = std::string("0x") + std::to_string((unsigned long)det->getFirmwareVersion({comboDetector->currentIndex()})[0]);
|
||||
auto retval = std::string("0x") +
|
||||
std::to_string((unsigned long)det->getFirmwareVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval = std::string("0x") + std::to_string((unsigned long)det->getDetectorServerVersion({comboDetector->currentIndex()})[0]);
|
||||
retval =
|
||||
std::string("0x") +
|
||||
std::to_string((unsigned long)det->getDetectorServerVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,35 +203,42 @@ void qTabDebugging::TestDetector() {
|
||||
}
|
||||
|
||||
// construct message
|
||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>").arg(comboDetector->currentText());
|
||||
QString message = QString("<nobr>Test Results for %1:</nobr><br><br>")
|
||||
.arg(comboDetector->currentText());
|
||||
|
||||
// detector firmware
|
||||
if (chkDetectorFirmware->isChecked()) {
|
||||
try {
|
||||
det->executeFirmwareTest({comboDetector->currentIndex()});
|
||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>").arg(moduleName));
|
||||
message.append(QString("<nobr>%1 Firmware: PASS</nobr><br>")
|
||||
.arg(moduleName));
|
||||
FILE_LOG(logINFO) << "Detector Firmware Test: Pass";
|
||||
} CATCH_DISPLAY ("Firmware test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
CATCH_DISPLAY("Firmware test failed.",
|
||||
"qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// detector CPU-FPGA bus
|
||||
if (chkDetectorBus->isChecked()) {
|
||||
try {
|
||||
det->executeBusTest({comboDetector->currentIndex()});
|
||||
message.append(QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||
message.append(
|
||||
QString("<nobr>%1 Bus: PASS</nobr><br>").arg(moduleName));
|
||||
FILE_LOG(logINFO) << "Detector Bus Test: Pass";
|
||||
} CATCH_DISPLAY ("Bus test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
CATCH_DISPLAY("Bus test failed.", "qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
// display message
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(), "qTabDebugging::TestDetector");
|
||||
} CATCH_DISPLAY ("Could not execute digital test.", "qTabDebugging::TestDetector")
|
||||
qDefs::Message(qDefs::INFORMATION, message.toAscii().constData(),
|
||||
"qTabDebugging::TestDetector");
|
||||
}
|
||||
CATCH_DISPLAY("Could not execute digital test.",
|
||||
"qTabDebugging::TestDetector")
|
||||
}
|
||||
|
||||
|
||||
void qTabDebugging::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating Debugging Tab";
|
||||
GetDetectorStatus();
|
||||
FILE_LOG(logDEBUG) << "**Updated Debugging Tab";
|
||||
}
|
||||
|
||||
|
358
slsDetectorGui/src/qTabDeveloper.cpp
Executable file → Normal file
358
slsDetectorGui/src/qTabDeveloper.cpp
Executable file → Normal file
@ -1,10 +1,11 @@
|
||||
#include "qTabDeveloper.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDacWidget.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector) : QWidget(parent), det(detector) {
|
||||
qTabDeveloper::qTabDeveloper(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Developer ready";
|
||||
@ -25,127 +26,260 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
slsDetectorDefs::detectorType detType = det->getDetectorType().squash();
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v SvP: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v SvN ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v cal: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcp ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vis: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_ll: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_lr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_rl: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Vcmp_rr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v threshold: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA Ext: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature 10GE: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature DCDC: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature SODL: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature SODR: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v SvP: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v SvN ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vrf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vrs: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vtr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vtgstv: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v cal: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vcp ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vcn: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v Vis: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v rxb_lb: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v rxb_rb: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v Vcmp_ll: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v Vcmp_lr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v Vcmp_rl: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v Vcmp_rr: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v threshold: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature FPGA Ext: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature 10GE: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature DCDC: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature SODL: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature SODR: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature FPGA: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
comboHV->show();
|
||||
lblComboHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Reference: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode n: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode p: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Output: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Cascode out ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Input: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v Comp. Ref: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i Base Test: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature ADC: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature FPGA: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Reference: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Cascode n: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Cascode p: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Comp. Output: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true, "v Cascode out ",
|
||||
getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Comp. Input: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v Comp. Ref: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"i Base Test: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature ADC: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature FPGA: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb comp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vdd prot: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vin com: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vref prech: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb pixbuf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vb ds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "v vref ds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "i vref comp: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(this, det, false, "Temperature ADC: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v vb comp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v vdd prot: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v vin com: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v vref prech: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"v vb pixbuf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "v vb ds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"v vref ds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"i vref comp: ", getSLSIndex(detType, tempid++)));
|
||||
adcWidgets.push_back(new qDacWidget(
|
||||
this, det, false,
|
||||
"Temperature ADC: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MOENCH:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vin_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_sda: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcasc_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vout_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "ibias_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vbp_colbuf: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vin_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vb_sda: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vcasc_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vout_cm: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vipre_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"ibias_sfp: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
hvmin = 0;
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vshaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vshaperneg: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre_out: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vth3: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vth1: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vicin: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vpreamp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vph: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "viinsh: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vpl: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vcassh: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vth2: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vshaper: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vshaperneg: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vipre_out: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vth3: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vth1: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vicin: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vcas: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vpreamp: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vph: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vipre: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "viinsh: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vpl: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vtrim: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vdcsh: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
lblSpinHV->show();
|
||||
spinHV->show();
|
||||
hvmin = 0;
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_comp_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_rstore: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_opa_1st: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_adc1: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_prech: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_l_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vref_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_cs: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vb_opa_fd: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(this, det, true, "vcom_adc2: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vref_h_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vb_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"vb_comp_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vcom_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"vref_rstore: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vb_opa_1st: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true,
|
||||
"vref_comp_fe: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vcom_adc1: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vref_prech: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vref_l_adc: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vref_cds: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(new qDacWidget(
|
||||
this, det, true, "vb_cs: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vb_opa_fd: ", getSLSIndex(detType, tempid++)));
|
||||
dacWidgets.push_back(
|
||||
new qDacWidget(this, det, true,
|
||||
"vcom_adc2: ", getSLSIndex(detType, tempid++)));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} CATCH_DISPLAY (std::string("Could not get dac/ adc index ") + std::to_string(tempid), "qTabDeveloper::SetupWidgetWindow")
|
||||
}
|
||||
CATCH_DISPLAY(std::string("Could not get dac/ adc index ") +
|
||||
std::to_string(tempid),
|
||||
"qTabDeveloper::SetupWidgetWindow")
|
||||
|
||||
for (size_t i = 0; i < dacWidgets.size(); ++i) {
|
||||
gridlayoutDac->addWidget(dacWidgets[i], i / 2, i % 2);
|
||||
}
|
||||
gridlayoutDac->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Expanding),dacWidgets.size(), 0);
|
||||
gridlayoutDac->addItem(
|
||||
new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Expanding),
|
||||
dacWidgets.size(), 0);
|
||||
for (size_t i = 0; i < adcWidgets.size(); ++i) {
|
||||
gridlayoutAdc->addWidget(adcWidgets[i], i / 2, i % 2);
|
||||
}
|
||||
gridlayoutAdc->addItem(new QSpacerItem(20,20,QSizePolicy::Fixed,QSizePolicy::Expanding),adcWidgets.size(), 0);
|
||||
gridlayoutAdc->addItem(
|
||||
new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Expanding),
|
||||
adcWidgets.size(), 0);
|
||||
|
||||
tabWidget->setCurrentIndex(0);
|
||||
|
||||
@ -154,10 +288,11 @@ void qTabDeveloper::SetupWidgetWindow() {
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
void qTabDeveloper::Initialization() {
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this, SLOT(Refresh()));
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
connect(comboDetector, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(Refresh()));
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetHighVoltage()));
|
||||
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
||||
}
|
||||
|
||||
@ -181,14 +316,17 @@ void qTabDeveloper::GetHighVoltage() {
|
||||
return;
|
||||
FILE_LOG(logDEBUG) << "Getting High Voltage";
|
||||
disconnect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
disconnect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetHighVoltage()));
|
||||
try {
|
||||
// dac units
|
||||
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1}).tsquash("Inconsistent values for high voltage.");
|
||||
auto retval = det->getHighVoltage({comboDetector->currentIndex() - 1})
|
||||
.tsquash("Inconsistent values for high voltage.");
|
||||
// spinHV
|
||||
if (spinHV->isVisible()) {
|
||||
if (retval != 0 && retval < hvmin && retval > HV_MAX) {
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") + std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
spinHV->setValue(retval);
|
||||
}
|
||||
@ -217,25 +355,32 @@ void qTabDeveloper::GetHighVoltage() {
|
||||
comboHV->setCurrentIndex(HV_200);
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") + std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown High Voltage: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get high voltage.", "qTabDeveloper::GetHighVoltage")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get high voltage.",
|
||||
"qTabDeveloper::GetHighVoltage")
|
||||
connect(spinHV, SIGNAL(editingFinished()), this, SLOT(SetHighVoltage()));
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this, SLOT(SetHighVoltage()));
|
||||
connect(comboHV, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetHighVoltage()));
|
||||
}
|
||||
|
||||
void qTabDeveloper::SetHighVoltage() {
|
||||
int val = (comboHV->isVisible() ? comboHV->currentText().toInt() : spinHV->value());
|
||||
int val = (comboHV->isVisible() ? comboHV->currentText().toInt()
|
||||
: spinHV->value());
|
||||
FILE_LOG(logINFO) << "Setting high voltage:" << val;
|
||||
|
||||
try {
|
||||
det->setHighVoltage({comboDetector->currentIndex() - 1});
|
||||
} CATCH_HANDLE ("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
||||
}
|
||||
CATCH_HANDLE("Could not set high voltage.", "qTabDeveloper::SetHighVoltage",
|
||||
this, &qTabDeveloper::GetHighVoltage)
|
||||
}
|
||||
|
||||
slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||
slsDetectorDefs::dacIndex
|
||||
qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorType detType, int index) {
|
||||
switch (detType) {
|
||||
|
||||
case slsDetectorDefs::EIGER:
|
||||
@ -287,7 +432,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 22:
|
||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
@ -313,7 +459,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 9:
|
||||
return slsDetectorDefs::TEMPERATURE_FPGA;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -338,7 +485,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 8:
|
||||
return slsDetectorDefs::TEMPERATURE_ADC;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -361,7 +509,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 7:
|
||||
return slsDetectorDefs::IBIAS_SFP;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -400,7 +549,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 15:
|
||||
return slsDetectorDefs::VDCSH;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -435,7 +585,8 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(slsDetectorDefs::detectorTy
|
||||
case 13:
|
||||
return slsDetectorDefs::VCOM_ADC2;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dac/adc index") +
|
||||
std::to_string(index));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -455,4 +606,3 @@ void qTabDeveloper::Refresh() {
|
||||
GetHighVoltage();
|
||||
FILE_LOG(logDEBUG) << "**Updated Developer Tab";
|
||||
}
|
||||
|
||||
|
381
slsDetectorGui/src/qTabMeasurement.cpp
Executable file → Normal file
381
slsDetectorGui/src/qTabMeasurement.cpp
Executable file → Normal file
@ -10,25 +10,26 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector, qDrawPlot *p) : QWidget(parent), det(detector), plot(p),
|
||||
progressTimer(nullptr) {
|
||||
qTabMeasurement::qTabMeasurement(QWidget *parent, sls::Detector *detector,
|
||||
qDrawPlot *p)
|
||||
: QWidget(parent), det(detector), plot(p), progressTimer(nullptr) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Measurement ready";
|
||||
}
|
||||
|
||||
qTabMeasurement::~qTabMeasurement() {
|
||||
delete progressTimer;
|
||||
}
|
||||
qTabMeasurement::~qTabMeasurement() { delete progressTimer; }
|
||||
|
||||
void qTabMeasurement::SetupWidgetWindow() {
|
||||
// palette
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active, QPalette::WindowText, Qt::red);
|
||||
acqPeriodTip = spinPeriod->toolTip();
|
||||
errPeriodTip = QString("<nobr>Frame period between exposures.</nobr><br>"
|
||||
errPeriodTip =
|
||||
QString("<nobr>Frame period between exposures.</nobr><br>"
|
||||
"<nobr> #period#</nobr><br><br>") +
|
||||
QString("<nobr><font color=\"red\"><b>Acquisition Period</b> should be"
|
||||
QString(
|
||||
"<nobr><font color=\"red\"><b>Acquisition Period</b> should be"
|
||||
" greater than or equal to <b>Exposure Time</b>.</font></nobr>");
|
||||
|
||||
// timer to update the progress bar
|
||||
@ -42,7 +43,8 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
spinDelay->setEnabled(true);
|
||||
comboDelayUnit->setEnabled(true);
|
||||
|
||||
// default is triggers and delay (not #bursts and burst period for gotthard2 in auto mode)
|
||||
// default is triggers and delay (not #bursts and burst period for gotthard2
|
||||
// in auto mode)
|
||||
ShowTriggerDelay();
|
||||
|
||||
// enabling according to det type
|
||||
@ -84,38 +86,52 @@ void qTabMeasurement::SetupWidgetWindow() {
|
||||
}
|
||||
|
||||
void qTabMeasurement::Initialization() {
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetTimingMode(int)));
|
||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumMeasurements(int)));
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumFrames(int)));
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumTriggers(int)));
|
||||
if (spinNumBursts->isEnabled()) {
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumBursts(int)));
|
||||
}
|
||||
if (spinNumSamples->isEnabled()) {
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumSamples(int)));
|
||||
}
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
if (spinDelay->isEnabled()) {
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDelay()));
|
||||
}
|
||||
if (spinBurstPeriod->isEnabled()) {
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
}
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
if (startingFnumImplemented) {
|
||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int)));
|
||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStartingFrameNumber(int)));
|
||||
}
|
||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
connect(btnStart, SIGNAL(clicked()), this, SLOT(StartAcquisition()));
|
||||
connect(btnStop, SIGNAL(clicked()), this, SLOT(StopAcquisition()));
|
||||
|
||||
}
|
||||
|
||||
void qTabMeasurement::ShowTriggerDelay() {
|
||||
@ -123,12 +139,16 @@ void qTabMeasurement::ShowTriggerDelay() {
|
||||
if (det->getDetectorType().squash() == slsDetectorDefs::GOTTHARD2) {
|
||||
try {
|
||||
FILE_LOG(logDEBUG) << "Getting burst mode";
|
||||
auto retval = det->getBurstMode().tsquash("Inconsistent burst mode for all detectors.");
|
||||
auto retval = det->getBurstMode().tsquash(
|
||||
"Inconsistent burst mode for all detectors.");
|
||||
// burst mode and auto timing mode
|
||||
if (retval != slsDetectorDefs::BURST_OFF && comboTimingMode->currentIndex() == AUTO) {
|
||||
if (retval != slsDetectorDefs::BURST_OFF &&
|
||||
comboTimingMode->currentIndex() == AUTO) {
|
||||
showTrigger = false;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get burst mode.", "qTabMeasurement::ShowTriggerDelay")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get burst mode.",
|
||||
"qTabMeasurement::ShowTriggerDelay")
|
||||
}
|
||||
|
||||
if (showTrigger) {
|
||||
@ -146,14 +166,15 @@ void qTabMeasurement::ShowTriggerDelay() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::SetupTimingMode() {
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel *>(comboTimingMode->model());
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboTimingMode->model());
|
||||
QModelIndex index[NUMTIMINGMODES];
|
||||
QStandardItem *item[NUMTIMINGMODES];
|
||||
if (model) {
|
||||
for (int i = 0; i < NUMTIMINGMODES; i++) {
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(), comboTimingMode->rootModelIndex());
|
||||
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
||||
comboTimingMode->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
}
|
||||
|
||||
@ -251,10 +272,12 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
||||
|
||||
void qTabMeasurement::GetTimingMode() {
|
||||
FILE_LOG(logDEBUG) << "Getting timing mode";
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetTimingMode(int)));
|
||||
try {
|
||||
auto oldMode = comboTimingMode->currentIndex();
|
||||
auto retval = det->getTimingMode().tsquash("Inconsistent timing mode for all detectors.");
|
||||
auto retval = det->getTimingMode().tsquash(
|
||||
"Inconsistent timing mode for all detectors.");
|
||||
switch (retval) {
|
||||
case slsDetectorDefs::AUTO_TIMING:
|
||||
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
||||
@ -267,18 +290,25 @@ void qTabMeasurement::GetTimingMode() {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown timing mode: ")+ std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown timing mode: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY("Could not get timing mode.", "qTabMeasurement::GetTimingMode")
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get timing mode.",
|
||||
"qTabMeasurement::GetTimingMode")
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetTimingMode(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetTimingMode(int val) {
|
||||
FILE_LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data();
|
||||
FILE_LOG(logINFO) << "Setting timing mode:"
|
||||
<< comboTimingMode->currentText().toAscii().data();
|
||||
try {
|
||||
det->setTimingMode(static_cast<slsDetectorDefs::timingMode>(val));
|
||||
EnableWidgetsforTimingMode();
|
||||
} CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode", this, &qTabMeasurement::GetTimingMode)
|
||||
}
|
||||
CATCH_HANDLE("Could not set timing mode.", "qTabMeasurement::SetTimingMode",
|
||||
this, &qTabMeasurement::GetTimingMode)
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumMeasurements(int val) {
|
||||
@ -288,132 +318,190 @@ void qTabMeasurement::SetNumMeasurements(int val) {
|
||||
|
||||
void qTabMeasurement::GetNumFrames() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of frames";
|
||||
disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
disconnect(spinNumFrames, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumFrames(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfFrames().tsquash("Inconsistent number of frames for all detectors.");
|
||||
auto retval = det->getNumberOfFrames().tsquash(
|
||||
"Inconsistent number of frames for all detectors.");
|
||||
spinNumFrames->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumFrames")
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of frames.",
|
||||
"qTabMeasurement::GetNumFrames")
|
||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumFrames(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumFrames(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of frames to " << val;
|
||||
try {
|
||||
det->setNumberOfFrames(val);
|
||||
} CATCH_HANDLE("Could not set number of frames.", "qTabMeasurement::SetNumFrames", this, &qTabMeasurement::GetNumFrames)
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of frames.",
|
||||
"qTabMeasurement::SetNumFrames", this,
|
||||
&qTabMeasurement::GetNumFrames)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumTriggers() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of triggers";
|
||||
disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
disconnect(spinNumTriggers, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumTriggers(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfTriggers().tsquash("Inconsistent number of triggers for all detectors.");
|
||||
auto retval = det->getNumberOfTriggers().tsquash(
|
||||
"Inconsistent number of triggers for all detectors.");
|
||||
spinNumTriggers->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumTriggers")
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of frames.",
|
||||
"qTabMeasurement::GetNumTriggers")
|
||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumTriggers(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumTriggers(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of triggers to " << val;
|
||||
try {
|
||||
det->setNumberOfTriggers(val);
|
||||
} CATCH_HANDLE("Could not set number of triggers.", "qTabMeasurement::SetNumTriggers", this, &qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of triggers.",
|
||||
"qTabMeasurement::SetNumTriggers", this,
|
||||
&qTabMeasurement::GetNumTriggers)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumBursts() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of bursts";
|
||||
disconnect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
disconnect(spinNumBursts, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumBursts(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfBursts().tsquash("Inconsistent number of bursts for all detectors.");
|
||||
auto retval = det->getNumberOfBursts().tsquash(
|
||||
"Inconsistent number of bursts for all detectors.");
|
||||
spinNumBursts->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of frames.", "qTabMeasurement::GetNumBursts")
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this, SLOT(SetNumBursts(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of frames.",
|
||||
"qTabMeasurement::GetNumBursts")
|
||||
connect(spinNumBursts, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumBursts(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumBursts(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of bursts to " << val;
|
||||
try {
|
||||
det->setNumberOfBursts(val);
|
||||
} CATCH_HANDLE("Could not set number of bursts.", "qTabMeasurement::SetNumBursts", this, &qTabMeasurement::GetNumBursts)
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of bursts.",
|
||||
"qTabMeasurement::SetNumBursts", this,
|
||||
&qTabMeasurement::GetNumBursts)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetNumSamples() {
|
||||
FILE_LOG(logDEBUG) << "Getting number of samples";
|
||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumSamples(int)));
|
||||
try {
|
||||
auto retval = det->getNumberOfAnalogSamples().tsquash("Inconsistent number of analog samples for all detectors.");
|
||||
auto retval = det->getNumberOfAnalogSamples().tsquash(
|
||||
"Inconsistent number of analog samples for all detectors.");
|
||||
spinNumSamples->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get number of samples.", "qTabMeasurement::GetNumSamples")
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get number of samples.",
|
||||
"qTabMeasurement::GetNumSamples")
|
||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetNumSamples(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetNumSamples(int val) {
|
||||
FILE_LOG(logINFO) << "Setting number of samples to " << val;
|
||||
try {
|
||||
det->setNumberOfAnalogSamples(val);
|
||||
} CATCH_HANDLE("Could not set number of samples.", "qTabMeasurement::SetNumSamples", this, &qTabMeasurement::GetNumSamples)
|
||||
}
|
||||
CATCH_HANDLE("Could not set number of samples.",
|
||||
"qTabMeasurement::SetNumSamples", this,
|
||||
&qTabMeasurement::GetNumSamples)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetExposureTime() {
|
||||
FILE_LOG(logDEBUG) << "Getting exposure time";
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
try {
|
||||
spinExpTime->setValue(-1);
|
||||
auto retval = det->getExptime().tsquash("Inconsistent exposure time for all detectors.");
|
||||
auto retval = det->getExptime().tsquash(
|
||||
"Inconsistent exposure time for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinExpTime->setValue(time.first);
|
||||
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_DISPLAY ("Could not get exposure time.", "qTabMeasurement::GetExposureTime")
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get exposure time.",
|
||||
"qTabMeasurement::GetExposureTime")
|
||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetExposureTime()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetExposureTime() {
|
||||
auto val = spinExpTime->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting exposure time to " << val << " " << qDefs::getUnitString(unit);
|
||||
FILE_LOG(logINFO) << "Setting exposure time to " << val << " "
|
||||
<< qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setExptime(timeNS);
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_HANDLE("Could not set exposure time.", "qTabMeasurement::SetExposureTime", this, &qTabMeasurement::GetExposureTime)
|
||||
}
|
||||
CATCH_HANDLE("Could not set exposure time.",
|
||||
"qTabMeasurement::SetExposureTime", this,
|
||||
&qTabMeasurement::GetExposureTime)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetAcquisitionPeriod() {
|
||||
FILE_LOG(logDEBUG) << "Getting acquisition period";
|
||||
disconnect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
disconnect(spinPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
disconnect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
try {
|
||||
spinPeriod->setValue(-1);
|
||||
auto retval = det->getPeriod().tsquash("Inconsistent acquisition period for all detectors.");
|
||||
auto retval = det->getPeriod().tsquash(
|
||||
"Inconsistent acquisition period for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinPeriod->setValue(time.first);
|
||||
comboPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_DISPLAY ("Could not get acquisition period.", "qTabMeasurement::GetAcquisitionPeriod")
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetAcquisitionPeriod()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get acquisition period.",
|
||||
"qTabMeasurement::GetAcquisitionPeriod")
|
||||
connect(spinPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
connect(comboPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetAcquisitionPeriod()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetAcquisitionPeriod() {
|
||||
auto val = spinPeriod->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting acquisition period to " << val << " " << qDefs::getUnitString(unit);
|
||||
FILE_LOG(logINFO) << "Setting acquisition period to " << val << " "
|
||||
<< qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setPeriod(timeNS);
|
||||
CheckAcqPeriodGreaterThanExp();
|
||||
} CATCH_HANDLE("Could not set acquisition period.", "qTabMeasurement::SetAcquisitionPeriod", this, &qTabMeasurement::GetAcquisitionPeriod)
|
||||
}
|
||||
CATCH_HANDLE("Could not set acquisition period.",
|
||||
"qTabMeasurement::SetAcquisitionPeriod", this,
|
||||
&qTabMeasurement::GetAcquisitionPeriod)
|
||||
}
|
||||
|
||||
void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
|
||||
FILE_LOG(logDEBUG) << "Checking period >= exptime";
|
||||
bool error = false;
|
||||
if (lblPeriod->isEnabled()) {
|
||||
auto exptimeNS = qDefs::getNSTime(std::make_pair(spinExpTime->value(), static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex())));
|
||||
auto acqtimeNS = qDefs::getNSTime(std::make_pair(spinPeriod->value(), static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex())));
|
||||
auto exptimeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinExpTime->value(),
|
||||
static_cast<qDefs::timeUnit>(comboExpUnit->currentIndex())));
|
||||
auto acqtimeNS = qDefs::getNSTime(std::make_pair(
|
||||
spinPeriod->value(),
|
||||
static_cast<qDefs::timeUnit>(comboPeriodUnit->currentIndex())));
|
||||
if (exptimeNS > acqtimeNS) {
|
||||
error = true;
|
||||
spinPeriod->setToolTip(errPeriodTip);
|
||||
@ -434,53 +522,71 @@ void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
|
||||
void qTabMeasurement::GetDelay() {
|
||||
FILE_LOG(logDEBUG) << "Getting delay";
|
||||
disconnect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
disconnect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDelay()));
|
||||
try {
|
||||
spinDelay->setValue(-1);
|
||||
auto retval = det->getDelayAfterTrigger().tsquash("Inconsistent delay for all detectors.");
|
||||
auto retval = det->getDelayAfterTrigger().tsquash(
|
||||
"Inconsistent delay for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinDelay->setValue(time.first);
|
||||
comboDelayUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get delay.", "qTabMeasurement::GetDelay")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get delay.", "qTabMeasurement::GetDelay")
|
||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetDelay()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetDelay() {
|
||||
auto val = spinDelay->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboDelayUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting delay to " << val << " " << qDefs::getUnitString(unit);
|
||||
FILE_LOG(logINFO) << "Setting delay to " << val << " "
|
||||
<< qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setDelayAfterTrigger(timeNS);
|
||||
} CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this, &qTabMeasurement::GetDelay)
|
||||
}
|
||||
CATCH_HANDLE("Could not set delay.", "qTabMeasurement::SetDelay", this,
|
||||
&qTabMeasurement::GetDelay)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetBurstPeriod() {
|
||||
FILE_LOG(logDEBUG) << "Getting Burst Period";
|
||||
disconnect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
disconnect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
disconnect(spinBurstPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
disconnect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
try {
|
||||
spinBurstPeriod->setValue(-1);
|
||||
auto retval = det->getBurstPeriod().tsquash("Inconsistent burst period for all detectors.");
|
||||
auto retval = det->getBurstPeriod().tsquash(
|
||||
"Inconsistent burst period for all detectors.");
|
||||
auto time = qDefs::getUserFriendlyTime(retval);
|
||||
spinBurstPeriod->setValue(time.first);
|
||||
comboBurstPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get burst period.", "qTabMeasurement::GetBurstPeriod")
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this, SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetBurstPeriod()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get burst period.",
|
||||
"qTabMeasurement::GetBurstPeriod")
|
||||
connect(spinBurstPeriod, SIGNAL(valueChanged(double)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
connect(comboBurstPeriodUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetBurstPeriod()));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetBurstPeriod() {
|
||||
auto val = spinBurstPeriod->value();
|
||||
auto unit = static_cast<qDefs::timeUnit>(comboBurstPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting burst period to " << val << " " << qDefs::getUnitString(unit);
|
||||
auto unit =
|
||||
static_cast<qDefs::timeUnit>(comboBurstPeriodUnit->currentIndex());
|
||||
FILE_LOG(logINFO) << "Setting burst period to " << val << " "
|
||||
<< qDefs::getUnitString(unit);
|
||||
try {
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(val, unit));
|
||||
det->setBurstPeriod(timeNS);
|
||||
} CATCH_HANDLE("Could not set burst period.", "qTabMeasurement::SetBurstPeriod", this, &qTabMeasurement::GetBurstPeriod)
|
||||
}
|
||||
|
||||
CATCH_HANDLE("Could not set burst period.",
|
||||
"qTabMeasurement::SetBurstPeriod", this,
|
||||
&qTabMeasurement::GetBurstPeriod)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileWrite() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
||||
@ -489,12 +595,15 @@ void qTabMeasurement::GetFileWrite() {
|
||||
dispFileName->setEnabled(true); // default, even when exception
|
||||
lblIndex->setEnabled(true);
|
||||
spinIndex->setEnabled(true);
|
||||
auto retval = det->getFileWrite().tsquash("Inconsistent file write for all detectors.");
|
||||
auto retval = det->getFileWrite().tsquash(
|
||||
"Inconsistent file write for all detectors.");
|
||||
chkFile->setChecked(retval);
|
||||
dispFileName->setEnabled(retval);
|
||||
lblIndex->setEnabled(retval);
|
||||
spinIndex->setEnabled(retval);
|
||||
} CATCH_DISPLAY ("Could not get file over write enable.", "qTabMeasurement::GetFileWrite")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file over write enable.",
|
||||
"qTabMeasurement::GetFileWrite")
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
}
|
||||
|
||||
@ -505,16 +614,23 @@ void qTabMeasurement::SetFileWrite(bool val) {
|
||||
dispFileName->setEnabled(val);
|
||||
lblIndex->setEnabled(val);
|
||||
spinIndex->setEnabled(val);
|
||||
} CATCH_HANDLE("Could not set file write enable.", "qTabMeasurement::SetFileWrite", this, &qTabMeasurement::GetFileWrite)
|
||||
}
|
||||
CATCH_HANDLE("Could not set file write enable.",
|
||||
"qTabMeasurement::SetFileWrite", this,
|
||||
&qTabMeasurement::GetFileWrite)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetFileName() {
|
||||
FILE_LOG(logDEBUG) << "Getting file name prefix";
|
||||
disconnect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
disconnect(dispFileName, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetFileName()));
|
||||
try {
|
||||
auto retval = det->getFileNamePrefix().tsquash("Inconsistent file name prefix for all detectors.");
|
||||
auto retval = det->getFileNamePrefix().tsquash(
|
||||
"Inconsistent file name prefix for all detectors.");
|
||||
dispFileName->setText(QString(retval.c_str()));
|
||||
} CATCH_DISPLAY ("Could not get file name prefix.", "qTabMeasurement::GetFileName")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get file name prefix.",
|
||||
"qTabMeasurement::GetFileName")
|
||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||
}
|
||||
|
||||
@ -523,18 +639,25 @@ void qTabMeasurement::SetFileName() {
|
||||
FILE_LOG(logINFO) << "Setting File Name Prefix:" << val;
|
||||
try {
|
||||
det->setFileNamePrefix(val);
|
||||
} CATCH_HANDLE("Could not set file name prefix.", "qTabMeasurement::SetFileName", this, &qTabMeasurement::GetFileName)
|
||||
}
|
||||
CATCH_HANDLE("Could not set file name prefix.",
|
||||
"qTabMeasurement::SetFileName", this,
|
||||
&qTabMeasurement::GetFileName)
|
||||
|
||||
emit FileNameChangedSignal(dispFileName->text());
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetRunIndex() {
|
||||
FILE_LOG(logDEBUG) << "Getting Acquisition File index";
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetRunIndex(int)));
|
||||
try {
|
||||
auto retval = det->getAcquisitionIndex().tsquash("Inconsistent file index for all detectors.");
|
||||
auto retval = det->getAcquisitionIndex().tsquash(
|
||||
"Inconsistent file index for all detectors.");
|
||||
spinIndex->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get acquisition file index.", "qTabMeasurement::GetRunIndex")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get acquisition file index.",
|
||||
"qTabMeasurement::GetRunIndex")
|
||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||
}
|
||||
|
||||
@ -542,24 +665,35 @@ void qTabMeasurement::SetRunIndex(int val) {
|
||||
FILE_LOG(logINFO) << "Setting Acquisition File Index to " << val;
|
||||
try {
|
||||
det->setAcquisitionIndex(val);
|
||||
} CATCH_HANDLE("Could not set acquisition file index.", "qTabMeasurement::SetRunIndex", this, &qTabMeasurement::GetRunIndex)
|
||||
}
|
||||
CATCH_HANDLE("Could not set acquisition file index.",
|
||||
"qTabMeasurement::SetRunIndex", this,
|
||||
&qTabMeasurement::GetRunIndex)
|
||||
}
|
||||
|
||||
void qTabMeasurement::GetStartingFrameNumber() {
|
||||
FILE_LOG(logDEBUG) << "Getting Starting Frame Number";
|
||||
disconnect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int)));
|
||||
disconnect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStartingFrameNumber(int)));
|
||||
try {
|
||||
auto retval = det->getStartingFrameNumber().tsquash("Inconsistent starting frame number for all detectors.");
|
||||
auto retval = det->getStartingFrameNumber().tsquash(
|
||||
"Inconsistent starting frame number for all detectors.");
|
||||
spinStartingFrameNumber->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get starting frame number.", "qTabMeasurement::GetStartingFrameNumber")
|
||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this, SLOT(SetStartingFrameNumber(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get starting frame number.",
|
||||
"qTabMeasurement::GetStartingFrameNumber")
|
||||
connect(spinStartingFrameNumber, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetStartingFrameNumber(int)));
|
||||
}
|
||||
|
||||
void qTabMeasurement::SetStartingFrameNumber(int val) {
|
||||
FILE_LOG(logINFO) << "Setting Starting frame number to " << val;
|
||||
try {
|
||||
det->setStartingFrameNumber(val);
|
||||
} CATCH_HANDLE("Could not set starting frame number.", "qTabMeasurement::SetStartingFrameNumber", this, &qTabMeasurement::GetStartingFrameNumber)
|
||||
}
|
||||
CATCH_HANDLE("Could not set starting frame number.",
|
||||
"qTabMeasurement::SetStartingFrameNumber", this,
|
||||
&qTabMeasurement::GetStartingFrameNumber)
|
||||
}
|
||||
|
||||
void qTabMeasurement::ResetProgress() {
|
||||
@ -583,25 +717,32 @@ int qTabMeasurement::VerifyOutputDirectoryError() {
|
||||
det->setFilePath(it);
|
||||
}
|
||||
return slsDetectorDefs::OK;
|
||||
} CATCH_DISPLAY ("Could not set path.", "qTabMeasurement::VerifyOutputDirectoryError")
|
||||
}
|
||||
CATCH_DISPLAY("Could not set path.",
|
||||
"qTabMeasurement::VerifyOutputDirectoryError")
|
||||
return slsDetectorDefs::FAIL; // for exception
|
||||
}
|
||||
|
||||
void qTabMeasurement::StartAcquisition() {
|
||||
btnStart->setEnabled(false);
|
||||
// if file write enabled and output dir doesnt exist
|
||||
if ((chkFile->isChecked()) && (VerifyOutputDirectoryError() == slsDetectorDefs::FAIL)) {
|
||||
if (qDefs::Message(qDefs::QUESTION,
|
||||
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>",
|
||||
if ((chkFile->isChecked()) &&
|
||||
(VerifyOutputDirectoryError() == slsDetectorDefs::FAIL)) {
|
||||
if (qDefs::Message(
|
||||
qDefs::QUESTION,
|
||||
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable "
|
||||
"File write and Proceed with acquisition anyway?</nobr>",
|
||||
"qTabMeasurement::StartAcquisition") == slsDetectorDefs::FAIL) {
|
||||
btnStart->setEnabled(true);
|
||||
return;
|
||||
} else {
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
disconnect(chkFile, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetFileWrite(bool)));
|
||||
chkFile->setChecked(false);
|
||||
// cannot wait for signals from chkFile
|
||||
SetFileWrite(false);
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||
connect(chkFile, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetFileWrite(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -616,13 +757,14 @@ void qTabMeasurement::StartAcquisition() {
|
||||
emit EnableTabsSignal(false);
|
||||
}
|
||||
|
||||
|
||||
void qTabMeasurement::StopAcquisition() {
|
||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||
try {
|
||||
isAcquisitionStopped = true;
|
||||
det->stopDetector();
|
||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
CATCH_DISPLAY("Could not stop acquisition.",
|
||||
"qTabMeasurement::StopAcquisition")
|
||||
}
|
||||
|
||||
void qTabMeasurement::AcquireFinished() {
|
||||
@ -634,9 +776,11 @@ void qTabMeasurement::AcquireFinished() {
|
||||
if (startingFnumImplemented) {
|
||||
GetStartingFrameNumber();
|
||||
}
|
||||
FILE_LOG(logDEBUG) << "Measurement " << currentMeasurement << " finished";
|
||||
FILE_LOG(logDEBUG) << "Measurement " << currentMeasurement
|
||||
<< " finished";
|
||||
// next measurement if acq is not stopped
|
||||
if (!isAcquisitionStopped && ((currentMeasurement + 1) < numMeasurements)) {
|
||||
if (!isAcquisitionStopped &&
|
||||
((currentMeasurement + 1) < numMeasurements)) {
|
||||
++currentMeasurement;
|
||||
plot->StartAcquisition();
|
||||
}
|
||||
@ -662,7 +806,8 @@ void qTabMeasurement::Enable(bool enable) {
|
||||
frameNotTimeResolved->setEnabled(enable);
|
||||
|
||||
// shortcut each time, else it doesnt work a second time
|
||||
btnStart->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
||||
btnStart->setShortcut(QApplication::translate(
|
||||
"TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
||||
}
|
||||
|
||||
void qTabMeasurement::Refresh() {
|
||||
|
54
slsDetectorGui/src/qTabMessages.cpp
Executable file → Normal file
54
slsDetectorGui/src/qTabMessages.cpp
Executable file → Normal file
@ -1,12 +1,12 @@
|
||||
#include "qTabMessages.h"
|
||||
#include "qDefs.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QDir>
|
||||
#include <QProcess>
|
||||
#include <QKeyEvent>
|
||||
#include <QProcess>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -41,28 +41,28 @@ void qTabMessages::keyPressEvent(QKeyEvent* event) {
|
||||
// cout<<"inside KeyPressEvent()\n";
|
||||
if (event->key() == Qt::Key_Up) {
|
||||
GetLastCommand();
|
||||
}
|
||||
else if (event->key() == Qt::Key_Down) {
|
||||
} else if (event->key() == Qt::Key_Down) {
|
||||
ClearCommand();
|
||||
}
|
||||
/* else if((event->key() == Qt::Key_Return) ||(event->key() == Qt::Key_Enter)) {
|
||||
ExecuteCommand();
|
||||
}*/ else {
|
||||
/* else if((event->key() == Qt::Key_Return) ||(event->key() ==
|
||||
Qt::Key_Enter)) { ExecuteCommand();
|
||||
}*/
|
||||
else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabMessages::PrintNextLine() {
|
||||
dispLog->append(QString("<font color = \"DarkGrey\">") + QDir::current().dirName() + QString("$ ") + QString("</font>"));
|
||||
dispLog->append(QString("<font color = \"DarkGrey\">") +
|
||||
QDir::current().dirName() + QString("$ ") +
|
||||
QString("</font>"));
|
||||
}
|
||||
|
||||
void qTabMessages::GetLastCommand() {
|
||||
dispCommand->setText(lastCommand.join(" "));
|
||||
}
|
||||
|
||||
void qTabMessages::ClearCommand() {
|
||||
dispCommand->setText("");
|
||||
}
|
||||
void qTabMessages::ClearCommand() { dispCommand->setText(""); }
|
||||
|
||||
void qTabMessages::ExecuteCommand() {
|
||||
QStringList param = dispCommand->text().split(" ");
|
||||
@ -71,11 +71,14 @@ void qTabMessages::ExecuteCommand() {
|
||||
dispCommand->clear();
|
||||
// appending command to log without newline
|
||||
dispLog->moveCursor(QTextCursor::End);
|
||||
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") + param.join(" ") + QString("</font>"));
|
||||
dispLog->insertHtml(QString("<font color = \"DarkBlue\">") +
|
||||
param.join(" ") + QString("</font>"));
|
||||
|
||||
QString command = param.at(0);
|
||||
param.removeFirst();
|
||||
FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData() << "] with Arguments:[" << param.join(" ").toAscii().constData() << "]";
|
||||
FILE_LOG(logINFO) << "Executing Command:[" << command.toAscii().constData()
|
||||
<< "] with Arguments:["
|
||||
<< param.join(" ").toAscii().constData() << "]";
|
||||
|
||||
process->setProcessChannelMode(QProcess::MergedChannels);
|
||||
process->start(command, param);
|
||||
@ -89,34 +92,40 @@ void qTabMessages::ExecuteCommand() {
|
||||
void qTabMessages::AppendOutput() {
|
||||
QByteArray result = process->readAll();
|
||||
result.replace("\n", "<br>");
|
||||
dispLog->append(QString("<font color = \"DarkBlue\">") + result + QString("</font>"));
|
||||
dispLog->append(QString("<font color = \"DarkBlue\">") + result +
|
||||
QString("</font>"));
|
||||
FILE_LOG(logDEBUG) << "Command executed successfully";
|
||||
PrintNextLine();
|
||||
}
|
||||
|
||||
void qTabMessages::AppendError() {
|
||||
dispLog->append(QString("<font color = \"Red\">") + process->errorString() + QString("</font>"));
|
||||
dispLog->append(QString("<font color = \"Red\">") + process->errorString() +
|
||||
QString("</font>"));
|
||||
FILE_LOG(logERROR) << "Error executing command";
|
||||
PrintNextLine();
|
||||
}
|
||||
|
||||
|
||||
void qTabMessages::SaveLog() {
|
||||
QString fName = QDir::cleanPath(QDir::currentPath()) + "/LogFile.txt";
|
||||
fName = QFileDialog::getSaveFileName(this, tr("Save Snapshot "),
|
||||
fName, tr("Text files (*.txt);;All Files(*)"));
|
||||
fName =
|
||||
QFileDialog::getSaveFileName(this, tr("Save Snapshot "), fName,
|
||||
tr("Text files (*.txt);;All Files(*)"));
|
||||
if (!fName.isEmpty()) {
|
||||
QFile outfile;
|
||||
outfile.setFileName(fName);
|
||||
if (outfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
|
||||
QTextStream out(&outfile);
|
||||
out << dispLog->toPlainText() << endl;
|
||||
std::string mess = std::string("The Log has been successfully saved to ") + fName.toAscii().constData();
|
||||
std::string mess =
|
||||
std::string("The Log has been successfully saved to ") +
|
||||
fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::INFORMATION, mess, "TabMessages::SaveLog");
|
||||
FILE_LOG(logINFO) << mess;
|
||||
} else {
|
||||
FILE_LOG(logWARNING) << "Attempt to save log file failed: " << fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.", "qTabMessages::SaveLog");
|
||||
FILE_LOG(logWARNING) << "Attempt to save log file failed: "
|
||||
<< fName.toAscii().constData();
|
||||
qDefs::Message(qDefs::WARNING, "Attempt to save log file failed.",
|
||||
"qTabMessages::SaveLog");
|
||||
}
|
||||
}
|
||||
dispCommand->setFocus();
|
||||
@ -133,4 +142,3 @@ void qTabMessages::Refresh() {
|
||||
dispCommand->clear();
|
||||
dispCommand->setFocus();
|
||||
}
|
||||
|
||||
|
268
slsDetectorGui/src/qTabPlot.cpp
Executable file → Normal file
268
slsDetectorGui/src/qTabPlot.cpp
Executable file → Normal file
@ -2,10 +2,10 @@
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
|
||||
#include <QStandardItemModel>
|
||||
#include <QStackedLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QAbstractButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QStackedLayout>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
@ -18,17 +18,14 @@ QString qTabPlot::defaultImageXAxisTitle("Pixel");
|
||||
QString qTabPlot::defaultImageYAxisTitle("Pixel");
|
||||
QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
||||
|
||||
|
||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p) :
|
||||
QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||
qTabPlot::qTabPlot(QWidget *parent, sls::Detector *detector, qDrawPlot *p)
|
||||
: QWidget(parent), det(detector), plot(p), is1d(false) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Plot ready";
|
||||
}
|
||||
|
||||
qTabPlot::~qTabPlot() {
|
||||
delete btnGroupPlotType;
|
||||
}
|
||||
qTabPlot::~qTabPlot() { delete btnGroupPlotType; }
|
||||
|
||||
void qTabPlot::SetupWidgetWindow() {
|
||||
// button group for plot type
|
||||
@ -86,13 +83,18 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
|
||||
void qTabPlot::Initialization() {
|
||||
// Plot arguments box
|
||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
|
||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this,
|
||||
SLOT(SetPlot()));
|
||||
|
||||
// Plotting frequency box
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
|
||||
// navigation buttons for options
|
||||
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
||||
@ -101,28 +103,40 @@ void qTabPlot::Initialization() {
|
||||
connect(btnLeft2D, SIGNAL(clicked()), this, SLOT(Set2DPlotOptionsLeft()));
|
||||
|
||||
// 1D options
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot, SLOT(SetPersistency(int)));
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this,
|
||||
SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency, SIGNAL(valueChanged(int)), plot,
|
||||
SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), plot, SLOT(SetMarkers(bool)));
|
||||
connect(chkLines, SIGNAL(toggled(bool)), plot, SLOT(SetLines(bool)));
|
||||
connect(chk1DLog, SIGNAL(toggled(bool)), plot, SLOT(Set1dLogY(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
connect(chkStatistics, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(DisplayStatistics(bool)));
|
||||
|
||||
// 2D Plot box
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot, SLOT(SetInterpolate(bool)));
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetInterpolate(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)), plot, SLOT(SetContour(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)), plot, SLOT(SetLogz(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot, SLOT(DisplayStatistics(bool)));
|
||||
connect(chkStatistics_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(DisplayStatistics(bool)));
|
||||
// pedstal
|
||||
connect(chkPedestal, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot, SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot, SLOT(RecalculatePedestal()));
|
||||
connect(btnRecalPedestal, SIGNAL(clicked()), plot,
|
||||
SLOT(RecalculatePedestal()));
|
||||
connect(chkPedestal_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetPedestal(bool)));
|
||||
connect(btnRecalPedestal_2, SIGNAL(clicked()), plot,
|
||||
SLOT(RecalculatePedestal()));
|
||||
// accumulate
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot, SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot, SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate, SIGNAL(clicked()), plot,
|
||||
SLOT(ResetAccumulate()));
|
||||
connect(chkAccumulate_2, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(SetAccumulate(bool)));
|
||||
connect(btnResetAccumulate_2, SIGNAL(clicked()), plot,
|
||||
SLOT(ResetAccumulate()));
|
||||
// binary
|
||||
connect(chkBinary, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
connect(chkBinary_2, SIGNAL(toggled(bool)), this, SLOT(SetBinary()));
|
||||
@ -132,12 +146,15 @@ void qTabPlot::Initialization() {
|
||||
connect(spinTo_2, SIGNAL(valueChanged(int)), this, SLOT(SetBinary()));
|
||||
// gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(EnableGainPlot(bool)));
|
||||
if (chkGainPlot1D->isEnabled())
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot,
|
||||
SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
|
||||
// Save, clone
|
||||
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
||||
@ -148,10 +165,14 @@ void qTabPlot::Initialization() {
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
|
||||
connect(chkXMin, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
connect(chkXMax, SIGNAL(toggled(bool)), this, SLOT(SetXRange()));
|
||||
@ -161,7 +182,8 @@ void qTabPlot::Initialization() {
|
||||
connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetXRange()));
|
||||
connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this, SLOT(CheckAspectRatio()));
|
||||
connect(chkAspectRatio, SIGNAL(toggled(bool)), this,
|
||||
SLOT(CheckAspectRatio()));
|
||||
|
||||
connect(chkZMin, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(SetZRange()));
|
||||
@ -220,7 +242,8 @@ void qTabPlot::Set1DPlotOptionsRight() {
|
||||
stackedWidget1D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i + 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
@ -230,7 +253,8 @@ void qTabPlot::Set1DPlotOptionsLeft() {
|
||||
stackedWidget1D->setCurrentIndex(stackedWidget1D->count() - 1);
|
||||
else
|
||||
stackedWidget1D->setCurrentIndex(i - 1);
|
||||
box1D->setTitle(QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
box1D->setTitle(
|
||||
QString("1D Plot Options %1").arg(stackedWidget1D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsRight() {
|
||||
@ -240,7 +264,8 @@ void qTabPlot::Set2DPlotOptionsRight() {
|
||||
stackedWidget2D->setCurrentIndex(0);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i + 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
@ -250,7 +275,8 @@ void qTabPlot::Set2DPlotOptionsLeft() {
|
||||
stackedWidget2D->setCurrentIndex(stackedWidget2D->count() - 1);
|
||||
else
|
||||
stackedWidget2D->setCurrentIndex(i - 1);
|
||||
box2D->setTitle(QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
box2D->setTitle(
|
||||
QString("2D Plot Options %1").arg(stackedWidget2D->currentIndex() + 1));
|
||||
}
|
||||
|
||||
void qTabPlot::EnablePersistency(bool enable) {
|
||||
@ -267,14 +293,16 @@ void qTabPlot::SetBinary() {
|
||||
bool binary1D = chkBinary->isChecked();
|
||||
bool binary2D = chkBinary_2->isChecked();
|
||||
if (is1d) {
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary1D ? "enabled" : "disabled");
|
||||
FILE_LOG(logINFO) << "Binary Plot "
|
||||
<< (binary1D ? "enabled" : "disabled");
|
||||
lblFrom->setEnabled(binary1D);
|
||||
lblTo->setEnabled(binary1D);
|
||||
spinFrom->setEnabled(binary1D);
|
||||
spinTo->setEnabled(binary1D);
|
||||
plot->SetBinary(binary1D, spinFrom->value(), spinTo->value());
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Binary Plot " << (binary2D ? "enabled" : "disabled");
|
||||
FILE_LOG(logINFO) << "Binary Plot "
|
||||
<< (binary2D ? "enabled" : "disabled");
|
||||
lblFrom_2->setEnabled(binary2D);
|
||||
lblTo_2->setEnabled(binary2D);
|
||||
spinFrom_2->setEnabled(binary2D);
|
||||
@ -285,19 +313,25 @@ void qTabPlot::SetBinary() {
|
||||
|
||||
void qTabPlot::GetGapPixels() {
|
||||
FILE_LOG(logDEBUG) << "Getting gap pixels";
|
||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
disconnect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
try {
|
||||
auto retval = det->getRxAddGapPixels().tsquash("Inconsistent gap pixels enabled for all detectors.");
|
||||
auto retval = det->getRxAddGapPixels().tsquash(
|
||||
"Inconsistent gap pixels enabled for all detectors.");
|
||||
chkGapPixels->setChecked(retval);
|
||||
} CATCH_DISPLAY ("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get gap pixels enable.", "qTabPlot::GetGapPixels")
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this,
|
||||
SLOT(SetGapPixels(bool)));
|
||||
}
|
||||
|
||||
void qTabPlot::SetGapPixels(bool enable) {
|
||||
FILE_LOG(logINFO) << "Setting Gap Pixels Enable to " << enable;
|
||||
try {
|
||||
det->setRxAddGapPixels(enable);
|
||||
} CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels", this, &qTabPlot::GetGapPixels)
|
||||
}
|
||||
CATCH_HANDLE("Could not set gap pixels enable.", "qTabPlot::SetGapPixels",
|
||||
this, &qTabPlot::GetGapPixels)
|
||||
}
|
||||
|
||||
void qTabPlot::SetTitles() {
|
||||
@ -306,10 +340,14 @@ void qTabPlot::SetTitles() {
|
||||
disconnect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
disconnect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
disconnect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
|
||||
// title
|
||||
if (!chkTitle->isChecked() || dispTitle->text().isEmpty()) {
|
||||
@ -320,15 +358,19 @@ void qTabPlot::SetTitles() {
|
||||
}
|
||||
// x
|
||||
if (!chkXAxis->isChecked() || dispXAxis->text().isEmpty()) {
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle : defaultImageXAxisTitle);
|
||||
dispXAxis->setText(is1d ? defaultHistXAxisTitle
|
||||
: defaultImageXAxisTitle);
|
||||
plot->SetXAxisTitle(is1d ? defaultHistXAxisTitle
|
||||
: defaultImageXAxisTitle);
|
||||
} else {
|
||||
plot->SetXAxisTitle(dispXAxis->text());
|
||||
}
|
||||
// y
|
||||
if (!chkYAxis->isChecked() || dispYAxis->text().isEmpty()) {
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle : defaultImageYAxisTitle);
|
||||
dispYAxis->setText(is1d ? defaultHistYAxisTitle
|
||||
: defaultImageYAxisTitle);
|
||||
plot->SetYAxisTitle(is1d ? defaultHistYAxisTitle
|
||||
: defaultImageYAxisTitle);
|
||||
} else {
|
||||
plot->SetYAxisTitle(dispYAxis->text());
|
||||
}
|
||||
@ -344,10 +386,14 @@ void qTabPlot::SetTitles() {
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(chkZAxis, SIGNAL(toggled(bool)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this, SLOT(SetTitles()));
|
||||
connect(dispTitle, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispXAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispYAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
connect(dispZAxis, SIGNAL(textChanged(const QString &)), this,
|
||||
SLOT(SetTitles()));
|
||||
}
|
||||
|
||||
void qTabPlot::SetXRange() {
|
||||
@ -384,13 +430,18 @@ void qTabPlot::SetXYRange() {
|
||||
bool isRange[4]{false, false, false, false};
|
||||
double xyRange[4]{0, 0, 0, 0};
|
||||
|
||||
QString dispVal[4] {dispXMin->text(), dispXMax->text(), dispYMin->text(), dispYMax->text()};
|
||||
bool chkVal[4] {chkXMin->isChecked(), chkXMax->isChecked(), chkYMin->isChecked(), chkYMax->isChecked()};
|
||||
QString dispVal[4]{dispXMin->text(), dispXMax->text(), dispYMin->text(),
|
||||
dispYMax->text()};
|
||||
bool chkVal[4]{chkXMin->isChecked(), chkXMax->isChecked(),
|
||||
chkYMin->isChecked(), chkYMax->isChecked()};
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (chkVal[i] && !dispVal[i].isEmpty()) {
|
||||
double val = dispVal[i].toDouble();
|
||||
FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(static_cast<qDefs::range>(i)) << " to " << val;
|
||||
FILE_LOG(logDEBUG)
|
||||
<< "Setting "
|
||||
<< qDefs::getRangeAsString(static_cast<qDefs::range>(i))
|
||||
<< " to " << val;
|
||||
xyRange[i] = val;
|
||||
isRange[i] = true;
|
||||
disablezoom = true;
|
||||
@ -433,35 +484,50 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
ranges[qDefs::XMAX] = plot->GetXMaximum();
|
||||
ranges[qDefs::YMIN] = plot->GetYMinimum();
|
||||
ranges[qDefs::YMAX] = plot->GetYMaximum();
|
||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
||||
double idealAspectratio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Ideal Aspect ratio: " << idealAspectratio
|
||||
<< " for x(" << ranges[qDefs::XMIN] << " - "
|
||||
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
|
||||
<< " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
// calculate current aspect ratio
|
||||
ranges[qDefs::XMIN] = dispXMin->text().toDouble();
|
||||
ranges[qDefs::XMAX] = dispXMax->text().toDouble();
|
||||
ranges[qDefs::YMIN] = dispYMin->text().toDouble();
|
||||
ranges[qDefs::YMAX] = dispYMax->text().toDouble();
|
||||
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio << " for x(" << ranges[qDefs::XMIN] << " - " << ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN] << " - " << ranges[qDefs::YMAX] << ")";
|
||||
double currentAspectRatio = (ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]);
|
||||
FILE_LOG(logDEBUG) << "Current Aspect ratio: " << currentAspectRatio
|
||||
<< " for x(" << ranges[qDefs::XMIN] << " - "
|
||||
<< ranges[qDefs::XMAX] << "), y(" << ranges[qDefs::YMIN]
|
||||
<< " - " << ranges[qDefs::YMAX] << ")";
|
||||
|
||||
if (currentAspectRatio != idealAspectratio) {
|
||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted), -1(aspect ratio clicked: larger one adjusted)
|
||||
// dimension: 1(x changed: y adjusted), 0(y changed: x adjusted),
|
||||
// -1(aspect ratio clicked: larger one adjusted)
|
||||
if (dimension == -1) {
|
||||
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) > (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
||||
? static_cast<int>(slsDetectorDefs::X) : static_cast<int>(slsDetectorDefs::Y);
|
||||
dimension = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) >
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]))
|
||||
? static_cast<int>(slsDetectorDefs::X)
|
||||
: static_cast<int>(slsDetectorDefs::Y);
|
||||
}
|
||||
|
||||
// calculate new value to maintain aspect ratio
|
||||
// adjust x
|
||||
double newval = 0;
|
||||
if (dimension == static_cast<int>(slsDetectorDefs::X)) {
|
||||
newval = idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) + ranges[qDefs::XMIN];
|
||||
newval =
|
||||
idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]) +
|
||||
ranges[qDefs::XMIN];
|
||||
if (newval <= plot->GetXMaximum()) {
|
||||
ranges[qDefs::XMAX] = newval;
|
||||
dispXMax->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New XMax: " << newval;
|
||||
} else {
|
||||
newval = ranges[qDefs::XMAX] - (idealAspectratio * (ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||
newval = ranges[qDefs::XMAX] -
|
||||
(idealAspectratio *
|
||||
(ranges[qDefs::YMAX] - ranges[qDefs::YMIN]));
|
||||
ranges[qDefs::XMIN] = newval;
|
||||
dispXMin->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New XMin: " << newval;
|
||||
@ -469,13 +535,17 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
||||
}
|
||||
// adjust y
|
||||
else {
|
||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio) + ranges[qDefs::YMIN];
|
||||
newval = ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
idealAspectratio) +
|
||||
ranges[qDefs::YMIN];
|
||||
if (newval <= plot->GetYMaximum()) {
|
||||
ranges[qDefs::YMAX] = newval;
|
||||
dispYMax->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||
} else {
|
||||
newval = ranges[qDefs::YMAX] - ((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) / idealAspectratio);
|
||||
newval = ranges[qDefs::YMAX] -
|
||||
((ranges[qDefs::XMAX] - ranges[qDefs::XMIN]) /
|
||||
idealAspectratio);
|
||||
ranges[qDefs::YMIN] = newval;
|
||||
dispYMin->setText(QString::number(newval));
|
||||
FILE_LOG(logDEBUG) << "New YMax: " << newval;
|
||||
@ -516,23 +586,34 @@ void qTabPlot::SetZRange() {
|
||||
|
||||
void qTabPlot::GetStreamingFrequency() {
|
||||
FILE_LOG(logDEBUG) << "Getting Streaming Frequency";
|
||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
try {
|
||||
int freq = det->getRxZmqFrequency().tsquash("Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||
int freq = det->getRxZmqFrequency().tsquash(
|
||||
"Inconsistent receiver zmq streaming frequency for all detectors.");
|
||||
// time interval
|
||||
if (freq == 0) {
|
||||
comboFrequency->setCurrentIndex(0);
|
||||
stackedTimeInterval->setCurrentIndex(0);
|
||||
try {
|
||||
int timeMs = det->getRxZmqTimer().tsquash("Inconsistent receiver zmq streaming timer for all detectors.");
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
||||
int timeMs = det->getRxZmqTimer().tsquash(
|
||||
"Inconsistent receiver zmq streaming timer for all "
|
||||
"detectors.");
|
||||
auto timeNS = qDefs::getNSTime(std::make_pair(
|
||||
static_cast<double>(timeMs), qDefs::MILLISECONDS));
|
||||
auto time = qDefs::getUserFriendlyTime(timeNS);
|
||||
spinTimeGap->setValue(time.first);
|
||||
comboTimeGapUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||
} CATCH_DISPLAY ("Could not get streaming timer.", "qTabPlot::GetStreamingFrequency")
|
||||
comboTimeGapUnit->setCurrentIndex(
|
||||
static_cast<int>(time.second));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get streaming timer.",
|
||||
"qTabPlot::GetStreamingFrequency")
|
||||
}
|
||||
// every nth frame
|
||||
else {
|
||||
@ -540,29 +621,40 @@ void qTabPlot::GetStreamingFrequency() {
|
||||
stackedTimeInterval->setCurrentIndex(1);
|
||||
spinNthFrame->setValue(freq);
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get streaming frequency.", "qTabPlot::GetStreamingFrequency")
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get streaming frequency.",
|
||||
"qTabPlot::GetStreamingFrequency")
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this,
|
||||
SLOT(SetStreamingFrequency()));
|
||||
}
|
||||
|
||||
void qTabPlot::SetStreamingFrequency() {
|
||||
bool frequency = (comboFrequency->currentIndex() == 0) ? 0 : 1;
|
||||
auto freqVal = spinNthFrame->value();
|
||||
auto timeVal = spinTimeGap->value();
|
||||
auto timeUnit = static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||
auto timeUnit =
|
||||
static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||
stackedTimeInterval->setCurrentIndex(comboFrequency->currentIndex());
|
||||
try {
|
||||
if (frequency) {
|
||||
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||
det->setRxZmqFrequency(freqVal);
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit);
|
||||
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " "
|
||||
<< qDefs::getUnitString(timeUnit);
|
||||
auto timeMS = qDefs::getMSTime(std::make_pair(timeVal, timeUnit));
|
||||
det->setRxZmqTimer(timeMS.count());
|
||||
}
|
||||
} CATCH_HANDLE("Could not set streaming frequency/ timer.", "qTabPlot::SetStreamingFrequency", this, &qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
CATCH_HANDLE("Could not set streaming frequency/ timer.",
|
||||
"qTabPlot::SetStreamingFrequency", this,
|
||||
&qTabPlot::GetStreamingFrequency)
|
||||
}
|
||||
|
||||
void qTabPlot::Refresh() {
|
||||
|
84
slsDetectorGui/src/qTabSettings.cpp
Executable file → Normal file
84
slsDetectorGui/src/qTabSettings.cpp
Executable file → Normal file
@ -8,7 +8,8 @@
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector): QWidget(parent), det(detector) {
|
||||
qTabSettings::qTabSettings(QWidget *parent, sls::Detector *detector)
|
||||
: QWidget(parent), det(detector) {
|
||||
setupUi(this);
|
||||
SetupWidgetWindow();
|
||||
FILE_LOG(logDEBUG) << "Settings ready";
|
||||
@ -47,12 +48,14 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
}
|
||||
|
||||
void qTabSettings::SetupDetectorSettings() {
|
||||
QStandardItemModel *model = qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
if (model) {
|
||||
QModelIndex index[NUMSETTINGS];
|
||||
QStandardItem *item[NUMSETTINGS];
|
||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||
index[i] = model->index(i, comboSettings->modelColumn(), comboSettings->rootModelIndex());
|
||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||
comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
item[i]->setEnabled(false);
|
||||
}
|
||||
@ -97,7 +100,8 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
default:
|
||||
FILE_LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
||||
qDefs::Message(qDefs::CRITICAL,
|
||||
"Unknown detector type. Exiting GUI.", "qTabSettings::SetupDetectorSettings");
|
||||
"Unknown detector type. Exiting GUI.",
|
||||
"qTabSettings::SetupDetectorSettings");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@ -106,22 +110,27 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
void qTabSettings::Initialization() {
|
||||
// Settings
|
||||
if (comboSettings->isEnabled())
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled())
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
|
||||
// Threshold
|
||||
if (spinThreshold->isEnabled())
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::GetSettings() {
|
||||
FILE_LOG(logDEBUG) << "Getting settings";
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
try {
|
||||
auto retval = det->getSettings().tsquash("Inconsistent settings for all detectors.");
|
||||
auto retval = det->getSettings().tsquash(
|
||||
"Inconsistent settings for all detectors.");
|
||||
switch (retval) {
|
||||
case slsDetectorDefs::UNDEFINED:
|
||||
comboSettings->setCurrentIndex(UNDEFINED);
|
||||
@ -131,13 +140,16 @@ void qTabSettings::GetSettings() {
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") + std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
comboSettings->setCurrentIndex(retval);
|
||||
break;
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get settings.", "qTabSettings::GetSettings")
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSettings(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get settings.", "qTabSettings::GetSettings")
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetSettings(int index) {
|
||||
@ -146,7 +158,9 @@ void qTabSettings::SetSettings(int index) {
|
||||
try {
|
||||
FILE_LOG(logINFO) << "Setting Settings to " << sls::ToString(val);
|
||||
det->setSettings(val);
|
||||
} CATCH_HANDLE ("Could not set settings.", "qTabSettings::SetSettings", this, &qTabSettings::GetSettings)
|
||||
}
|
||||
CATCH_HANDLE("Could not set settings.", "qTabSettings::SetSettings", this,
|
||||
&qTabSettings::GetSettings)
|
||||
// threshold
|
||||
if (spinThreshold->isEnabled()) {
|
||||
SetThresholdEnergy(spinThreshold->value());
|
||||
@ -155,9 +169,11 @@ void qTabSettings::SetSettings(int index) {
|
||||
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
FILE_LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this, SLOT(SetDynamicRange(int)));
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
try {
|
||||
auto retval = det->getDynamicRange().tsquash("Inconsistent dynamic range for all detectors.");
|
||||
auto retval = det->getDynamicRange().tsquash(
|
||||
"Inconsistent dynamic range for all detectors.");
|
||||
// set the final value on gui
|
||||
switch (retval) {
|
||||
case 32:
|
||||
@ -173,14 +189,19 @@ void qTabSettings::GetDynamicRange() {
|
||||
comboDynamicRange->setCurrentIndex(DYNAMICRANGE_4);
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(retval));
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
} CATCH_DISPLAY ("Could not get dynamic range.", "qTabSettings::GetDynamicRange")
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get dynamic range.",
|
||||
"qTabSettings::GetDynamicRange")
|
||||
connect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
SLOT(SetDynamicRange(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetDynamicRange(int index) {
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data();
|
||||
FILE_LOG(logINFO) << "Setting dynamic range to "
|
||||
<< comboDynamicRange->currentText().toAscii().data();
|
||||
try {
|
||||
switch (index) {
|
||||
case DYNAMICRANGE_32:
|
||||
@ -196,26 +217,37 @@ void qTabSettings::SetDynamicRange(int index) {
|
||||
det->setDynamicRange(4);
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") + std::to_string(index));
|
||||
throw sls::RuntimeError(std::string("Unknown dynamic range: ") +
|
||||
std::to_string(index));
|
||||
}
|
||||
} CATCH_HANDLE ("Could not set dynamic range.", "qTabSettings::SetDynamicRange", this, &qTabSettings::GetDynamicRange)
|
||||
}
|
||||
CATCH_HANDLE("Could not set dynamic range.",
|
||||
"qTabSettings::SetDynamicRange", this,
|
||||
&qTabSettings::GetDynamicRange)
|
||||
}
|
||||
|
||||
void qTabSettings::GetThresholdEnergy() {
|
||||
FILE_LOG(logDEBUG) << "Getting theshold energy";
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
try {
|
||||
auto retval = det->getThresholdEnergy().tsquash("Inconsistent threhsold energy for all detectors.");
|
||||
auto retval = det->getThresholdEnergy().tsquash(
|
||||
"Inconsistent threhsold energy for all detectors.");
|
||||
spinThreshold->setValue(retval);
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabDataOutput::GetThresholdEnergy")
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get threshold energy.",
|
||||
"qTabDataOutput::GetThresholdEnergy")
|
||||
connect(spinThreshold, SIGNAL(valueChanged(int)), this,
|
||||
SLOT(SetThresholdEnergy(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetThresholdEnergy(int index) {
|
||||
FILE_LOG(logINFO) << "Setting Threshold Energy to " << index << " eV";
|
||||
try {
|
||||
det->setThresholdEnergy(index);
|
||||
} CATCH_DISPLAY ("Could not get threshold energy.", "qTabSettings::SetThresholdEnergy")
|
||||
}
|
||||
CATCH_DISPLAY("Could not get threshold energy.",
|
||||
"qTabSettings::SetThresholdEnergy")
|
||||
// set the right value anyway (due to tolerance)
|
||||
GetThresholdEnergy();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user