mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
WIP
This commit is contained in:
parent
976b460e70
commit
0acf97cc9a
@ -99,7 +99,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>4</number>
|
<number>3</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page_6">
|
<widget class="QWidget" name="page_6">
|
||||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||||
@ -278,7 +278,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>8</x>
|
<x>8</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>316</width>
|
<width>328</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -536,7 +536,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>9</x>
|
<x>9</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>318</width>
|
<width>322</width>
|
||||||
<height>35</height>
|
<height>35</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -871,7 +871,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>4</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||||
@ -1826,7 +1826,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<x>15</x>
|
<x>15</x>
|
||||||
<y>190</y>
|
<y>190</y>
|
||||||
<width>746</width>
|
<width>746</width>
|
||||||
<height>149</height>
|
<height>150</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -1844,7 +1844,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>726</width>
|
<width>726</width>
|
||||||
<height>125</height>
|
<height>126</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0,0,0,0">
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0,0,0,0,0,0">
|
||||||
@ -2207,7 +2207,7 @@ Displays minimum, maximum and sum of values for each plot.
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QGroupBox" name="groupBox_3">
|
<widget class="QGroupBox" name="boxPlotType">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -2500,7 +2500,7 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>400</x>
|
<x>400</x>
|
||||||
<y>130</y>
|
<y>130</y>
|
||||||
<width>351</width>
|
<width>355</width>
|
||||||
<height>60</height>
|
<height>60</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2518,7 +2518,7 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>23</y>
|
<y>23</y>
|
||||||
<width>339</width>
|
<width>342</width>
|
||||||
<height>37</height>
|
<height>37</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -2745,7 +2745,7 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
|
|||||||
<zorder>box2D</zorder>
|
<zorder>box2D</zorder>
|
||||||
<zorder>boxSave</zorder>
|
<zorder>boxSave</zorder>
|
||||||
<zorder>boxPlotAxis</zorder>
|
<zorder>boxPlotAxis</zorder>
|
||||||
<zorder>groupBox_3</zorder>
|
<zorder>boxPlotType</zorder>
|
||||||
<zorder>boxFrequency</zorder>
|
<zorder>boxFrequency</zorder>
|
||||||
<zorder>boxSnapshot</zorder>
|
<zorder>boxSnapshot</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -130,18 +130,45 @@ class qDefs : public QWidget {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the time in the appropriate time unit
|
* returns the value in ms
|
||||||
* @param unit unit of time
|
* @param unit unit of time
|
||||||
* @param value time in seconds
|
* @param value time
|
||||||
* returns the corresponding time value
|
* returns time value in ms
|
||||||
*/
|
*/
|
||||||
static double getCorrectTime(timeUnit &unit, double value) {
|
static double getMSTime(timeUnit unit, double value) {
|
||||||
|
double valueMS = value;
|
||||||
|
switch (unit) {
|
||||||
|
case NANOSECONDS:
|
||||||
|
valueMS /= 1000;
|
||||||
|
case MICROSECONDS:
|
||||||
|
valueMS /= 1000;
|
||||||
|
return valueMs;
|
||||||
|
|
||||||
|
case HOURS:
|
||||||
|
valueMS *= 60;
|
||||||
|
case MINUTES:
|
||||||
|
valueMS *= 60;
|
||||||
|
case SECONDS:
|
||||||
|
valueMS *= 1000;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return valueMS;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the time in the appropriate time unit
|
||||||
|
* @param value time in seconds
|
||||||
|
* returns the time in an appropriate time and unit
|
||||||
|
*/
|
||||||
|
static std::pair<double, timeUnit> getCorrectTime(double value) {
|
||||||
|
timeUnit unit;
|
||||||
int intUnit = (int)SECONDS;
|
int intUnit = (int)SECONDS;
|
||||||
|
|
||||||
/**0 ms*/
|
/**0 ms*/
|
||||||
if (!value) {
|
if (!value) {
|
||||||
unit = MILLISECONDS;
|
unit = MILLISECONDS;
|
||||||
return value;
|
return std::make_pair(value, unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** hr, min, sec */
|
/** hr, min, sec */
|
||||||
@ -155,7 +182,7 @@ class qDefs : public QWidget {
|
|||||||
}
|
}
|
||||||
/** returning the previous value*/
|
/** returning the previous value*/
|
||||||
unit = (timeUnit)(intUnit + 1);
|
unit = (timeUnit)(intUnit + 1);
|
||||||
return value;
|
return std::make_pair(value, unit);
|
||||||
}
|
}
|
||||||
/** ms, us, ns */
|
/** ms, us, ns */
|
||||||
else {
|
else {
|
||||||
@ -164,7 +191,7 @@ class qDefs : public QWidget {
|
|||||||
intUnit++;
|
intUnit++;
|
||||||
}
|
}
|
||||||
unit = (timeUnit)(intUnit);
|
unit = (timeUnit)(intUnit);
|
||||||
return value;
|
return std::make_pair(value, unit);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,6 +112,8 @@ public:
|
|||||||
/** Set Plot frame factor - between plots, also for receiver if exists */
|
/** Set Plot frame factor - between plots, also for receiver if exists */
|
||||||
void SetFrameFactor(int frame);
|
void SetFrameFactor(int frame);
|
||||||
|
|
||||||
|
void SetCallBacks(bool enable);
|
||||||
|
|
||||||
/** Starts or stop acquisition
|
/** Starts or stop acquisition
|
||||||
* Calls startDaq() function
|
* Calls startDaq() function
|
||||||
* @param stop_if_running is 0 to stop acquisition and 1 to start acquisition
|
* @param stop_if_running is 0 to stop acquisition and 1 to start acquisition
|
||||||
@ -206,7 +208,6 @@ void DisplayStatistics(bool enable);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Initializes all its members and the thread */
|
/** Initializes all its members and the thread */
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
@ -67,8 +67,6 @@ private:
|
|||||||
signals:
|
signals:
|
||||||
void StartSignal();
|
void StartSignal();
|
||||||
void StopSignal();
|
void StopSignal();
|
||||||
void CheckPlotIntervalSignal();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
|
@ -22,13 +22,8 @@ public:
|
|||||||
void SetScanArgument();
|
void SetScanArgument();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void SetFrequency();
|
|
||||||
void EnableScanBox();
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void SetPlot();
|
||||||
xxxxxxxxxxxxxxx
|
|
||||||
void Set1DPlotOptionsRight();
|
void Set1DPlotOptionsRight();
|
||||||
void Set1DPlotOptionsLeft();
|
void Set1DPlotOptionsLeft();
|
||||||
void Set2DPlotOptionsRight();
|
void Set2DPlotOptionsRight();
|
||||||
@ -41,17 +36,7 @@ xxxxxxxxxxxxxxx
|
|||||||
void SetYRange();
|
void SetYRange();
|
||||||
void CheckAspectRatio();
|
void CheckAspectRatio();
|
||||||
void SetZRange();
|
void SetZRange();
|
||||||
|
void SetStreamingFrequency();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Select1DPlot(bool b);
|
|
||||||
void SetPlot();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DisableZoomSignal(bool);
|
void DisableZoomSignal(bool);
|
||||||
@ -60,14 +45,15 @@ signals:
|
|||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
void Select1DPlot(bool enable);
|
||||||
void GetGapPixels();
|
void GetGapPixels();
|
||||||
|
void GetStreamingFrequency();
|
||||||
void SetXYRange();
|
void SetXYRange();
|
||||||
void MaintainAspectRatio(int dimension);
|
void MaintainAspectRatio(int dimension);
|
||||||
|
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
qDrawPlot *myPlot;
|
qDrawPlot *myPlot;
|
||||||
bool isOneD;
|
bool isOneD;
|
||||||
bool isOriginallyOneD;
|
|
||||||
|
|
||||||
QButtonGroup *btnGroupPlotType;
|
QButtonGroup *btnGroupPlotType;
|
||||||
/** interval between plots */
|
/** interval between plots */
|
||||||
|
@ -292,7 +292,6 @@ void qDetectorMain::Initialization() {
|
|||||||
// Measurement tab
|
// Measurement tab
|
||||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||||
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
connect(tabMeasurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
||||||
connect(tabMeasurement, SIGNAL(CheckPlotIntervalSignal()), tabPlot,SLOT(SetFrequency()));
|
|
||||||
// Plot tab
|
// Plot tab
|
||||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||||
|
|
||||||
|
@ -175,8 +175,7 @@ void qDrawPlot::SetupWidgetWindow() {
|
|||||||
IsXYRange[2] = false;
|
IsXYRange[2] = false;
|
||||||
IsXYRange[3] = false;
|
IsXYRange[3] = false;
|
||||||
|
|
||||||
timerValue = DEFAULT_STREAMING_TIMER_IN_MS;
|
|
||||||
frameFactor = 0;
|
|
||||||
isFrameEnabled = false;
|
isFrameEnabled = false;
|
||||||
isTriggerEnabled = false;
|
isTriggerEnabled = false;
|
||||||
|
|
||||||
@ -355,8 +354,7 @@ void qDrawPlot::SetupWidgetWindow() {
|
|||||||
gainDataEnable = false;
|
gainDataEnable = false;
|
||||||
|
|
||||||
// callbacks
|
// callbacks
|
||||||
// Setting the callback function to get data from detector class
|
SetCallBacks(true);
|
||||||
myDet->registerDataCallback(&(GetDataCallBack), this); // also enables data streaming in client and receiver (if receiver exists)
|
|
||||||
//Setting the callback function to alert when acquisition finished from detector class
|
//Setting the callback function to alert when acquisition finished from detector class
|
||||||
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
|
||||||
//Setting the callback function to alert when each measurement finished from detector class
|
//Setting the callback function to alert when each measurement finished from detector class
|
||||||
@ -383,6 +381,15 @@ void qDrawPlot::Initialization() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
void qDrawPlot::SetCallBacks(bool enable) {
|
||||||
|
if (enable) {
|
||||||
|
// Setting the callback function to get data from detector class
|
||||||
|
myDet->registerDataCallback(&(GetDataCallBack), this); // also enables data streaming in client and receiver (if receiver exists)
|
||||||
|
} else {
|
||||||
|
myDet->registerDataCallback(nullptr, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::StartStopDaqToggle(bool stop_if_running) {
|
void qDrawPlot::StartStopDaqToggle(bool stop_if_running) {
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
|
@ -759,10 +759,9 @@ void qTabAdvanced::GetSubExposureTime() {
|
|||||||
spinSubExpTime->setValue(-1);
|
spinSubExpTime->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
double value = (double)( retval * (1E-9));
|
double value = (double)( retval * (1E-9));
|
||||||
qDefs::timeUnit unit;
|
auto time = qDefs::getCorrectTime(value);
|
||||||
double time = qDefs::getCorrectTime(unit, value);
|
spinSubExpTime->setValue(time.first);
|
||||||
spinSubExpTime->setValue(time);
|
comboSubExpTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
comboSubExpTimeUnit->setCurrentIndex((int)unit);
|
|
||||||
}
|
}
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime");
|
qDefs::ExceptionMessage("Could not get sub exposure time.", e.what(), "qTabSettings::GetSubExposureTime");
|
||||||
@ -796,10 +795,9 @@ void qTabAdvanced::GetSubDeadTime() {
|
|||||||
spinSubDeadTime->setValue(-1);
|
spinSubDeadTime->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
double value = (double)(retval * (1E-9));
|
double value = (double)(retval * (1E-9));
|
||||||
qDefs::timeUnit unit;
|
auto time = qDefs::getCorrectTime(value);
|
||||||
double time = qDefs::getCorrectTime(unit, value);
|
spinSubDeadTime->setValue(time.first);
|
||||||
spinSubDeadTime->setValue(time);
|
comboSubDeadTimeUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
comboSubDeadTimeUnit->setCurrentIndex((int)unit);
|
|
||||||
}
|
}
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime");
|
qDefs::ExceptionMessage("Could not get sub dead time.", e.what(), "qTabSettings::GetSubDeadTime");
|
||||||
|
@ -365,10 +365,9 @@ void qTabMeasurement::GetExposureTime() {
|
|||||||
qDefs::Message(qDefs::WARNING, "Exposure Time is inconsistent for all detectors.", "qTabMeasurement::GetExposureTime");
|
qDefs::Message(qDefs::WARNING, "Exposure Time is inconsistent for all detectors.", "qTabMeasurement::GetExposureTime");
|
||||||
spinExpTime->setValue(-1);
|
spinExpTime->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
spinExpTime->setValue(time.first);
|
||||||
spinExpTime->setValue(time);
|
comboExpUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
comboExpUnit->setCurrentIndex(static_cast<int>(unit));
|
|
||||||
|
|
||||||
CheckAcqPeriodGreaterThanExp();
|
CheckAcqPeriodGreaterThanExp();
|
||||||
}
|
}
|
||||||
@ -406,10 +405,9 @@ void qTabMeasurement::GetAcquisitionPeriod() {
|
|||||||
qDefs::Message(qDefs::WARNING, "Acquisition Period is inconsistent for all detectors.", "qTabMeasurement::GetAcquisitionPeriod");
|
qDefs::Message(qDefs::WARNING, "Acquisition Period is inconsistent for all detectors.", "qTabMeasurement::GetAcquisitionPeriod");
|
||||||
spinPeriod->setValue(-1);
|
spinPeriod->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
spinPeriod->setValue(time.first);
|
||||||
spinPeriod->setValue(time);
|
comboPeriodUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
comboPeriodUnit->setCurrentIndex(static_cast<int>(unit));
|
|
||||||
|
|
||||||
CheckAcqPeriodGreaterThanExp();
|
CheckAcqPeriodGreaterThanExp();
|
||||||
}
|
}
|
||||||
@ -457,8 +455,6 @@ void qTabMeasurement::CheckAcqPeriodGreaterThanExp() {
|
|||||||
lblPeriod->setPalette(lblTimingMode->palette());
|
lblPeriod->setPalette(lblTimingMode->palette());
|
||||||
lblPeriod->setText("Acquisition Period:");
|
lblPeriod->setText("Acquisition Period:");
|
||||||
}
|
}
|
||||||
|
|
||||||
emit CheckPlotIntervalSignal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::GetDelay() {
|
void qTabMeasurement::GetDelay() {
|
||||||
@ -472,10 +468,9 @@ void qTabMeasurement::GetDelay() {
|
|||||||
qDefs::Message(qDefs::WARNING, "Delay is inconsistent for all detectors.", "qTabMeasurement::GetDelay");
|
qDefs::Message(qDefs::WARNING, "Delay is inconsistent for all detectors.", "qTabMeasurement::GetDelay");
|
||||||
spinDelay->setValue(-1);
|
spinDelay->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
auto time = qDefs::getCorrectTime(static_cast<double>(retval) * (1E-9));
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
spinDelay->setValue(time.first);
|
||||||
spinDelay->setValue(time);
|
comboDelayUnit->setCurrentIndex(static_cast<int>(time.second));
|
||||||
comboDelayUnit->setCurrentIndex(static_cast<int>(unit));
|
|
||||||
|
|
||||||
CheckAcqPeriodGreaterThanExp();
|
CheckAcqPeriodGreaterThanExp();
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ QString qTabPlot::defaultImageZAxisTitle("Intensity");
|
|||||||
|
|
||||||
|
|
||||||
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
qTabPlot::qTabPlot(QWidget *parent, multiSlsDetector *detector, qDrawPlot *plot) :
|
||||||
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false), isOriginallyOneD(false), wrongInterval(0),
|
QWidget(parent), myDet(detector), myPlot(plot), isOneD(false),
|
||||||
stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr),
|
stackedLayout(nullptr), spinNthFrame(nullptr), spinTimeGap(nullptr), comboTimeGapUnit(nullptr),
|
||||||
btnGroupPlotType(0) {
|
btnGroupPlotType(0) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@ -35,7 +35,6 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
btnGroupPlotType = new QButtonGroup(this);
|
btnGroupPlotType = new QButtonGroup(this);
|
||||||
btnGroupPlotType->addButton(radioNoPlot, 0);
|
btnGroupPlotType->addButton(radioNoPlot, 0);
|
||||||
btnGroupPlotType->addButton(radioDataGraph, 1);
|
btnGroupPlotType->addButton(radioDataGraph, 1);
|
||||||
btnGroupPlotType->addButton(radioHistogram, 2);
|
|
||||||
// Plotting Frequency
|
// Plotting Frequency
|
||||||
stackedLayout = new QStackedLayout;
|
stackedLayout = new QStackedLayout;
|
||||||
stackedLayout->setSpacing(0);
|
stackedLayout->setSpacing(0);
|
||||||
@ -89,29 +88,24 @@ void qTabPlot::SetupWidgetWindow() {
|
|||||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
|
isOneD = false;
|
||||||
switch(myDet->getDetectorTypeAsEnum()) {
|
switch(myDet->getDetectorTypeAsEnum()) {
|
||||||
case slsDetectorDefs::GOTTHARD:
|
case slsDetectorDefs::GOTTHARD:
|
||||||
isOriginallyOneD = true;
|
isOneD = true;
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::EIGER:
|
case slsDetectorDefs::EIGER:
|
||||||
isOriginallyOneD = false;
|
|
||||||
pagePedestal->setEnabled(false);
|
|
||||||
pagePedestal_2->setEnabled(false);
|
|
||||||
chkGapPixels->setEnabled(true);
|
chkGapPixels->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
case slsDetectorDefs::MOENCH:
|
case slsDetectorDefs::MOENCH:
|
||||||
isOriginallyOneD = false;
|
|
||||||
chkGainPlot->setEnabled(true);
|
chkGainPlot->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Select1DPlot(isOriginallyOneD);
|
Select1DPlot(isOneD);
|
||||||
|
|
||||||
Initialization();
|
Initialization();
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,10 +114,10 @@ void qTabPlot::Initialization() {
|
|||||||
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
|
connect(btnGroupPlotType, SIGNAL(buttonClicked(int)), this, SLOT(SetPlot()));
|
||||||
|
|
||||||
// Plotting frequency box
|
// Plotting frequency box
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||||
|
|
||||||
// navigation buttons for options
|
// navigation buttons for options
|
||||||
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
connect(btnRight1D, SIGNAL(clicked()), this, SLOT(Set1DPlotOptionsRight()));
|
||||||
@ -204,7 +198,52 @@ void qTabPlot::Initialization() {
|
|||||||
connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
|
connect(this, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)), myPlot, SIGNAL(ResetZMinZMaxSignal(bool, bool, double, double)));
|
||||||
}
|
}
|
||||||
|
|
||||||
xxxxxxxxxxxxxxx
|
void qTabPlot::Select1DPlot(bool enable) {
|
||||||
|
FILE_LOG(logDEBUG) << "Selecting " << (enable ? "1" : "2") << "D Plot";
|
||||||
|
isOneD = enable;
|
||||||
|
box1D->setEnabled(enable);
|
||||||
|
box2D->setEnabled(!benable);
|
||||||
|
chkZAxis->setEnabled(!enable);
|
||||||
|
dispZAxis->setEnabled(!enable);
|
||||||
|
chkZMin->setEnabled(!enable);
|
||||||
|
chkZMax->setEnabled(!enable);
|
||||||
|
dispZMin->setEnabled(!enable);
|
||||||
|
dispZMax->setEnabled(!enable);
|
||||||
|
if(enable) {
|
||||||
|
myPlot->Select1DPlot();
|
||||||
|
} else {
|
||||||
|
myPlot->Select2DPlot();
|
||||||
|
}
|
||||||
|
SetTitles();
|
||||||
|
SetXYRange();
|
||||||
|
if (!isOneD) {
|
||||||
|
SetZRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabPlot::SetPlot() {
|
||||||
|
bool plotEnable = false;
|
||||||
|
if (radioNoPlot->isChecked()) {
|
||||||
|
FILE_LOG(logINFO) << "Setting Plot Type: No Plot";
|
||||||
|
} else if (radioDataGraph->isChecked()) {
|
||||||
|
FILE_LOG(logINFO) << "Setting Plot Type: Datagraph";
|
||||||
|
plotEnable = true;
|
||||||
|
}
|
||||||
|
boxFrequency->setEnabled(plotEnable);
|
||||||
|
box1D->setEnabled(plotEnable);
|
||||||
|
box2D->setEnabled(plotEnable);
|
||||||
|
boxSave->setEnabled(plotEnable);
|
||||||
|
boxSnapshot->setEnabled(plotEnable);
|
||||||
|
boxPlotAxis->setEnabled(plotEnable);
|
||||||
|
|
||||||
|
if (plotEnable) {
|
||||||
|
SetTitles();
|
||||||
|
SetXYRange();
|
||||||
|
if (!isOneD) {
|
||||||
|
SetZRange();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void qTabPlot::Set1DPlotOptionsRight() {
|
void qTabPlot::Set1DPlotOptionsRight() {
|
||||||
FILE_LOG(logDEBUG) << "1D Options Right";
|
FILE_LOG(logDEBUG) << "1D Options Right";
|
||||||
@ -560,7 +599,6 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
emit DisableZoomSignal(true);
|
emit DisableZoomSignal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetZRange() {
|
void qTabPlot::SetZRange() {
|
||||||
bool isZmin = chkZMin->isChecked();
|
bool isZmin = chkZMin->isChecked();
|
||||||
bool isZmax = chkZMax->isChecked();
|
bool isZmax = chkZMax->isChecked();
|
||||||
@ -574,682 +612,104 @@ void qTabPlot::SetZRange() {
|
|||||||
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
|
emit ResetZMinZMaxSignal(isZmin, isZmax, zmin, zmax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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()));
|
||||||
|
|
||||||
|
try {
|
||||||
|
int freq = myDet->setReceiverStreamingFrequency(-1);
|
||||||
|
if (freq < 0) {
|
||||||
|
qDefs::Message(qDefs::WARNING, "Streaming frequency is inconsistent for all detectors.", "qTabPlot::GetStreamingFrequency");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::Select1DPlot(bool b) {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
if (b)
|
|
||||||
cout << "Selecting 1D Plot" << endl;
|
|
||||||
else
|
|
||||||
cout << "Selecting 2D Plot" << endl;
|
|
||||||
#endif
|
|
||||||
isOneD = b;
|
|
||||||
lblFrom->setEnabled(false);
|
|
||||||
lblTo->setEnabled(false);
|
|
||||||
lblFrom_2->setEnabled(false);
|
|
||||||
lblTo_2->setEnabled(false);
|
|
||||||
spinFrom->setEnabled(false);
|
|
||||||
spinFrom_2->setEnabled(false);
|
|
||||||
spinTo->setEnabled(false);
|
|
||||||
spinTo_2->setEnabled(false);
|
|
||||||
if (b) {
|
|
||||||
box1D->show();
|
|
||||||
box2D->hide();
|
|
||||||
chkZAxis->setEnabled(false);
|
|
||||||
chkZMin->setEnabled(false);
|
|
||||||
chkZMax->setEnabled(false);
|
|
||||||
myPlot->Select1DPlot();
|
|
||||||
} else {
|
|
||||||
box1D->hide();
|
|
||||||
box2D->show();
|
|
||||||
chkZAxis->setEnabled(true);
|
|
||||||
chkZMin->setEnabled(true);
|
|
||||||
chkZMax->setEnabled(true);
|
|
||||||
myPlot->Select2DPlot();
|
|
||||||
}
|
}
|
||||||
}
|
// time interval
|
||||||
|
else if (freq == 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetPlot() {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Entering Set Plot()";
|
|
||||||
#endif
|
|
||||||
if (radioNoPlot->isChecked()) {
|
|
||||||
cout << " - No Plot" << endl;
|
|
||||||
|
|
||||||
boxScan->show();
|
|
||||||
boxHistogram->hide();
|
|
||||||
myPlot->EnablePlot(false);
|
|
||||||
boxSnapshot->setEnabled(false);
|
|
||||||
boxSave->setEnabled(false);
|
|
||||||
boxFrequency->setEnabled(false);
|
|
||||||
boxPlotAxis->setEnabled(false);
|
|
||||||
boxScan->setEnabled(false);
|
|
||||||
|
|
||||||
} else if (radioDataGraph->isChecked()) {
|
|
||||||
cout << " - DataGraph" << endl;
|
|
||||||
|
|
||||||
boxScan->show();
|
|
||||||
boxHistogram->hide();
|
|
||||||
myPlot->EnablePlot(true);
|
|
||||||
Select1DPlot(isOriginallyOneD);
|
|
||||||
boxSnapshot->setEnabled(true);
|
|
||||||
boxSave->setEnabled(true);
|
|
||||||
boxFrequency->setEnabled(true);
|
|
||||||
boxPlotAxis->setEnabled(true);
|
|
||||||
// if(!myPlot->isRunning())
|
|
||||||
// EnableScanBox();
|
|
||||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
|
||||||
myPlot->SetXYRange(true);
|
|
||||||
} else {
|
|
||||||
//histogram and 2d scans dont work
|
|
||||||
if (boxScan->isChecked()) {
|
|
||||||
qDefs::Message(qDefs::WARNING, "<nobr>Histogram cannot be used together with 2D Scan Plots.</nobr><br>"
|
|
||||||
"<nobr>Uncheck <b>2D Scan</b> plots to plot <b>Histograms</b></nobr>",
|
|
||||||
"qTabPlot::SetPlot");
|
|
||||||
radioDataGraph->setChecked(true);
|
|
||||||
boxScan->show();
|
|
||||||
boxHistogram->hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << " - Histogram" << endl;
|
|
||||||
|
|
||||||
if (radioHistIntensity->isChecked()) {
|
|
||||||
pageHistogram->setEnabled(true);
|
|
||||||
pageHistogram_2->setEnabled(true);
|
|
||||||
} else {
|
|
||||||
pageHistogram->setEnabled(false);
|
|
||||||
pageHistogram_2->setEnabled(false);
|
|
||||||
}
|
|
||||||
boxScan->hide();
|
|
||||||
boxHistogram->show();
|
|
||||||
myPlot->EnablePlot(true);
|
|
||||||
Select1DPlot(isOriginallyOneD);
|
|
||||||
boxSnapshot->setEnabled(true);
|
|
||||||
boxSave->setEnabled(true);
|
|
||||||
boxFrequency->setEnabled(true);
|
|
||||||
boxPlotAxis->setEnabled(true);
|
|
||||||
// if(!myPlot->isRunning())
|
|
||||||
// EnableScanBox();
|
|
||||||
|
|
||||||
//qDefs::Message(qDefs::INFORMATION,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
|
||||||
// "before <b>Starting Acquitision</b></nobr>","qTabPlot::SetPlot");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetFrequency() {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Setting Plot Interval Frequency" << endl;
|
|
||||||
#endif
|
|
||||||
disconnect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
double timeMS, acqPeriodMS;
|
|
||||||
double minPlotTimer = myPlot->GetMinimumPlotTimer();
|
|
||||||
char cMin[200];
|
|
||||||
sprintf(cMin, "%f ms", minPlotTimer);
|
|
||||||
|
|
||||||
acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD, -1) * (1E-6));
|
|
||||||
//if period is 0, check exptime, if that is also 0, give warning and set to min timer
|
|
||||||
if (acqPeriodMS == 0) {
|
|
||||||
acqPeriodMS = (myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME, -1) * (1E-6));
|
|
||||||
|
|
||||||
if (acqPeriodMS == 0) {
|
|
||||||
//to reduce the warnings displayed
|
|
||||||
if ((comboFrequency->currentIndex() == 0) && (spinTimeGap->value() == minPlotTimer))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
qDefs::Message(qDefs::WARNING, "<nobr>Interval between Plots:</nobr><br><nobr>"
|
|
||||||
"<b>Every Nth Image</b>: Period betwen Frames and Exposure Time cannot both be 0 ms.</nobr><br><nobr>"
|
|
||||||
"Resetting to minimum plotting time interval",
|
|
||||||
"qTabPlot::SetFrequency");
|
|
||||||
comboFrequency->setCurrentIndex(0);
|
comboFrequency->setCurrentIndex(0);
|
||||||
stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
|
stackedLayout->setCurrentIndex(0);
|
||||||
spinTimeGap->setValue(minPlotTimer);
|
try {
|
||||||
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
|
int timeMs = myDet->setReceiverStreamingTimer(-1);
|
||||||
timeMS = minPlotTimer;
|
if (freq < 0) {
|
||||||
//This is done so that its known which one was selected
|
qDefs::Message(qDefs::WARNING, "Streaming timer is inconsistent for all detectors.", "qTabPlot::GetStreamingFrequency");
|
||||||
myPlot->SetFrameFactor(0);
|
} else {
|
||||||
// Setting the timer value(ms) between plots
|
double timeS = static_cast<double>(timeMs) / 1000.00;
|
||||||
myPlot->SetPlotTimer(timeMS);
|
auto time = qDefs::getCorrectTime(timeS);
|
||||||
|
spinTimeGap->setValue(time.first);
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
comboTimeGapUnit->setcurrentIndex(static_cast<int>(time.second));
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
}
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
} catch(const sls::NonCriticalError &e) {
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
qDefs::ExceptionMessage("Could not get streaming timer.", e.what(), "qTabPlot::GetStreamingFrequency");
|
||||||
qDefs::checkErrorMessage(myDet, "qTabPlot::SetFrequency");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// every nth frame
|
||||||
stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
|
|
||||||
switch (comboFrequency->currentIndex()) {
|
|
||||||
case 0:
|
|
||||||
// Get the time interval from gui in ms
|
|
||||||
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(), spinTimeGap->value())) / (1e6);
|
|
||||||
|
|
||||||
if ((int)timeMS == 0) {
|
|
||||||
qDefs::Message(qDefs::WARNING, "<nobr>Interval between Plots:</nobr><br><nobr>"
|
|
||||||
"Time Interval must be atleast >= 1 ms. Resetting to minimum plotting time interval.",
|
|
||||||
"qTabPlot::SetFrequency");
|
|
||||||
spinTimeGap->setValue(minPlotTimer);
|
|
||||||
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
|
|
||||||
timeMS = minPlotTimer;
|
|
||||||
}
|
|
||||||
|
|
||||||
//show red if min interval<minplottimer
|
|
||||||
if (timeMS < minPlotTimer) {
|
|
||||||
//qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots: You might be losing Images!</nobr>","Plot");
|
|
||||||
boxFrequency->setPalette(*red);
|
|
||||||
boxFrequency->setTitle("Interval between Plots*");
|
|
||||||
QString errTip = intervalTip + QString("<br><br><font color=\"red\"><nobr>"
|
|
||||||
"<b>Time Interval</b> Condition: min of ") +
|
|
||||||
QString("%1").arg(minPlotTimer) +
|
|
||||||
QString("ms.</nobr><br><nobr>You might be losing images!</nobr></font>");
|
|
||||||
boxFrequency->setToolTip(errTip);
|
|
||||||
}
|
|
||||||
//show red if acqPeriod<minInterval
|
|
||||||
else if ((acqPeriodMS + 1) < timeMS) {
|
|
||||||
cout << "\nacqPeriodMS:" << acqPeriodMS << "\ttimeMS:" << timeMS << endl;
|
|
||||||
//qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots: You might be losing Images!</nobr>","Plot");
|
|
||||||
boxFrequency->setPalette(*red);
|
|
||||||
boxFrequency->setTitle("Interval between Plots*");
|
|
||||||
QString errTip = intervalTip + QString("<br><br><font color=\"red\"><nobr>"
|
|
||||||
"<b>Time Interval</b> Acquisition Period should be >= Time Interval between plots.</nobr><br><nobr>"
|
|
||||||
"You might be losing images!</nobr></font>");
|
|
||||||
boxFrequency->setToolTip(errTip);
|
|
||||||
}
|
|
||||||
//correct
|
|
||||||
else {
|
else {
|
||||||
boxFrequency->setPalette(boxSnapshot->palette());
|
|
||||||
boxFrequency->setTitle("Interval between Plots");
|
|
||||||
boxFrequency->setToolTip(intervalTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
//This is done so that its known which one was selected
|
|
||||||
myPlot->SetFrameFactor(0);
|
|
||||||
// Setting the timer value(ms) between plots
|
|
||||||
myPlot->SetPlotTimer(timeMS);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Plotting Frequency: Time Gap - " << spinTimeGap->value() << qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex()) << endl;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
|
|
||||||
// gets the acq period * number of nth frames
|
|
||||||
timeMS = (spinNthFrame->value()) * acqPeriodMS;
|
|
||||||
|
|
||||||
//Show red to make sure the period between plotting is not less than minimum plot timer in ms
|
|
||||||
if (timeMS < minPlotTimer) {
|
|
||||||
int minFrame = (int)(ceil)(minPlotTimer / acqPeriodMS);
|
|
||||||
//qDefs::Message(qDefs::WARNING,"<nobr>Interval between Plots: You might be losing Images!</nobr>","Plot");
|
|
||||||
boxFrequency->setPalette(*red);
|
|
||||||
boxFrequency->setTitle("Interval between Plots*");
|
|
||||||
QString errTip = intervalTip + QString("<br><br><font color=\"red\"><nobr>"
|
|
||||||
"<b>Every nth Image</b> Condition: min nth Image for this time period: ") +
|
|
||||||
QString("%1").arg(minFrame) +
|
|
||||||
QString(".</nobr><br><nobr>You might be losing images!</nobr></font>");
|
|
||||||
boxFrequency->setToolTip(errTip);
|
|
||||||
} else {
|
|
||||||
boxFrequency->setPalette(boxSnapshot->palette());
|
|
||||||
boxFrequency->setTitle("Interval between Plots");
|
|
||||||
boxFrequency->setToolTip(intervalTip);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setting the timer value (nth frames) between plots
|
|
||||||
myPlot->SetFrameFactor(spinNthFrame->value());
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl;
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
qDefs::checkErrorMessage(myDet, "qTabPlot::SetFrequency");
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabPlot::EnableScanBox(){
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Entering Enable Scan Box"<< endl;
|
|
||||||
#endif
|
|
||||||
disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
|
||||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
|
||||||
|
|
||||||
int oldfreqvalue = myDet->setReadReceiverFrequency();
|
|
||||||
|
|
||||||
int mode0 = myDet->getScanMode(0);
|
|
||||||
int mode1 = myDet->getScanMode(1);
|
|
||||||
|
|
||||||
radioHistLevel0->setEnabled(mode0);
|
|
||||||
radioHistLevel1->setEnabled(mode1);
|
|
||||||
int ang;
|
|
||||||
bool angConvert = myDet->getAngularConversion(ang);
|
|
||||||
myPlot->EnableAnglePlot(angConvert);
|
|
||||||
|
|
||||||
radioDataGraph->setEnabled(true);
|
|
||||||
radioHistogram->setEnabled(true);
|
|
||||||
chkSuperimpose->setEnabled(true);
|
|
||||||
pageAccumulate->setEnabled(true);
|
|
||||||
pageAccumulate_2->setEnabled(true);
|
|
||||||
if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) ||
|
|
||||||
(myDet->getDetectorsType() == slsDetectorDefs::PROPIX) ||
|
|
||||||
(myDet->getDetectorsType() == slsDetectorDefs::JUNGFRAU) ||
|
|
||||||
(myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){
|
|
||||||
pagePedestal->setEnabled(true);
|
|
||||||
pagePedestal_2->setEnabled(true);
|
|
||||||
chkBinary->setEnabled(true);
|
|
||||||
chkBinary_2->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if angle plot or originally 2d, uncheck and disable scanbox
|
|
||||||
if ((angConvert) || (!isOriginallyOneD)){
|
|
||||||
boxScan->setChecked(false);
|
|
||||||
boxScan->setEnabled(false);
|
|
||||||
|
|
||||||
/**Newly added*/
|
|
||||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
|
||||||
if(!isOriginallyOneD)
|
|
||||||
myPlot->SetXYRange(true);
|
|
||||||
|
|
||||||
//2d scans read every frame, not compulsory, but for historgrams
|
|
||||||
if((!isOriginallyOneD) && (mode0 || mode1)){
|
|
||||||
//read every frame
|
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
comboFrequency->setCurrentIndex(1);
|
comboFrequency->setCurrentIndex(1);
|
||||||
spinNthFrame->setValue(1);
|
stackedLayout->setCurrentIndex(1);
|
||||||
SetFrequency();
|
spinNthFrame->setValue(freq);
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
}
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
} catch (const sls::NonCriticalError &e) {
|
||||||
|
qDefs::ExceptionMessage("Could not get streaming frequency.", e.what(), "qTabPlot::GetStreamingFrequency");
|
||||||
}
|
}
|
||||||
|
|
||||||
//persistency, accumulate, pedestal, binary
|
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||||
if(angConvert){
|
connect(comboTimeGapUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetStreamingFrequency()));
|
||||||
if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false);
|
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||||
if(chkPedestal->isChecked()) chkPedestal->setChecked(false);
|
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetStreamingFrequency()));
|
||||||
if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false);
|
|
||||||
if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false);
|
|
||||||
if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false);
|
|
||||||
if(chkBinary->isChecked()) chkBinary->setChecked(false);
|
|
||||||
if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false);
|
|
||||||
pagePedestal->setEnabled(false);
|
|
||||||
pagePedestal_2->setEnabled(false);
|
|
||||||
chkBinary->setEnabled(false);
|
|
||||||
chkBinary_2->setEnabled(false);
|
|
||||||
pageAccumulate->setEnabled(false);
|
|
||||||
pageAccumulate_2->setEnabled(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(angConvert){
|
void qTabPlot::SetStreamingFrequency() {
|
||||||
boxScan->setToolTip("<nobr>Only 1D Plots enabled for Angle Plots</nobr>");
|
bool frequency = (comboFrequency->currentIndex() == 0) ? 0 : 1;
|
||||||
//disable histogram
|
auto freqVal = spinNthFrame->value();
|
||||||
if(radioHistogram->isChecked()){
|
auto timeVal = spinTimeGap->value();
|
||||||
radioDataGraph->setChecked(true);
|
auto timeUnit = static_cast<qDefs::timeUnit>(comboTimeGapUnit->currentIndex());
|
||||||
radioHistogram->setEnabled(false);
|
|
||||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
|
||||||
myPlot->SetXYRange(true);
|
|
||||||
boxScan->show();
|
|
||||||
boxHistogram->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//originally1d && not angle plot
|
try {
|
||||||
else{
|
if (frequency) {
|
||||||
boxScan->setToolTip("");
|
FILE_LOG(logINFO) << "Setting Streaming Frequency to " << freqVal;
|
||||||
boxScan->setEnabled(true);
|
myDet->setReceiverStreamingFrequency(freqVal);
|
||||||
/*if(mode0 || mode1)
|
|
||||||
boxScan->setChecked(true);*/
|
|
||||||
|
|
||||||
//2d enabled with boxscan
|
|
||||||
if(boxScan->isChecked()){
|
|
||||||
|
|
||||||
//2d for 1d detctors and histogram dont go
|
|
||||||
if(radioHistogram->isChecked()){
|
|
||||||
radioDataGraph->setChecked(true);
|
|
||||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
|
||||||
myPlot->SetXYRange(true);
|
|
||||||
boxScan->show();
|
|
||||||
boxHistogram->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
//read every frame
|
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
comboFrequency->setCurrentIndex(1);
|
|
||||||
spinNthFrame->setValue(1);
|
|
||||||
SetFrequency();
|
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
|
|
||||||
//enabling options
|
|
||||||
radioFileIndex->setEnabled(mode0||mode1);
|
|
||||||
if(mode0 && mode1){
|
|
||||||
radioLevel0->setEnabled(false);
|
|
||||||
radioLevel1->setEnabled(false);
|
|
||||||
} else {
|
} else {
|
||||||
radioLevel0->setEnabled(mode0);
|
FILE_LOG(logINFO) << "Setting Streaming Timer to " << timeVal << " " << qDefs::getUnitString(timeUnit);
|
||||||
radioLevel1->setEnabled(mode1);
|
double timeMS = qDefs::getMSTime(timeUnit, timeVal);
|
||||||
|
myDet->setReceiverStreamingTimer(timeMS);
|
||||||
}
|
}
|
||||||
//default is allframes if checked button is disabled
|
} catch (const sls::NonCriticalError &e) {
|
||||||
if(!btnGroupScan->checkedButton()->isEnabled())
|
qDefs::ExceptionMessage("Could not set streaming frequency/ timer.", e.what(), "qTabPlot::SetStreamingFrequency");
|
||||||
radioAllFrames->setChecked(true);
|
GetStreamingFrequency();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//histogram
|
|
||||||
if(radioHistogram->isChecked()){
|
|
||||||
if(radioHistIntensity->isChecked()){
|
|
||||||
pageHistogram->setEnabled(true);
|
|
||||||
pageHistogram_2->setEnabled(true);
|
|
||||||
}else{
|
|
||||||
pageHistogram->setEnabled(false);
|
|
||||||
pageHistogram_2->setEnabled(false);
|
|
||||||
}
|
|
||||||
stackedWidget->setCurrentIndex(stackedWidget->count()-1);
|
|
||||||
stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
|
|
||||||
box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
|
|
||||||
box2D->setTitle(QString("2D Plot Options %1 - Histogram").arg(stackedWidget_2->currentIndex()+1));
|
|
||||||
|
|
||||||
if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false);
|
|
||||||
if(chkPedestal->isChecked()) chkPedestal->setChecked(false);
|
|
||||||
if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false);
|
|
||||||
if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false);
|
|
||||||
if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false);
|
|
||||||
if(chkBinary->isChecked()) chkBinary->setChecked(false);
|
|
||||||
if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false);
|
|
||||||
pagePedestal->setEnabled(false);
|
|
||||||
pagePedestal_2->setEnabled(false);
|
|
||||||
chkBinary->setEnabled(false);
|
|
||||||
chkBinary_2->setEnabled(false);
|
|
||||||
pageAccumulate->setEnabled(false);
|
|
||||||
pageAccumulate_2->setEnabled(false);
|
|
||||||
|
|
||||||
//read every frame
|
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
comboFrequency->setCurrentIndex(1);
|
|
||||||
spinNthFrame->setValue(1);
|
|
||||||
SetFrequency();
|
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
|
|
||||||
}else{
|
|
||||||
pageHistogram->setEnabled(false);
|
|
||||||
pageHistogram_2->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if it was set to read every frame
|
|
||||||
if (oldfreqvalue != 0 && (comboFrequency->currentIndex() != 1 || spinNthFrame->value() != oldfreqvalue)) {
|
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
comboFrequency->setCurrentIndex(1);
|
|
||||||
spinNthFrame->setValue(1);
|
|
||||||
SetFrequency();
|
|
||||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
|
||||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
|
||||||
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetScanArgument(){
|
|
||||||
#ifdef VERYVERBOSE
|
|
||||||
cout << "Entering qTabPlot::SetScanArgument()" << endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//1d
|
|
||||||
if(isOriginallyOneD){
|
|
||||||
dispXAxis->setText(defaultHistXAxisTitle);
|
|
||||||
dispYAxis->setText(defaultHistYAxisTitle);
|
|
||||||
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
|
||||||
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
|
||||||
Select1DPlot(true);
|
|
||||||
}
|
|
||||||
//2d
|
|
||||||
else{
|
|
||||||
dispXAxis->setText(defaultImageXAxisTitle);
|
|
||||||
dispYAxis->setText(defaultImageYAxisTitle);
|
|
||||||
dispZAxis->setText(defaultImageZAxisTitle);
|
|
||||||
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
|
|
||||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
|
||||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
|
||||||
Select1DPlot(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//histogram default - set before setscanargument
|
|
||||||
int min = spinHistFrom->value();
|
|
||||||
int max = spinHistTo->value();
|
|
||||||
double size = spinHistSize->value();
|
|
||||||
int histArg = qDefs::Intensity;
|
|
||||||
if(radioHistogram->isChecked()){
|
|
||||||
if(!radioHistIntensity->isChecked()){
|
|
||||||
|
|
||||||
int mode = 0;
|
|
||||||
histArg = qDefs::histLevel0;
|
|
||||||
if(radioHistLevel1->isChecked()){
|
|
||||||
mode = 1;
|
|
||||||
histArg = qDefs::histLevel1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int numSteps = myDet->getScanSteps(mode);
|
|
||||||
double *values = NULL;
|
|
||||||
min = 0;max = 1;size = 1;
|
|
||||||
|
|
||||||
if(numSteps > 0){
|
|
||||||
values = new double[numSteps];
|
|
||||||
myDet->getScanSteps(mode,values);
|
|
||||||
min = values[0];
|
|
||||||
max = values[numSteps - 1];
|
|
||||||
size = (max - min)/(numSteps - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//cout <<"min:"<<min<<" max:"<<max<<" size:"<<size<<endl;
|
|
||||||
myPlot->SetHistogram(radioHistogram->isChecked(),histArg,min,max,size);
|
|
||||||
|
|
||||||
if(radioHistogram->isChecked()){
|
|
||||||
if(radioHistIntensity->isChecked())
|
|
||||||
dispXAxis->setText("Intensity");
|
|
||||||
else if (radioHistLevel0->isChecked())
|
|
||||||
dispXAxis->setText("Level 0");
|
|
||||||
else
|
|
||||||
dispXAxis->setText("Level 1");
|
|
||||||
dispYAxis->setText("Frequency");
|
|
||||||
myPlot->SetHistXAxisTitle("Intensity");
|
|
||||||
myPlot->SetHistYAxisTitle("Frequency");
|
|
||||||
Select1DPlot(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//angles (1D)
|
|
||||||
int ang;
|
|
||||||
if(myDet->getAngularConversion(ang)){
|
|
||||||
dispXAxis->setText("Angles");
|
|
||||||
myPlot->SetHistXAxisTitle("Angles");
|
|
||||||
Select1DPlot(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//1d with scan
|
|
||||||
if(boxScan->isChecked()){
|
|
||||||
myPlot->SetScanArgument(btnGroupScan->checkedId()+1);
|
|
||||||
|
|
||||||
switch(btnGroupScan->checkedId()){
|
|
||||||
case 0://level0
|
|
||||||
dispYAxis->setText("Scan Level 0");
|
|
||||||
myPlot->SetImageYAxisTitle("Scan Level 0");
|
|
||||||
break;
|
|
||||||
case 1://level1
|
|
||||||
dispYAxis->setText("Scan Level 1");
|
|
||||||
myPlot->SetImageYAxisTitle("Scan Level 1");
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
case 2://file index
|
|
||||||
dispYAxis->setText("Frame Index");
|
|
||||||
myPlot->SetImageYAxisTitle("Frame Index");
|
|
||||||
break;
|
|
||||||
case 3://all frames
|
|
||||||
dispYAxis->setText("All Frames");
|
|
||||||
myPlot->SetImageYAxisTitle("All Frames");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Select1DPlot(false);
|
|
||||||
}else
|
|
||||||
myPlot->SetScanArgument(qDefs::None);
|
|
||||||
|
|
||||||
//update the from and to labels to be enabled
|
|
||||||
SetBinary();
|
|
||||||
|
|
||||||
qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::SetHistogramOptions() {
|
|
||||||
if (radioHistIntensity->isChecked()) {
|
|
||||||
pageHistogram->setEnabled(true);
|
|
||||||
pageHistogram_2->setEnabled(true);
|
|
||||||
} else {
|
|
||||||
pageHistogram->setEnabled(false);
|
|
||||||
pageHistogram_2->setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void qTabPlot::Refresh() {
|
void qTabPlot::Refresh() {
|
||||||
|
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << endl
|
|
||||||
<< "**Updating Plot Tab" << endl;
|
|
||||||
#endif
|
|
||||||
if (!myPlot->isRunning()) {
|
if (!myPlot->isRunning()) {
|
||||||
if (!radioNoPlot->isChecked())
|
boxPlotType->setEnabled(true);
|
||||||
|
|
||||||
|
// streaming frequency
|
||||||
|
if (!radioNoPlot->isChecked()) {
|
||||||
boxFrequency->setEnabled(true);
|
boxFrequency->setEnabled(true);
|
||||||
SetFrequency();
|
}
|
||||||
|
GetStreamingFrequency();
|
||||||
if (chkGapPixels->isEnabled()) {
|
// gain plot, gap pixels enable
|
||||||
|
switch(myDet->getDetectorTypeAsEnum()) {
|
||||||
|
case slsDetectorDefs::EIGER:
|
||||||
|
chkGapPixels->setEnabled(true);
|
||||||
GetGapPixels();
|
GetGapPixels();
|
||||||
|
break;
|
||||||
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
|
case slsDetectorDefs::MOENCH:
|
||||||
|
chkGainPlot->setEnabled(true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boxPlotType->setEnabled(false);
|
||||||
|
boxFrequency->setEnabled(false);
|
||||||
|
chkGainPlot->setEnabled(false);
|
||||||
|
chkGapPixels->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
FILE_LOG(logDEBUG) << "**Updated Plot Tab";
|
||||||
boxFrequency->setEnabled(false);
|
|
||||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
|
||||||
boxScan->setEnabled(false);
|
|
||||||
pageHistogram->setEnabled(false);
|
|
||||||
pageHistogram_2->setEnabled(false);
|
|
||||||
if (radioHistogram->isChecked())
|
|
||||||
radioDataGraph->setEnabled(false);
|
|
||||||
else
|
|
||||||
radioHistogram->setEnabled(false);
|
|
||||||
}
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "**Updated Plot Tab" << endl
|
|
||||||
<< endl;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user