mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
adc invert for highz (#59)
This commit is contained in:
@ -164,7 +164,7 @@
|
|||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QStackedWidget" name="stackedWidget2D">
|
<widget class="QStackedWidget" name="stackedWidget2D">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="pageInterpolate">
|
<widget class="QWidget" name="pageInterpolate">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
@ -643,6 +643,27 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkADCInvert">
|
||||||
|
<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>ADC Invert</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_17">
|
<spacer name="horizontalSpacer_17">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -55,6 +55,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
void ResetAccumulate();
|
void ResetAccumulate();
|
||||||
void DisplayStatistics(bool enable);
|
void DisplayStatistics(bool enable);
|
||||||
void EnableGainPlot(bool enable);
|
void EnableGainPlot(bool enable);
|
||||||
|
void EnableADCInvert(bool enable);
|
||||||
void ClonePlot();
|
void ClonePlot();
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ class qDrawPlot : public QWidget, private Ui::PlotObject {
|
|||||||
QString fileSaveName{"Image"};
|
QString fileSaveName{"Image"};
|
||||||
bool hasGainData{false};
|
bool hasGainData{false};
|
||||||
bool isGainDataExtracted{false};
|
bool isGainDataExtracted{false};
|
||||||
|
bool isADCInvert{false};
|
||||||
bool disableZoom{false};
|
bool disableZoom{false};
|
||||||
|
|
||||||
int progress{0};
|
int progress{0};
|
||||||
|
@ -416,6 +416,11 @@ void qDrawPlot::EnableGainPlot(bool enable) {
|
|||||||
hasGainData = enable;
|
hasGainData = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qDrawPlot::EnableADCInvert(bool enable) {
|
||||||
|
FILE_LOG(logINFO) << (enable ? "Enabling" : "Disabling") << " ADC Invert";
|
||||||
|
isADCInvert = enable;
|
||||||
|
}
|
||||||
|
|
||||||
void qDrawPlot::SetSaveFileName(QString val) {
|
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;
|
fileSaveName = val;
|
||||||
@ -895,25 +900,62 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
|
|||||||
|
|
||||||
// show gain plot
|
// show gain plot
|
||||||
if (gaindest != NULL) {
|
if (gaindest != NULL) {
|
||||||
for (ichan = 0; ichan < size; ++ichan) {
|
// adcinvert
|
||||||
if ((*((u_int16_t *)source)) == 0xFFFF) {
|
if (isADCInvert) {
|
||||||
gaindest[ichan] = 0xFFFF;
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
dest[ichan] = 0xFFFF;
|
uint16_t temp = (*((u_int16_t *)source));
|
||||||
} else {
|
if (temp == 0xFFFF) {
|
||||||
gaindest[ichan] =
|
gaindest[ichan] = 0xFFFF;
|
||||||
(((*((u_int16_t *)source)) & 0xC000) >> 14);
|
dest[ichan] = 0xFFFF;
|
||||||
dest[ichan] = ((*((u_int16_t *)source)) & 0x3FFF);
|
} else {
|
||||||
|
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||||
|
dest[ichan] = 0x4000 - (temp & 0x3FFF);
|
||||||
|
}
|
||||||
|
source += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// normal
|
||||||
|
else {
|
||||||
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
|
uint16_t temp = (*((u_int16_t *)source));
|
||||||
|
if (temp == 0xFFFF) {
|
||||||
|
gaindest[ichan] = 0xFFFF;
|
||||||
|
dest[ichan] = 0xFFFF;
|
||||||
|
} else {
|
||||||
|
gaindest[ichan] = ((temp & 0xC000) >> 14);
|
||||||
|
dest[ichan] = (temp & 0x3FFF);
|
||||||
|
}
|
||||||
|
source += 2;
|
||||||
}
|
}
|
||||||
source += 2;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// only data plot
|
// only data plot
|
||||||
else {
|
else {
|
||||||
for (ichan = 0; ichan < size; ++ichan) {
|
// adcinvert
|
||||||
dest[ichan] = ((*((u_int16_t *)source)) & 0x3FFF);
|
if (isADCInvert) {
|
||||||
source += 2;
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
|
uint16_t temp = (*((u_int16_t *)source));
|
||||||
|
if (temp == 0xFFFF) {
|
||||||
|
dest[ichan] = 0xFFFF;
|
||||||
|
} else {
|
||||||
|
dest[ichan] = 0x4000 - (temp & 0x3FFF);
|
||||||
|
}
|
||||||
|
source += 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// normal
|
||||||
|
else {
|
||||||
|
for (ichan = 0; ichan < size; ++ichan) {
|
||||||
|
uint16_t temp = (*((u_int16_t *)source));
|
||||||
|
if (temp == 0xFFFF) {
|
||||||
|
dest[ichan] = 0xFFFF;
|
||||||
|
} else {
|
||||||
|
dest[ichan] = (temp & 0x3FFF);
|
||||||
|
}
|
||||||
|
source += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
chkGainPlot->setEnabled(true);
|
chkGainPlot->setEnabled(true);
|
||||||
|
chkADCInvert->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -129,6 +130,9 @@ void qTabPlot::Initialization() {
|
|||||||
// gap pixels
|
// gap pixels
|
||||||
if (chkGapPixels->isEnabled())
|
if (chkGapPixels->isEnabled())
|
||||||
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
connect(chkGapPixels, SIGNAL(toggled(bool)), this, SLOT(SetGapPixels(bool)));
|
||||||
|
// adc invert
|
||||||
|
if (chkADCInvert->isEnabled())
|
||||||
|
connect(chkADCInvert, SIGNAL(toggled(bool)), plot, SLOT(EnableADCInvert(bool)));
|
||||||
|
|
||||||
// Save, clone
|
// Save, clone
|
||||||
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
connect(btnSave, SIGNAL(clicked()), plot, SLOT(SavePlot()));
|
||||||
@ -576,6 +580,7 @@ void qTabPlot::Refresh() {
|
|||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
chkGainPlot->setEnabled(true);
|
chkGainPlot->setEnabled(true);
|
||||||
|
chkADCInvert->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -585,6 +590,7 @@ void qTabPlot::Refresh() {
|
|||||||
boxFrequency->setEnabled(false);
|
boxFrequency->setEnabled(false);
|
||||||
chkGainPlot->setEnabled(false);
|
chkGainPlot->setEnabled(false);
|
||||||
chkGapPixels->setEnabled(false);
|
chkGapPixels->setEnabled(false);
|
||||||
|
chkADCInvert->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "**Updated Plot Tab";
|
FILE_LOG(logDEBUG) << "**Updated Plot Tab";
|
||||||
|
Reference in New Issue
Block a user