mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
Merge branch 'developer' into bursts
This commit is contained in:
commit
462bc2e70c
@ -822,7 +822,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item row="0" column="1">
|
||||
<widget class="QStackedWidget" name="stackedWidget1D">
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="pageSuperImpose">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -1360,6 +1360,27 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkGainPlot1D">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Displays minimum, maximum and sum of values for each plot.
|
||||
<nobr></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain Plot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -98,6 +98,8 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
|
||||
SlsQt1DPlot *plot1d{nullptr};
|
||||
QVector<SlsQtH1D *> hists1d;
|
||||
SlsQt1DPlot *gainplot1d{nullptr};
|
||||
SlsQtH1D * gainhist1d{nullptr};
|
||||
SlsQt2DPlot *plot2d{nullptr};
|
||||
SlsQt2DPlot *gainplot2d{nullptr};
|
||||
QFutureWatcher<std::string> *acqResultWatcher;
|
||||
@ -124,6 +126,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
int nHists{1};
|
||||
double *datax1d{nullptr};
|
||||
std::vector<double *> datay1d;
|
||||
double *gainDatay1d{nullptr};
|
||||
double *data2d{nullptr};
|
||||
double *gainData{nullptr};
|
||||
|
||||
@ -161,4 +164,6 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
||||
const static int npixelsx_jctb = 400;
|
||||
int npixelsy_jctb{0};
|
||||
uint32_t pixelMask{0};
|
||||
uint32_t gainMask{0};
|
||||
int gainOffset{0};
|
||||
};
|
||||
|
@ -132,6 +132,7 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
void DisableZoom(bool disable);
|
||||
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);};
|
||||
double GetXMinimum(){return hist_list->Hist()->GetXMin();};
|
||||
@ -157,6 +158,7 @@ class SlsQt1DPlot:public QwtPlot{
|
||||
QwtPlotMarker *hline;
|
||||
QwtPlotMarker *vline;
|
||||
bool disableZoom{false};
|
||||
int ystep{0};
|
||||
|
||||
void SetupZoom();
|
||||
void UnknownStuff();
|
||||
|
@ -32,6 +32,8 @@ qDrawPlot::~qDrawPlot() {
|
||||
delete [] datax1d;
|
||||
for (auto &it : datay1d)
|
||||
delete [] it;
|
||||
if (gainDatay1d)
|
||||
delete [] gainDatay1d;
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
if (gainData)
|
||||
@ -39,6 +41,10 @@ qDrawPlot::~qDrawPlot() {
|
||||
|
||||
if (plot1d)
|
||||
delete plot1d;
|
||||
if (gainhist1d)
|
||||
delete gainhist1d;
|
||||
if (gainplot1d)
|
||||
delete gainplot1d;
|
||||
if (plot2d)
|
||||
delete plot2d;
|
||||
if (gainplot2d)
|
||||
@ -56,11 +62,17 @@ void qDrawPlot::SetupWidgetWindow() {
|
||||
case slsDetectorDefs::JUNGFRAU:
|
||||
case slsDetectorDefs::MOENCH:
|
||||
pixelMask = ((1 << 14) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
gainMask = (3 << 14);
|
||||
gainOffset = 14;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
pixelMask = ((1 << 12) - 1);
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask << std::dec;
|
||||
gainMask = (3 << 12);
|
||||
gainOffset = 12;
|
||||
FILE_LOG(logINFO) << "Pixel Mask: " << std::hex << pixelMask
|
||||
<< ", Gain Mask:" << gainMask << ", Gain Offset:" << std::dec << gainOffset;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -160,6 +172,29 @@ void qDrawPlot::SetupPlots() {
|
||||
h->Attach(plot1d);
|
||||
plot1d->hide();
|
||||
|
||||
if (gainDatay1d)
|
||||
delete[] gainDatay1d;
|
||||
gainDatay1d = new double[nPixelsX];
|
||||
// default display data
|
||||
for (unsigned int px = 0; px < nPixelsX; ++px) {
|
||||
gainDatay1d[px] = 0;
|
||||
}
|
||||
// set gain hist
|
||||
gainhist1d = new SlsQtH1D("", nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
// setup 1d gain plot
|
||||
gainplot1d = new SlsQt1DPlot(boxPlot);
|
||||
//gainplot1d->setFont(QFont("Sans Serif", 3, 20));
|
||||
gainplot1d->SetTitle("");
|
||||
gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
gainplot1d->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Labels, false);
|
||||
gainplot1d->axisScaleDraw(QwtPlot::yLeft)->enableComponent(QwtScaleDraw::Ticks, false);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
gainplot1d->hide();
|
||||
|
||||
// setup 2d data
|
||||
if (data2d)
|
||||
delete [] data2d;
|
||||
@ -208,6 +243,7 @@ void qDrawPlot::SetupPlots() {
|
||||
int ratio = qDefs::DATA_GAIN_PLOT_RATIO - 1;
|
||||
plotLayout->addWidget(plot1d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(plot2d, 0, 0, ratio, ratio);
|
||||
plotLayout->addWidget(gainplot1d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
plotLayout->addWidget(gainplot2d, 0, ratio, 1, 1, Qt::AlignRight | Qt::AlignTop);
|
||||
}
|
||||
|
||||
@ -216,6 +252,10 @@ void qDrawPlot::resizeEvent(QResizeEvent *event) {
|
||||
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() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
@ -547,6 +587,9 @@ void qDrawPlot::DetachHists() {
|
||||
for (QVector<SlsQtH1D *>::iterator h = hists1d.begin(); h != hists1d.end(); ++h) {
|
||||
(*h)->Detach(plot1d);
|
||||
}
|
||||
if (gainhist1d) {
|
||||
gainhist1d->Detach(gainplot1d);
|
||||
}
|
||||
}
|
||||
|
||||
void qDrawPlot::StartAcquisition() {
|
||||
@ -666,7 +709,8 @@ 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, 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);
|
||||
@ -819,6 +863,20 @@ void qDrawPlot::Update1dPlot() {
|
||||
h->Attach(plot1d);
|
||||
}
|
||||
}
|
||||
if (isGainDataExtracted) {
|
||||
gainhist1d->SetData(nPixelsX, datax1d, gainDatay1d);
|
||||
gainhist1d->SetLineColor(0);
|
||||
gainhist1d->setStyleLinesorDots(isLines);
|
||||
gainhist1d->setSymbolMarkers(isMarkers);
|
||||
gainhist1d->Attach(gainplot1d);
|
||||
if (!gainplot1d->isVisible()) {
|
||||
gainplot1d->setFixedWidth(plot1d->width() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->setFixedHeight(plot1d->height() / qDefs::DATA_GAIN_PLOT_RATIO);
|
||||
gainplot1d->show();
|
||||
}
|
||||
} else if (gainplot1d->isVisible()) {
|
||||
gainplot1d->hide();
|
||||
}
|
||||
if (xyRangeChanged) {
|
||||
Update1dXYRange();
|
||||
xyRangeChanged = false;
|
||||
@ -832,7 +890,7 @@ void qDrawPlot::Update2dPlot() {
|
||||
plot2d->SetYTitle(yTitle2d);
|
||||
plot2d->SetZTitle(zTitle2d);
|
||||
plot2d->SetData(nPixelsX, -0.5, nPixelsX - 0.5, nPixelsY, -0.5, nPixelsY - 0.5, data2d);
|
||||
if (isGainDataExtracted) {
|
||||
if (isGainDataExtracted) {
|
||||
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);
|
||||
@ -925,7 +983,7 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
||||
if (gaindest != NULL) {
|
||||
for (ichan = 0; ichan < size; ++ichan) {
|
||||
uint16_t temp = (*((u_int16_t *)source));
|
||||
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||
gaindest[ichan] = ((temp & gainMask) >> gainOffset);
|
||||
dest[ichan] = (temp & pixelMask);
|
||||
source += 2;
|
||||
}
|
||||
|
@ -60,8 +60,11 @@ void qTabPlot::SetupWidgetWindow() {
|
||||
switch(det->getDetectorType().squash()) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
case slsDetectorDefs::MYTHEN3:
|
||||
is1d = true;
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
is1d = true;
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkGapPixels->setEnabled(true);
|
||||
@ -128,6 +131,8 @@ void qTabPlot::Initialization() {
|
||||
//gainplot
|
||||
if (chkGainPlot->isEnabled())
|
||||
connect(chkGainPlot, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
if (chkGainPlot1D->isEnabled())
|
||||
connect(chkGainPlot1D, SIGNAL(toggled(bool)), plot, SLOT(EnableGainPlot(bool)));
|
||||
// gap pixels
|
||||
if (chkGapPixels->isEnabled())
|
||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||
@ -579,6 +584,9 @@ void qTabPlot::Refresh() {
|
||||
case slsDetectorDefs::MOENCH:
|
||||
chkGainPlot->setEnabled(true);
|
||||
break;
|
||||
case slsDetectorDefs::GOTTHARD2:
|
||||
chkGainPlot1D->setEnabled(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -586,6 +594,7 @@ void qTabPlot::Refresh() {
|
||||
boxPlotType->setEnabled(false);
|
||||
boxFrequency->setEnabled(false);
|
||||
chkGainPlot->setEnabled(false);
|
||||
chkGainPlot1D->setEnabled(false);
|
||||
chkGapPixels->setEnabled(false);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user