mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 10:20:04 +02:00
gainplot clone revised
This commit is contained in:
parent
a61c5e0206
commit
032475fc14
@ -16,7 +16,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt2DPlot *gp,
|
qCloneWidget(QWidget *parent, SlsQt1DPlot *p1, SlsQt2DPlot *p2, SlsQt1DPlot *gp1, SlsQt2DPlot *gp,
|
||||||
QString title, QString filePath, QString fileName,
|
QString title, QString filePath, QString fileName,
|
||||||
int64_t aIndex, bool displayStats, QString min, QString max,
|
int64_t aIndex, bool displayStats, QString min, QString max,
|
||||||
QString sum);
|
QString sum);
|
||||||
@ -37,6 +37,7 @@ class qCloneWidget : public QMainWindow, private Ui::ClonePlotObject {
|
|||||||
int id;
|
int id;
|
||||||
SlsQt1DPlot *plot1d{nullptr};
|
SlsQt1DPlot *plot1d{nullptr};
|
||||||
SlsQt2DPlot *plot2d{nullptr};
|
SlsQt2DPlot *plot2d{nullptr};
|
||||||
|
SlsQt1DPlot *gainplot1d{nullptr};
|
||||||
SlsQt2DPlot *gainplot2d{nullptr};
|
SlsQt2DPlot *gainplot2d{nullptr};
|
||||||
QString filePath{"/"};
|
QString filePath{"/"};
|
||||||
QString fileName{"run"};
|
QString fileName{"run"};
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
int qCloneWidget::NumClones{0};
|
int qCloneWidget::NumClones{0};
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt2DPlot* gp,
|
qCloneWidget::qCloneWidget(QWidget *parent, SlsQt1DPlot* p1, SlsQt2DPlot* p2, SlsQt1DPlot *gp1, SlsQt2DPlot* gp,
|
||||||
QString title, QString fPath, QString fName, int64_t aIndex,
|
QString title, QString fPath, QString fName, int64_t aIndex,
|
||||||
bool displayStats, QString min, QString max, QString sum):
|
bool displayStats, QString min, QString max, QString sum):
|
||||||
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
QMainWindow(parent), plot1d(p1), plot2d(p2), gainplot1d(gp1), gainplot2d(gp), filePath(fPath), fileName(fName), acqIndex(aIndex) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
id = qCloneWidget::NumClones++;
|
id = qCloneWidget::NumClones++;
|
||||||
SetupWidgetWindow(title);
|
SetupWidgetWindow(title);
|
||||||
@ -26,6 +26,8 @@ qCloneWidget::~qCloneWidget() {
|
|||||||
delete plot1d;
|
delete plot1d;
|
||||||
if (plot2d)
|
if (plot2d)
|
||||||
delete plot2d;
|
delete plot2d;
|
||||||
|
if (gainplot1d)
|
||||||
|
delete gainplot1d;
|
||||||
if (gainplot2d)
|
if (gainplot2d)
|
||||||
delete gainplot2d;
|
delete gainplot2d;
|
||||||
}
|
}
|
||||||
@ -40,7 +42,13 @@ void qCloneWidget::SetupWidgetWindow(QString title) {
|
|||||||
|
|
||||||
// 1d
|
// 1d
|
||||||
if (plot1d != nullptr) {
|
if (plot1d != nullptr) {
|
||||||
|
if (gainplot1d == nullptr) {
|
||||||
plotLayout->addWidget(plot1d);
|
plotLayout->addWidget(plot1d);
|
||||||
|
} else {
|
||||||
|
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||||
|
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||||
|
plotLayout->addWidget(gainplot1d, ratio, 0, 1, ratio, Qt::AlignTop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 2d
|
// 2d
|
||||||
else {
|
else {
|
||||||
@ -92,6 +100,10 @@ void qCloneWidget::SavePlot() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
void qCloneWidget::resizeEvent(QResizeEvent *event) {
|
||||||
|
if (gainplot1d != nullptr) {
|
||||||
|
gainplot1d->setFixedWidth(plot1d->width());
|
||||||
|
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
|
}
|
||||||
if (gainplot2d != nullptr) {
|
if (gainplot2d != nullptr) {
|
||||||
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
gainplot2d->setFixedWidth(plot2d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
gainplot2d->setFixedHeight(plot2d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||||
|
@ -495,6 +495,7 @@ void qDrawPlot::ClonePlot() {
|
|||||||
|
|
||||||
SlsQt1DPlot* cloneplot1D = nullptr;
|
SlsQt1DPlot* cloneplot1D = nullptr;
|
||||||
SlsQt2DPlot* cloneplot2D = nullptr;
|
SlsQt2DPlot* cloneplot2D = nullptr;
|
||||||
|
SlsQt1DPlot* clonegainplot1D = nullptr;
|
||||||
SlsQt2DPlot* clonegainplot2D = nullptr;
|
SlsQt2DPlot* clonegainplot2D = nullptr;
|
||||||
|
|
||||||
if (is1d) {
|
if (is1d) {
|
||||||
@ -516,6 +517,24 @@ void qDrawPlot::ClonePlot() {
|
|||||||
cloneplotHists1D.append(h);
|
cloneplotHists1D.append(h);
|
||||||
h->Attach(cloneplot1D);
|
h->Attach(cloneplot1D);
|
||||||
}
|
}
|
||||||
|
if (isGainDataExtracted) {
|
||||||
|
SlsQtH1D *h = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||||
|
h->SetLineColor(0);
|
||||||
|
h->setStyleLinesorDots(isLines);
|
||||||
|
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->SetTitle("");
|
||||||
|
clonegainplot1D->SetYTitle("Gain");
|
||||||
|
// set ticks to just 3
|
||||||
|
QList<double> majorTicks({0, 1, 2, 3});
|
||||||
|
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||||
|
clonegainplot1D->setAxisScaleDiv( QwtPlot::yLeft, div);
|
||||||
|
h->Attach(clonegainplot1D);
|
||||||
|
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logDEBUG) << "Cloning 2D Image";
|
FILE_LOG(logDEBUG) << "Cloning 2D Image";
|
||||||
cloneplot2D = new SlsQt2DPlot();
|
cloneplot2D = new SlsQt2DPlot();
|
||||||
@ -533,19 +552,31 @@ void qDrawPlot::ClonePlot() {
|
|||||||
|
|
||||||
if (isGainDataExtracted) {
|
if (isGainDataExtracted) {
|
||||||
clonegainplot2D = new SlsQt2DPlot();
|
clonegainplot2D = new SlsQt2DPlot();
|
||||||
clonegainplot2D->setFont(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);
|
||||||
|
clonegainplot2D->enableAxis(QwtPlot::xBottom, false);
|
||||||
|
// set ticks to just 3
|
||||||
|
QList<double> majorTicks({0, 1, 2, 3});
|
||||||
|
QwtScaleDiv div( 0, 3, QList<double>(), QList<double>(), majorTicks);
|
||||||
|
clonegainplot2D->setAxisScaleDiv( QwtPlot::yRight, div);
|
||||||
|
|
||||||
clonegainplot2D->enableAxis(0, false);
|
clonegainplot2D->enableAxis(0, false);
|
||||||
clonegainplot2D->enableAxis(1, false);
|
clonegainplot2D->enableAxis(1, false);
|
||||||
clonegainplot2D->enableAxis(2, 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);
|
||||||
clonegainplot2D->SetTitle("");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot2D,
|
qCloneWidget* q = new qCloneWidget(this, cloneplot1D, cloneplot2D, clonegainplot1D,
|
||||||
boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
clonegainplot2D, boxPlot->title(), fileSavePath, fileSaveName, currentAcqIndex,
|
||||||
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
|
displayStatistics, lblMinDisp->text(), lblMaxDisp->text(), lblSumDisp->text());
|
||||||
q->show();
|
q->show();
|
||||||
|
if (clonegainplot1D != nullptr) {
|
||||||
|
clonegainplot1D->setFixedWidth(cloneplot1D->width());
|
||||||
|
//clonegainplot1D->setFixedHeight(cloneplot1D->height());// / qDefs::DATA_GAIN_PLOT_RATIO - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qDrawPlot::SavePlot() {
|
void qDrawPlot::SavePlot() {
|
||||||
|
@ -23,7 +23,7 @@ target_include_directories(gotthard2DetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(gotthard2DetectorServer_virtual
|
target_compile_definitions(gotthard2DetectorServer_virtual
|
||||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1
|
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER #DEBUG1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(gotthard2DetectorServer_virtual
|
target_link_libraries(gotthard2DetectorServer_virtual
|
||||||
|
@ -5,7 +5,7 @@ support_lib = ../../slsSupportLib/include/
|
|||||||
|
|
||||||
CROSS = nios2-buildroot-linux-gnu-
|
CROSS = nios2-buildroot-linux-gnu-
|
||||||
CC = $(CROSS)gcc
|
CC = $(CROSS)gcc
|
||||||
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) -DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
CFLAGS += -Wall -DGOTTHARD2D -DSTOP_SERVER -I$(main_inc) -I$(support_lib) -I$(current_dir) #-DDEBUG1 #-DVERBOSEI #-DVERBOSE
|
||||||
LDLIBS += -lm
|
LDLIBS += -lm
|
||||||
PROGS = gotthard2DetectorServer
|
PROGS = gotthard2DetectorServer
|
||||||
DESTDIR ?= bin
|
DESTDIR ?= bin
|
||||||
|
Binary file not shown.
@ -9,4 +9,4 @@
|
|||||||
#define APIRECEIVER 0x200227
|
#define APIRECEIVER 0x200227
|
||||||
#define APIGUI 0x200227
|
#define APIGUI 0x200227
|
||||||
#define APICTB 0x200227
|
#define APICTB 0x200227
|
||||||
#define APIGOTTHARD2 0x200303
|
#define APIGOTTHARD2 0x200304
|
||||||
|
Loading…
x
Reference in New Issue
Block a user