This commit is contained in:
2019-07-04 16:40:25 +02:00
parent 6a60f7d222
commit c582ba15d5
16 changed files with 421 additions and 250 deletions

View File

@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>775</width> <width>819</width>
<height>345</height> <height>377</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@@ -48,7 +48,7 @@
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>4</number>
</property> </property>
<property name="elideMode"> <property name="elideMode">
<enum>Qt::ElideLeft</enum> <enum>Qt::ElideLeft</enum>
@@ -80,7 +80,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>450</width> <width>550</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@@ -95,6 +95,12 @@
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QSpinBox" name="spinSetAllTrimbits"> <widget class="QSpinBox" name="spinSetAllTrimbits">
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="minimum"> <property name="minimum">
<number>-1</number> <number>-1</number>
</property> </property>
@@ -109,12 +115,12 @@
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>190</height> <height>250</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@@ -273,8 +279,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>735</width> <width>779</width>
<height>235</height> <height>267</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridRoi"> <layout class="QGridLayout" name="gridRoi">
@@ -306,7 +312,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -342,7 +348,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
@@ -392,7 +398,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -400,7 +406,7 @@
#rx_udpip#</string> #rx_udpip#</string>
</property> </property>
<property name="text"> <property name="text">
<string>none</string> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -415,7 +421,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -423,7 +429,7 @@
#rx_udpmac#</string> #rx_udpmac#</string>
</property> </property>
<property name="text"> <property name="text">
<string>none</string> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -457,7 +463,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -465,7 +471,7 @@
#detectormac#</string> #detectormac#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -480,7 +486,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>127</width> <width>127</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -524,7 +530,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -532,7 +538,7 @@
#online#</string> #online#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Offline</string>
</property> </property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
@@ -550,7 +556,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>127</width> <width>127</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -620,7 +626,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -628,7 +634,7 @@
#detectorip#</string> #detectorip#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -643,7 +649,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -713,7 +719,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -770,7 +776,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>127</width> <width>127</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -814,7 +820,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -822,7 +828,7 @@
#rx_udpip#</string> #rx_udpip#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -844,9 +850,12 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>60</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@@ -863,7 +872,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -871,7 +880,7 @@
#r_online#</string> #r_online#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>Offline</string>
</property> </property>
<property name="readOnly"> <property name="readOnly">
<bool>true</bool> <bool>true</bool>
@@ -902,7 +911,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
</widget> </widget>
@@ -1002,7 +1011,7 @@
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>180</width> <width>180</width>
<height>0</height> <height>25</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
@@ -1010,7 +1019,7 @@
#detectorip#</string> #detectorip#</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>0</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -1069,7 +1078,7 @@
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeType"> <property name="sizeType">
<enum>QSizePolicy::Fixed</enum> <enum>QSizePolicy::Expanding</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
@@ -1090,6 +1099,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #cycles * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Number of additional storage cells. For Jungfrau only. &lt;/p&gt;&lt;p&gt;Default: 0. &lt;/p&gt;&lt;p&gt;Number of Images received: #frames * #cycles * (#storagecells+1) &lt;/p&gt;&lt;p&gt; #storagecells#&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
@@ -1130,6 +1145,12 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;nobr&gt; <string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode Exposure Time of a sub frame. Only for Eiger in 32 bit mode
@@ -1187,6 +1208,12 @@ Default value is 0. A value less than the required minimum is ignored.
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;nobr&gt; <string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode. Period between sub frames. Only for Eiger in 32 bit mode.
@@ -1244,6 +1271,12 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;nobr&gt; <string>&lt;nobr&gt;
Period between sub frames. Only for Eiger in 32 bit mode. Period between sub frames. Only for Eiger in 32 bit mode.
@@ -1302,6 +1335,12 @@ Default value is 0. A value less than the required minimum is ignored.
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>&lt;nobr&gt; <string>&lt;nobr&gt;
Exposure Time of a sub frame. Only for Eiger in 32 bit mode Exposure Time of a sub frame. Only for Eiger in 32 bit mode
@@ -1369,6 +1408,36 @@ Exposure Time of a sub frame. Only for Eiger in 32 bit mode
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>tabAdvancedSettings</tabstop>
<tabstop>spinSetAllTrimbits</tabstop>
<tabstop>btnAddRoi</tabstop>
<tabstop>btnSetRoi</tabstop>
<tabstop>btnGetRoi</tabstop>
<tabstop>btnClearRoi</tabstop>
<tabstop>scrollArea</tabstop>
<tabstop>comboDetector</tabstop>
<tabstop>dispOnline</tabstop>
<tabstop>spinControlPort</tabstop>
<tabstop>spinStopPort</tabstop>
<tabstop>dispDetectorUDPIP</tabstop>
<tabstop>dispDetectorUDPMAC</tabstop>
<tabstop>spinZMQPort</tabstop>
<tabstop>dispZMQIP</tabstop>
<tabstop>dispRxrHostname</tabstop>
<tabstop>dispRxrOnline</tabstop>
<tabstop>spinRxrTCPPort</tabstop>
<tabstop>spinRxrUDPPort</tabstop>
<tabstop>dispRxrUDPIP</tabstop>
<tabstop>dispRxrUDPMAC</tabstop>
<tabstop>spinRxrZMQPort</tabstop>
<tabstop>dispRxrZMQIP</tabstop>
<tabstop>spinNumStoragecells</tabstop>
<tabstop>spinSubExpTime</tabstop>
<tabstop>comboSubExpTimeUnit</tabstop>
<tabstop>spinSubDeadTime</tabstop>
<tabstop>comboSubDeadTimeUnit</tabstop>
</tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>
</resources> </resources>

View File

@@ -718,6 +718,21 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>comboDetector</tabstop>
<tabstop>dispOutputDir</tabstop>
<tabstop>btnOutputBrowse</tabstop>
<tabstop>comboFileFormat</tabstop>
<tabstop>chkOverwriteEnable</tabstop>
<tabstop>chkTenGiga</tabstop>
<tabstop>chkRate</tabstop>
<tabstop>radioDefaultDeadtime</tabstop>
<tabstop>radioCustomDeadtime</tabstop>
<tabstop>spinCustomDeadTime</tabstop>
<tabstop>comboEigerClkDivider</tabstop>
<tabstop>comboEigerFlags1</tabstop>
<tabstop>comboEigerFlags2</tabstop>
</tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>
</resources> </resources>

View File

@@ -176,20 +176,40 @@
<number>18</number> <number>18</number>
</property> </property>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Current Frame: </string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>Current Measurement:</string> <string>Current Measurement:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Current Frame: </string>
</property>
</widget>
</item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QLabel" name="lblCurrentFrame">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="lblCurrentMeasurement"> <widget class="QLabel" name="lblCurrentMeasurement">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred"> <sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@@ -211,26 +231,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1">
<widget class="QLabel" name="lblCurrentFrame">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QProgressBar" name="progressBar">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@@ -1047,6 +1047,22 @@ Frame period between exposures.
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>chkFile</tabstop>
<tabstop>dispFileName</tabstop>
<tabstop>spinIndex</tabstop>
<tabstop>comboTimingMode</tabstop>
<tabstop>spinNumMeasurements</tabstop>
<tabstop>spinNumFrames</tabstop>
<tabstop>spinExpTime</tabstop>
<tabstop>comboExpUnit</tabstop>
<tabstop>spinPeriod</tabstop>
<tabstop>comboPeriodUnit</tabstop>
<tabstop>spinNumTriggers</tabstop>
<tabstop>spinDelay</tabstop>
<tabstop>comboDelayUnit</tabstop>
<tabstop>spinNumSamples</tabstop>
</tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>
</resources> </resources>

View File

@@ -2550,6 +2550,57 @@ Streaming Interval between 2 plots. Default is time interval with 200 ms.
<zorder>boxPlotAxis</zorder> <zorder>boxPlotAxis</zorder>
<zorder>boxSnapshot</zorder> <zorder>boxSnapshot</zorder>
</widget> </widget>
<tabstops>
<tabstop>radioNoPlot</tabstop>
<tabstop>radioDataGraph</tabstop>
<tabstop>comboFrequency</tabstop>
<tabstop>spinTimeGap</tabstop>
<tabstop>comboTimeGapUnit</tabstop>
<tabstop>chkPedestal</tabstop>
<tabstop>chkInterpolate</tabstop>
<tabstop>chkContour</tabstop>
<tabstop>chkLogz</tabstop>
<tabstop>chkTitle</tabstop>
<tabstop>dispTitle</tabstop>
<tabstop>chkAspectRatio</tabstop>
<tabstop>chkXAxis</tabstop>
<tabstop>dispXAxis</tabstop>
<tabstop>chkXMin</tabstop>
<tabstop>dispXMin</tabstop>
<tabstop>chkXMax</tabstop>
<tabstop>dispXMax</tabstop>
<tabstop>chkYAxis</tabstop>
<tabstop>dispYAxis</tabstop>
<tabstop>chkYMin</tabstop>
<tabstop>dispYMin</tabstop>
<tabstop>chkYMax</tabstop>
<tabstop>dispYMax</tabstop>
<tabstop>chkZAxis</tabstop>
<tabstop>dispZAxis</tabstop>
<tabstop>chkZMin</tabstop>
<tabstop>dispZMin</tabstop>
<tabstop>chkZMax</tabstop>
<tabstop>dispZMax</tabstop>
<tabstop>spinTo_2</tabstop>
<tabstop>chkStatistics_2</tabstop>
<tabstop>chkGainPlot</tabstop>
<tabstop>chkGapPixels</tabstop>
<tabstop>chkSuperimpose</tabstop>
<tabstop>spinPersistency</tabstop>
<tabstop>chk1DLog</tabstop>
<tabstop>chkPoints</tabstop>
<tabstop>chkLines</tabstop>
<tabstop>chkAccumulate</tabstop>
<tabstop>spinFrom_2</tabstop>
<tabstop>chkBinary</tabstop>
<tabstop>spinFrom</tabstop>
<tabstop>spinTo</tabstop>
<tabstop>chkStatistics</tabstop>
<tabstop>chkAccumulate_2</tabstop>
<tabstop>spinNthFrame</tabstop>
<tabstop>chkPedestal_2</tabstop>
<tabstop>chkBinary_2</tabstop>
</tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>
</resources> </resources>

View File

@@ -274,6 +274,11 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops>
<tabstop>comboSettings</tabstop>
<tabstop>spinThreshold</tabstop>
<tabstop>comboDynamicRange</tabstop>
</tabstops>
<resources> <resources>
<include location="../include/icons.qrc"/> <include location="../include/icons.qrc"/>
</resources> </resources>

View File

@@ -99,6 +99,16 @@ class qDefs : public QWidget {
*/ */
enum range { XMIN, XMAX, YMIN, YMAX }; enum range { XMIN, XMAX, YMIN, YMAX };
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";
}
};
/** /**
* function enums for the qServer and qClient * function enums for the qServer and qClient
*/ */

View File

@@ -45,7 +45,7 @@ class qDetectorMain : public QMainWindow, private Ui::DetectorMainObject {
* @param b bool TRUE if undocked(outside main window), FALSE docked * @param b bool TRUE if undocked(outside main window), FALSE docked
*/ */
void ResizeMainWindow(bool b); void ResizeMainWindow(bool b);
void EnableTabs(); void EnableTabs(bool enable);
void SetZoomToolTip(bool disable); void SetZoomToolTip(bool disable);
protected: protected:

View File

@@ -10,40 +10,18 @@ class qCloneWidget;
class QGridLayout; class QGridLayout;
class QGroupBox; class QGroupBox;
class QwtSymbol; class QwtSymbol;
#include <QFutureWatcher>
/*
#include "qwt_symbol.h"
#include <QGroupBox>
#include <QString>
#include <QTimer>
#include <QWidget>
#include <QVector>
#include <qpen.h>
#include <qwt_column_symbol.h>
#include <qwt_plot_grid.h>
#include <qwt_plot_histogram.h>
#include <qwt_series_data.h>
*/
class qDrawPlot : public QWidget { class qDrawPlot : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
/** \short The constructor */ qDrawPlot(QWidget *parent, multiSlsDetector *detector);
qDrawPlot(QWidget *parent, multiSlsDetector *detector);
/** Destructor */
~qDrawPlot(); ~qDrawPlot();
bool GetIsRunning(); bool GetIsRunning();
// from measurement tabs void SetRunning(bool enable);
int GetProgress(); int GetProgress();
int64_t GetCurrentFrameIndex(); int64_t GetCurrentFrameIndex();
int64_t GetCurrentMeasurementIndex();
int GetNumMeasurements();
void SetNumMeasurements(int val);
// from plot tab
void Select1dPlot(bool enable); void Select1dPlot(bool enable);
void SetPlotTitlePrefix(QString title); void SetPlotTitlePrefix(QString title);
void SetXAxisTitle(QString title); void SetXAxisTitle(QString title);
@@ -80,17 +58,18 @@ class qDrawPlot : public QWidget {
void CloseClones(); void CloseClones();
void SaveClones(); void SaveClones();
void SavePlot(); void SavePlot();
void SetStopSignal();
private slots: private slots:
void SetSaveFileName(QString val); void SetSaveFileName(QString val);
void CloneCloseEvent(int id); void CloneCloseEvent(int id);
void AcquireThread(); void AcquireFinished();
void UpdatePlot();
signals: signals:
void AcquireSignal();
void AcquireFinishedSignal(); void AcquireFinishedSignal();
void AbortSignal();
void UpdateSignal();
private: private:
void SetupWidgetWindow(); void SetupWidgetWindow();
@@ -105,11 +84,14 @@ class qDrawPlot : public QWidget {
static void GetProgressCallBack(double currentProgress, void *this_pointer); static void GetProgressCallBack(double currentProgress, void *this_pointer);
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, 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); static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
std::string AcquireThread();
void AcquisitionFinished(double currentProgress, int detectorStatus); void AcquisitionFinished(double currentProgress, int detectorStatus);
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex); 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 toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
void Update1dPlot(double* rawData); void Get1dData(double* rawData);
void Update2dPlot(double* rawData, double* gainData); void Get2dData(double* rawData);
void Update1dPlot();
void Update2dPlot();
void Update1dXYRange(); void Update1dXYRange();
void Update2dXYRange(); void Update2dXYRange();
@@ -121,6 +103,7 @@ class qDrawPlot : public QWidget {
QVector<SlsQtH1D *> hists1d; QVector<SlsQtH1D *> hists1d;
SlsQt2DPlotLayout *plot2d{nullptr}; SlsQt2DPlotLayout *plot2d{nullptr};
SlsQt2DPlotLayout *gainplot2d{nullptr}; SlsQt2DPlotLayout *gainplot2d{nullptr};
QFutureWatcher<std::string> *acqResultWatcher;
QGridLayout *layout{nullptr}; QGridLayout *layout{nullptr};
QGroupBox *boxPlot{nullptr}; QGroupBox *boxPlot{nullptr};
@@ -137,6 +120,8 @@ class qDrawPlot : public QWidget {
QString xTitle2d{"Pixel"}; QString xTitle2d{"Pixel"};
QString yTitle2d{"Pixel"}; QString yTitle2d{"Pixel"};
QString zTitle2d{"Intensity"}; QString zTitle2d{"Intensity"};
QString plotTitle{""};
QString indexTitle{""};
bool XYRangeChanged{false}; bool XYRangeChanged{false};
double XYRange[4]{0, 0, 0, 0}; double XYRange[4]{0, 0, 0, 0};
bool isXYRange[4]{false, false, false, false}; bool isXYRange[4]{false, false, false, false};
@@ -146,6 +131,7 @@ class qDrawPlot : public QWidget {
double *datax1d{nullptr}; double *datax1d{nullptr};
std::vector<double *> datay1d; std::vector<double *> datay1d;
double *data2d{nullptr}; double *data2d{nullptr};
double *gainData{nullptr};
//options //options
bool isPlot{true}; bool isPlot{true};
@@ -177,11 +163,8 @@ class qDrawPlot : public QWidget {
bool hasGainData{false}; bool hasGainData{false};
int progress{0}; int progress{0};
int64_t currentMeasurement{0};
int64_t currentFrame{0}; int64_t currentFrame{0};
pthread_mutex_t lastImageCompleteMutex; pthread_mutex_t lastImageCompleteMutex;
bool hasStopped{false};
int numMeasurements{1};
unsigned int nPixelsX{0}; unsigned int nPixelsX{0};
unsigned int nPixelsY{0}; unsigned int nPixelsY{0};

View File

@@ -18,7 +18,8 @@ public:
void Refresh(); void Refresh();
public slots: public slots:
void UpdateFinished(); void AcquireFinished();
void AbortAcquire();
private slots: private slots:
void SetTimingMode(int val); void SetTimingMode(int val);
@@ -43,7 +44,6 @@ private:
void EnableWidgetsforTimingMode(); void EnableWidgetsforTimingMode();
void GetTimingMode(); void GetTimingMode();
void GetNumMeasurements();
void GetNumFrames(); void GetNumFrames();
void GetNumTriggers(); void GetNumTriggers();
void GetNumSamples(); void GetNumSamples();
@@ -61,7 +61,7 @@ private:
int VerifyOutputDirectoryError(); int VerifyOutputDirectoryError();
signals: signals:
void StartSignal(); void EnableTabsSignal(bool);
void FileNameChangedSignal(QString); void FileNameChangedSignal(QString);
private: private:
multiSlsDetector *myDet; multiSlsDetector *myDet;
@@ -81,4 +81,7 @@ private:
QPalette red; QPalette red;
bool delayImplemented; bool delayImplemented;
bool sampleImplemented; bool sampleImplemented;
bool isAcquisitionStopped{false};
int numMeasurements{1};
int currentMeasurement{0};
}; };

View File

@@ -89,6 +89,7 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
} }
void SlsQt2DHist::SetMinMax(double zmin,double zmax){ void SlsQt2DHist::SetMinMax(double zmin,double zmax){
cprintf(GREEN, "zmin:%f zmax:%f\n", zmin, zmax);
if(zmin<zmax){ if(zmin<zmax){
z_min=zmin; z_min=zmin;
z_max=zmax; z_max=zmax;

View File

@@ -74,7 +74,6 @@ void SlsQt2DPlotLayout::KeepZRangeIfSet() {
void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max){
isZmin = isMin; isZmin = isMin;
isZmax = isMax; isZmax = isMax;
// reset zmin and zmax first (recalculate from plot) // reset zmin and zmax first (recalculate from plot)
the_plot->SetZMinMax(); the_plot->SetZMinMax();
@@ -85,11 +84,12 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
if(isLog) { if(isLog) {
the_plot->SetZMinimumToFirstGreaterThanZero(); the_plot->SetZMinimumToFirstGreaterThanZero();
} }
cprintf(BLUE, "zmin:%f zmax:%f\n", zmin, zmax);
// set zmin and zmax // set zmin and zmax
if (isZmin || isZmax) { if (isZmin || isZmax) {
zmin = (isZmin ? min : the_plot->GetZMinimum()); zmin = (isZmin ? min : the_plot->GetZMinimum());
zmax = (isZmax ? max : the_plot->GetZMaximum()); zmax = (isZmax ? max : the_plot->GetZMaximum());
cprintf(RED, "zmin:%f zmax:%f\n", zmin, zmax);
// if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now) // if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now)
// setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof) // setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof)
the_plot->SetZMinMax(zmin, zmax); the_plot->SetZMinMax(zmin, zmax);

View File

@@ -279,15 +279,14 @@ void qDetectorMain::Initialization() {
// tabs // tabs
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*))); connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
// Measurement tab // Measurement tab
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs())); connect(tabMeasurement, SIGNAL(EnableTabsSignal(bool)), this, SLOT(EnableTabs(bool)));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), myPlot, SLOT(SetSaveFileName(QString))); connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), myPlot, SLOT(SetSaveFileName(QString)));
// Plot tab // Plot tab
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool))); connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
// Plotting // Plotting
// When the acquisition is finished, must update the meas tab connect(myPlot, SIGNAL(AcquireFinishedSignal()), tabMeasurement, SLOT(AcquireFinished()));
connect(myPlot, SIGNAL(AcquireFinishedSignal()), this, SLOT(EnableTabs())); connect(myPlot, SIGNAL(AbortSignal()), tabMeasurement, SLOT(AbortAcquire()));
connect(myPlot, SIGNAL(AcquireFinishedSignal()), tabMeasurement, SLOT(UpdateFinished()));
// menubar // menubar
// Modes Menu // Modes Menu
@@ -652,13 +651,9 @@ void qDetectorMain::resizeEvent(QResizeEvent *event) {
event->accept(); event->accept();
} }
void qDetectorMain::EnableTabs() { void qDetectorMain::EnableTabs(bool enable) {
FILE_LOG(logDEBUG1) << "Entering EnableTabs function"; FILE_LOG(logDEBUG) << "qDetectorMain::EnableTabs";
bool enable;
enable = !(tabs->isTabEnabled(DATAOUTPUT));
// or use the Enable/Disable button
// normal tabs // normal tabs
tabs->setTabEnabled(DATAOUTPUT, enable); tabs->setTabEnabled(DATAOUTPUT, enable);
tabs->setTabEnabled(SETTINGS, enable); tabs->setTabEnabled(SETTINGS, enable);
@@ -669,7 +664,6 @@ void qDetectorMain::EnableTabs() {
actionSaveSetup->setEnabled(enable); actionSaveSetup->setEnabled(enable);
actionOpenConfiguration->setEnabled(enable); actionOpenConfiguration->setEnabled(enable);
actionSaveConfiguration->setEnabled(enable); actionSaveConfiguration->setEnabled(enable);
actionMeasurementWizard->setEnabled(enable);
actionDebug->setEnabled(enable); actionDebug->setEnabled(enable);
actionExpert->setEnabled(enable); actionExpert->setEnabled(enable);

View File

@@ -10,20 +10,8 @@
#include <QFileDialog> #include <QFileDialog>
#include <QPainter> #include <QPainter>
#include "qwt_symbol.h" #include "qwt_symbol.h"
#include <QtConcurrentRun>
/*
#include <QFileDialog>
#include <QFont>
#include <QImage>
#include <QPainter>
//#include "qwt_double_interval.h"
#include "qwt_series_data.h"
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
*/
qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector) qDrawPlot::qDrawPlot(QWidget *parent, multiSlsDetector *detector)
@@ -45,6 +33,8 @@ qDrawPlot::~qDrawPlot() {
delete [] it; delete [] it;
if (data2d) if (data2d)
delete [] data2d; delete [] data2d;
if (gainData)
delete [] gainData;
if (plot1d) if (plot1d)
delete plot1d; delete plot1d;
@@ -117,11 +107,15 @@ void qDrawPlot::SetupWidgetWindow() {
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this); myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack), this);
myDet->registerProgressCallback(&(GetProgressCallBack), this); myDet->registerProgressCallback(&(GetProgressCallBack), this);
// future watcher to watch result of AcquireThread only because it uses signals/slots to handle acquire exception
acqResultWatcher = new QFutureWatcher<std::string>();
Initialization(); Initialization();
} }
void qDrawPlot::Initialization() { void qDrawPlot::Initialization() {
connect(this, SIGNAL(AcquireSignal()), this, SLOT(AcquireThread())); connect(this, SIGNAL(UpdateSignal()), this, SLOT(UpdatePlot()));
connect(acqResultWatcher, SIGNAL(finished()), this, SLOT(AcquireFinished()));
} }
void qDrawPlot::SetupStatistics() { void qDrawPlot::SetupStatistics() {
@@ -239,7 +233,9 @@ void qDrawPlot::SetupPlots() {
// gainplot // gainplot
gainplot2d = new SlsQt2DPlotLayout(boxPlot); gainplot2d = new SlsQt2DPlotLayout(boxPlot);
double* gainData = new double[nPixelsY * nPixelsX]; if (gainData)
delete [] gainData;
gainData = new double[nPixelsY * nPixelsX];
for (unsigned int px = 0; px < nPixelsX; ++px) for (unsigned int px = 0; px < nPixelsX; ++px)
for (unsigned int py = 0; py < nPixelsY; ++py) for (unsigned int py = 0; py < nPixelsY; ++py)
gainData[py * nPixelsX + px] = gainData[py * nPixelsX + px] =
@@ -256,7 +252,6 @@ void qDrawPlot::SetupPlots() {
gainplot2d->GetPlot()->enableAxis(1, false); gainplot2d->GetPlot()->enableAxis(1, false);
gainplot2d->GetPlot()->enableAxis(2, false); gainplot2d->GetPlot()->enableAxis(2, false);
gainplot2d->hide(); gainplot2d->hide();
delete [] gainData;
// layout of plots // layout of plots
plotLayout = new QGridLayout(boxPlot); plotLayout = new QGridLayout(boxPlot);
@@ -270,6 +265,10 @@ bool qDrawPlot::GetIsRunning() {
return isRunning; return isRunning;
} }
void qDrawPlot::SetRunning(bool enable) {
isRunning = enable;
}
int qDrawPlot::GetProgress() { int qDrawPlot::GetProgress() {
return progress; return progress;
} }
@@ -278,19 +277,6 @@ int64_t qDrawPlot::GetCurrentFrameIndex() {
return currentFrame; return currentFrame;
} }
int64_t qDrawPlot::GetCurrentMeasurementIndex() {
return currentMeasurement;
}
int qDrawPlot::GetNumMeasurements() {
return numMeasurements;
}
void qDrawPlot::SetNumMeasurements(int val) {
if (val >= 0)
numMeasurements = val;
}
void qDrawPlot::Select1dPlot(bool enable) { void qDrawPlot::Select1dPlot(bool enable) {
LockLastImageArray(); LockLastImageArray();
if (enable) { if (enable) {
@@ -373,14 +359,14 @@ void qDrawPlot::SetXYRangeChanged() {
void qDrawPlot::SetXYRangeValues(double val, qDefs::range xy) { void qDrawPlot::SetXYRangeValues(double val, qDefs::range xy) {
LockLastImageArray(); LockLastImageArray();
FILE_LOG(logDEBUG) << "Setting XY Range [" << static_cast<int>(xy) << "] to " << val; FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(xy) << " to " << val;
XYRange[xy] = val; XYRange[xy] = val;
UnlockLastImageArray(); UnlockLastImageArray();
} }
void qDrawPlot::IsXYRangeValues(bool changed, qDefs::range xy) { void qDrawPlot::IsXYRangeValues(bool changed, qDefs::range xy) {
LockLastImageArray(); LockLastImageArray();
FILE_LOG(logDEBUG) << "Setting XY Range Change [" << static_cast<int>(xy) << "] to " << std::boolalpha << changed << std::noboolalpha;; FILE_LOG(logDEBUG) << "Setting " << qDefs::getRangeAsString(xy) << " to " << std::boolalpha << changed << std::noboolalpha;;
isXYRange[xy] = changed; isXYRange[xy] = changed;
UnlockLastImageArray(); UnlockLastImageArray();
} }
@@ -705,27 +691,22 @@ void qDrawPlot::DetachHists() {
} }
} }
void qDrawPlot::SetStopSignal() {
FILE_LOG(logDEBUG) << "Stop Acquisition signal";
hasStopped = true;
}
void qDrawPlot::StartAcquisition() { void qDrawPlot::StartAcquisition() {
FILE_LOG(logDEBUG) << "Starting Acquisition in qDrawPlot"; FILE_LOG(logDEBUG) << "Starting Acquisition in qDrawPlot";
isRunning = true;
progress = 0; progress = 0;
currentMeasurement = -1; currentFrame = 0;
currentFrame = -1;
hasStopped = false;
boxPlot->setTitle("Old Plot"); boxPlot->setTitle("Old Plot");
// check acquiring flag (from previous exit) or if running // check acquiring flag (from previous exit) or if running
try{ try{
if (myDet->getAcquiringFlag()) { if (myDet->getAcquiringFlag()) {
if (myDet->getRunStatus() != slsDetectorDefs::IDLE) { if (myDet->getRunStatus() != slsDetectorDefs::IDLE) {
qDefs::Message(qDefs::WARNING, "Could not start acquisition as it is already in progress.\nClick start when finished.", "qDrawPlot::StartAcquisition"); qDefs::Message(qDefs::WARNING, "Could not start acquisition as it is already in progress.\nClick start when finished.", "qDrawPlot::StartAcquisition");
isRunning = false; emit AbortSignal();
emit AcquireFinishedSignal(); return;
} else {
myDet->setAcquiringFlag(false);
} }
} }
} CATCH_DISPLAY("Could not get detector stats.", "qDrawPlot::StartAcquisition"); } CATCH_DISPLAY("Could not get detector stats.", "qDrawPlot::StartAcquisition");
@@ -739,6 +720,7 @@ void qDrawPlot::StartAcquisition() {
} }
// refixing all the zooming // refixing all the zooming
XYRangeChanged = true;
/* /*
plot2d->GetPlot()->SetXMinMax(-0.5, nPixelsX + 0.5); plot2d->GetPlot()->SetXMinMax(-0.5, nPixelsX + 0.5);
plot2d->GetPlot()->SetYMinMax(-0.5, nPixelsY + 0.5); plot2d->GetPlot()->SetYMinMax(-0.5, nPixelsY + 0.5);
@@ -748,30 +730,38 @@ void qDrawPlot::StartAcquisition() {
else else
plot2d->GetPlot()->UnZoom(false); plot2d->GetPlot()->UnZoom(false);
*/ */
// acquisition in another thread, so signal it
emit AcquireSignal(); // acquisition in another thread
QFuture<std::string> future = QtConcurrent::run(this, &qDrawPlot::AcquireThread);
acqResultWatcher->setFuture(future);
FILE_LOG(logDEBUG) << "End of Starting Acquisition in qDrawPlot";
} }
void qDrawPlot::AcquireThread() { void qDrawPlot::AcquireFinished() {
try { FILE_LOG(logDEBUG) << "Acquisition Finished";
for (int i = 0; i < numMeasurements; ++i) { std::string mess = acqResultWatcher->result();
++currentMeasurement; // exception in acquire will not call acquisition finished call back, so handle it
myDet->acquire(); if (!mess.empty()) {
FILE_LOG(logINFO) << "Measurement finished [ Measurement:" << currentMeasurement << " ]" ; FILE_LOG(logERROR) << "Acquisition Finished with an exception: " << mess;
if (hasStopped) { qDefs::ExceptionMessage("Acquire unsuccessful.", mess, "qDrawPlot::AcquireFinished");
break;
}
}
} catch (const std::exception &e) {
qDefs::ExceptionMessage("Acquire unsuccessful.", e.what(), "qDrawPlot::AcquireThread");
// handle acquire exception
try{ try{
myDet->stopAcquisition(); myDet->stopAcquisition();
myDet->stopReceiver(); myDet->stopReceiver();
} CATCH_DISPLAY("Could not stop acquisition.", "qDrawPlot::AcquireThread"); } CATCH_DISPLAY("Could not stop acquisition and receiver.", "qDrawPlot::AcquireFinished");
isRunning = false; emit AbortSignal();
emit AcquireFinishedSignal();
} }
FILE_LOG(logDEBUG) << "End of Acquisition Finished";
}
std::string qDrawPlot::AcquireThread() {
FILE_LOG(logDEBUG) << "Acquire Thread";
try {
myDet->acquire();
} catch (const std::exception &e) {
return std::string(e.what());
}
return std::string("");
} }
void qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer) { void qDrawPlot::GetProgressCallBack(double currentProgress, void *this_pointer) {
@@ -798,8 +788,6 @@ void qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus)
} else { } else {
FILE_LOG(logINFO) << "Acquisition finished [ Status:" << status << ", Progress: " << currentProgress << " ]" ; FILE_LOG(logINFO) << "Acquisition finished [ Status:" << status << ", Progress: " << currentProgress << " ]" ;
} }
isRunning = false;
emit AcquireFinishedSignal(); emit AcquireFinishedSignal();
} }
@@ -808,17 +796,17 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
FILE_LOG(logDEBUG) FILE_LOG(logDEBUG)
<< "* GetData Callback *" << std::endl << "* GetData Callback *" << std::endl
<< "frame index: " << frameIndex << std::endl << " frame index: " << frameIndex << std::endl
<< "sub frame index: " << subFrameIndex << std::endl << " sub frame index: " << (((int)subFrameIndex == -1) ? (int)-1 : subFrameIndex) << std::endl
<< "Data [" << std::endl << " Data [" << std::endl
<< "\t progress: " << data->progressIndex << std::endl << " \t progress: " << data->progressIndex << std::endl
<< "\t file name: " << data->fileName << std::endl << " \t file name: " << data->fileName << std::endl
<< "\t nx: " << data->nx << std::endl << " \t nx: " << data->nx << std::endl
<< "\t ny: " << data->ny << std::endl << " \t ny: " << data->ny << std::endl
<< "\t data bytes: " << data->databytes << 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 << " \t file index: " << data->fileIndex << std::endl
<< "]"; << " ]";
progress = (int)data->progressIndex; progress = (int)data->progressIndex;
currentFrame = frameIndex; currentFrame = frameIndex;
@@ -829,17 +817,15 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
// convert data to double // convert data to double
unsigned int nPixels = nPixelsX * (is1d ? 1 : nPixelsY); unsigned int nPixels = nPixelsX * (is1d ? 1 : nPixelsY);
double* rawData = new double[nPixels]; double* rawData = new double[nPixels];
double* gainData = nullptr;
if (hasGainData) { if (hasGainData) {
gainData = new double[nPixels];
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData); toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange, gainData);
} else { } else {
toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange); toDoublePixelData(rawData, data->data, nPixels, data->databytes, data->dynamicRange);
} }
// title and frame index titles // title and frame index titles
boxPlot->setTitle(plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1)); plotTitle = plotTitlePrefix + QString(data->fileName.c_str()).section('/', -1);
QString indexTitle = QString("%1").arg(frameIndex); indexTitle = QString("%1").arg(frameIndex);
if ((int)subFrameIndex != -1) { if ((int)subFrameIndex != -1) {
indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex); indexTitle = QString("%1 %2").arg(frameIndex, subFrameIndex);
} }
@@ -863,25 +849,17 @@ void qDrawPlot::GetData(detectorData *data, uint64_t frameIndex, uint32_t subFra
} }
if (is1d) { if (is1d) {
lblFrameIndexTitle1d->setText(indexTitle); Get1dData(rawData);
Update1dPlot(rawData);
} else { } else {
plot2d->setTitle(indexTitle.toAscii().constData()); Get2dData(rawData);
if (hasGainData)
gainplot2d->setTitle(indexTitle.toAscii().constData());
Update2dPlot(rawData, gainData);
} }
if (displayStatistics) { FILE_LOG(logDEBUG) << "End of Get Data";
double min = 0, max = 0, sum = 0; UnlockLastImageArray();
GetStatistics(min, max, sum); emit UpdateSignal();
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
}
} }
void qDrawPlot::Update1dPlot(double* rawData) { void qDrawPlot::Get1dData(double* rawData) {
// persistency // persistency
if (currentPersistency < persistency) if (currentPersistency < persistency)
currentPersistency++; currentPersistency++;
@@ -918,22 +896,9 @@ void qDrawPlot::Update1dPlot(double* rawData) {
} }
} }
memcpy(datay1d[0], rawData, nPixelsX * sizeof(double)); memcpy(datay1d[0], rawData, nPixelsX * sizeof(double));
// Plot data
DetachHists();
plot1d->SetXTitle(xTitle1d.toAscii().constData());
plot1d->SetYTitle(yTitle1d.toAscii().constData());
for (unsigned int i = 0; i < nHists; ++i) {
SlsQtH1D* h = hists1d.at(i);
h->SetData(nPixelsX, datax1d, datay1d[i]);
SetStyle(h);
h->Attach(plot1d);
}
Update1dXYRange();
} }
void qDrawPlot::Update2dPlot(double* rawData, double* gainData) { void qDrawPlot::Get2dData(double* rawData) {
unsigned int nPixels = nPixelsX * nPixelsY; unsigned int nPixels = nPixelsX * nPixelsY;
// pedestal // pedestal
if (isPedestal) { if (isPedestal) {
@@ -960,8 +925,23 @@ void qDrawPlot::Update2dPlot(double* rawData, double* gainData) {
} }
} }
memcpy(data2d, rawData, nPixels * sizeof(double)); memcpy(data2d, rawData, nPixels * sizeof(double));
}
void qDrawPlot::Update1dPlot() {
// Plot data // Plot data
DetachHists();
plot1d->SetXTitle(xTitle1d.toAscii().constData());
plot1d->SetYTitle(yTitle1d.toAscii().constData());
for (unsigned int i = 0; i < nHists; ++i) {
SlsQtH1D* h = hists1d.at(i);
h->SetData(nPixelsX, datax1d, datay1d[i]);
SetStyle(h);
h->Attach(plot1d);
}
Update1dXYRange();
}
void qDrawPlot::Update2dPlot() {
plot2d->SetXTitle(xTitle2d); plot2d->SetXTitle(xTitle2d);
plot2d->SetYTitle(yTitle2d); plot2d->SetYTitle(yTitle2d);
plot2d->SetZTitle(zTitle2d); plot2d->SetZTitle(zTitle2d);
@@ -982,7 +962,7 @@ void qDrawPlot::Update2dPlot(double* rawData, double* gainData) {
void qDrawPlot::Update1dXYRange() { void qDrawPlot::Update1dXYRange() {
if (XYRangeChanged) { if (XYRangeChanged) {
if (!isXYRange[qDefs::XMIN] || !isXYRange[qDefs::XMAX]) { if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
plot1d->EnableXAutoScaling(); plot1d->EnableXAutoScaling();
} else { } else {
if (!isXYRange[qDefs::XMIN]) if (!isXYRange[qDefs::XMIN])
@@ -992,7 +972,7 @@ void qDrawPlot::Update1dXYRange() {
plot1d->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]); plot1d->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
} }
if (!isXYRange[qDefs::YMIN] || !isXYRange[qDefs::YMAX]) { if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
plot1d->EnableYAutoScaling(); plot1d->EnableYAutoScaling();
} else { } else {
if (!isXYRange[qDefs::YMIN]) if (!isXYRange[qDefs::YMIN])
@@ -1008,7 +988,7 @@ void qDrawPlot::Update1dXYRange() {
void qDrawPlot::Update2dXYRange() { void qDrawPlot::Update2dXYRange() {
if (XYRangeChanged) { if (XYRangeChanged) {
if (!isXYRange[qDefs::XMIN] || !isXYRange[qDefs::XMAX]) { if (!isXYRange[qDefs::XMIN] && !isXYRange[qDefs::XMAX]) {
plot2d->GetPlot()->EnableXAutoScaling(); plot2d->GetPlot()->EnableXAutoScaling();
} else { } else {
if (!isXYRange[qDefs::XMIN]) if (!isXYRange[qDefs::XMIN])
@@ -1018,7 +998,7 @@ void qDrawPlot::Update2dXYRange() {
plot2d->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]); plot2d->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
} }
if (!isXYRange[qDefs::YMIN] || !isXYRange[qDefs::YMAX]) { if (!isXYRange[qDefs::YMIN] && !isXYRange[qDefs::YMAX]) {
plot2d->GetPlot()->EnableYAutoScaling(); plot2d->GetPlot()->EnableYAutoScaling();
} else { } else {
if (!isXYRange[qDefs::YMIN]) if (!isXYRange[qDefs::YMIN])
@@ -1102,3 +1082,30 @@ void qDrawPlot::toDoublePixelData(double *dest, char *source, int size, int data
} }
} }
void qDrawPlot::UpdatePlot() {
LockLastImageArray();
FILE_LOG(logDEBUG) << "Update Plot";
boxPlot->setTitle(plotTitle);
if (is1d) {
lblFrameIndexTitle1d->setText(indexTitle);
Update1dPlot();
} else {
plot2d->setTitle(indexTitle.toAscii().constData());
if (hasGainData)
gainplot2d->setTitle(indexTitle.toAscii().constData());
Update2dPlot();
}
if (displayStatistics) {
double min = 0, max = 0, sum = 0;
GetStatistics(min, max, sum);
lblMinDisp->setText(QString("%1").arg(min));
lblMaxDisp->setText(QString("%1").arg(max));
lblSumDisp->setText(QString("%1").arg(sum));
}
FILE_LOG(logDEBUG) << "End of Update Plot";
UnlockLastImageArray();
}

View File

@@ -222,16 +222,9 @@ void qTabMeasurement::SetTimingMode(int val) {
} 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::GetNumMeasurements() {
FILE_LOG(logDEBUG) << "Getting number of measurements";
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
spinNumMeasurements->setValue(myPlot->GetNumMeasurements());
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
}
void qTabMeasurement::SetNumMeasurements(int val) { void qTabMeasurement::SetNumMeasurements(int val) {
FILE_LOG(logINFO) << "Setting Number of Measurements to " << val; FILE_LOG(logINFO) << "Setting Number of Measurements to " << val;
myPlot->SetNumMeasurements(val); numMeasurements = val;
} }
void qTabMeasurement::GetNumFrames() { void qTabMeasurement::GetNumFrames() {
@@ -521,18 +514,16 @@ void qTabMeasurement::SetRunIndex(int val) {
void qTabMeasurement::ResetProgress() { void qTabMeasurement::ResetProgress() {
FILE_LOG(logDEBUG) << "Resetting progress"; FILE_LOG(logDEBUG) << "Resetting progress";
lblCurrentFrame->setText(""); lblCurrentFrame->setText("0");
lblCurrentMeasurement->setText(""); lblCurrentMeasurement->setText("0");
progressBar->setValue(0); progressBar->setValue(0);
} }
void qTabMeasurement::UpdateProgress() { void qTabMeasurement::UpdateProgress() {
FILE_LOG(logDEBUG) << "Updating progress"; FILE_LOG(logDEBUG) << "Updating progress";
progressBar->setValue(myPlot->GetProgress()); progressBar->setValue(myPlot->GetProgress());
int64_t temp = myPlot->GetCurrentFrameIndex(); lblCurrentFrame->setText(QString::number(myPlot->GetCurrentFrameIndex()));
lblCurrentFrame->setText(temp >= 0 ? QString::number(temp) : ""); lblCurrentMeasurement->setText(QString::number(currentMeasurement));
temp = myPlot->GetCurrentMeasurementIndex();
lblCurrentMeasurement->setText(temp >= 0 ? QString::number(temp) : "");
} }
int qTabMeasurement::VerifyOutputDirectoryError() { int qTabMeasurement::VerifyOutputDirectoryError() {
@@ -562,7 +553,7 @@ void qTabMeasurement::StartAcquisition() {
if (qDefs::Message(qDefs::QUESTION, if (qDefs::Message(qDefs::QUESTION,
"<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>", "<nobr>Your data will not be saved.</nobr><br><nobr>Disable File write and Proceed with acquisition anyway?</nobr>",
"qTabMeasurement::StartAcquisition") == slsDetectorDefs::FAIL) { "qTabMeasurement::StartAcquisition") == slsDetectorDefs::FAIL) {
btnStart->setEnabled(true); btnStart->setEnabled(true);
return; return;
} else { } else {
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool))); disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
@@ -574,29 +565,52 @@ void qTabMeasurement::StartAcquisition() {
} }
FILE_LOG(logINFOBLUE) << "Starting Acquisition"; FILE_LOG(logINFOBLUE) << "Starting Acquisition";
lblCurrentFrame->setText(""); myPlot->SetRunning(true);
lblCurrentMeasurement->setText(""); isAcquisitionStopped = false;
currentMeasurement = 0;
ResetProgress();
Enable(0); Enable(0);
progressBar->setValue(0); progressBar->setValue(0);
progressTimer->start(100); progressTimer->start(100);
emit StartSignal(); emit EnableTabsSignal(false);
} }
void qTabMeasurement::StopAcquisition() { void qTabMeasurement::StopAcquisition() {
FILE_LOG(logINFORED) << "Stopping Acquisition"; FILE_LOG(logINFORED) << "Stopping Acquisition";
try{ try{
myPlot->SetStopSignal(); isAcquisitionStopped = true;
myDet->stopAcquisition(); myDet->stopAcquisition();
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition") } CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
} }
void qTabMeasurement::UpdateFinished() { void qTabMeasurement::AcquireFinished() {
UpdateProgress(); // to catch only once (if abort acquire also calls acq finished call back)
GetRunIndex(); if (!btnStart->isEnabled()) {
progressTimer->stop(); FILE_LOG(logDEBUG) << "Acquire Finished";
Enable(1); UpdateProgress();
btnStart->setEnabled(true); GetRunIndex();
FILE_LOG(logDEBUG) << "Measurement " << currentMeasurement << " finished";
// next measurement if acq is not stopped
if (!isAcquisitionStopped && ((currentMeasurement + 1) < numMeasurements)) {
++currentMeasurement;
myPlot->StartAcquisition();
}
// end of acquisition
else {
progressTimer->stop();
Enable(1);
myPlot->SetRunning(false);
btnStart->setEnabled(true);
emit EnableTabsSignal(true);
}
}
}
void qTabMeasurement::AbortAcquire() {
FILE_LOG(logINFORED) << "Abort Acquire";
isAcquisitionStopped = true;
AcquireFinished();
} }
void qTabMeasurement::Enable(bool enable) { void qTabMeasurement::Enable(bool enable) {
@@ -612,7 +626,6 @@ void qTabMeasurement::Refresh() {
if (!myPlot->GetIsRunning()) { if (!myPlot->GetIsRunning()) {
GetTimingMode(); GetTimingMode();
GetNumMeasurements();
GetNumFrames(); GetNumFrames();
GetExposureTime(); GetExposureTime();
GetAcquisitionPeriod(); GetAcquisitionPeriod();

View File

@@ -396,6 +396,7 @@ void qTabPlot::SetXYRange() {
myPlot->IsXYRangeValues(false, qDefs::XMIN); myPlot->IsXYRangeValues(false, qDefs::XMIN);
} else if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) { } else if (dispXMin->text().toDouble() < myPlot->GetXMinimum()) {
qDefs::Message(qDefs::WARNING, "XMin Outside Plot Range", "qTabPlot::SetXRange"); qDefs::Message(qDefs::WARNING, "XMin Outside Plot Range", "qTabPlot::SetXRange");
FILE_LOG(logWARNING) << "Xmin entered " << dispXMin->text().toDouble() << " outside xmin range " << myPlot->GetXMinimum();
dispXMin->setText(""); dispXMin->setText("");
myPlot->IsXYRangeValues(false, qDefs::XMIN); myPlot->IsXYRangeValues(false, qDefs::XMIN);
} else { } else {
@@ -407,8 +408,9 @@ void qTabPlot::SetXYRange() {
//xmax //xmax
if (!chkXMax->isChecked() || dispXMax->text().isEmpty()) { if (!chkXMax->isChecked() || dispXMax->text().isEmpty()) {
myPlot->IsXYRangeValues(false, qDefs::XMAX); myPlot->IsXYRangeValues(false, qDefs::XMAX);
} else if (dispXMax->text().toDouble() < myPlot->GetXMaximum()) { } else if (dispXMax->text().toDouble() > myPlot->GetXMaximum()) {
qDefs::Message(qDefs::WARNING, "XMax Outside Plot Range", "qTabPlot::SetXYRange"); qDefs::Message(qDefs::WARNING, "XMax Outside Plot Range", "qTabPlot::SetXYRange");
FILE_LOG(logWARNING) << "Xmax entered " << dispXMax->text().toDouble() << " outside xmax range " << myPlot->GetXMaximum();
dispXMax->setText(""); dispXMax->setText("");
myPlot->IsXYRangeValues(false, qDefs::XMAX); myPlot->IsXYRangeValues(false, qDefs::XMAX);
} else { } else {
@@ -422,6 +424,7 @@ void qTabPlot::SetXYRange() {
myPlot->IsXYRangeValues(false, qDefs::YMIN); myPlot->IsXYRangeValues(false, qDefs::YMIN);
} else if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) { } else if (dispYMin->text().toDouble() < myPlot->GetYMinimum()) {
qDefs::Message(qDefs::WARNING, "YMin Outside Plot Range", "qTabPlot::SetXYRange"); qDefs::Message(qDefs::WARNING, "YMin Outside Plot Range", "qTabPlot::SetXYRange");
FILE_LOG(logWARNING) << "Ymin entered " << dispYMin->text().toDouble() << " outside ymin range " << myPlot->GetYMinimum();
dispYMin->setText(""); dispYMin->setText("");
myPlot->IsXYRangeValues(false, qDefs::YMIN); myPlot->IsXYRangeValues(false, qDefs::YMIN);
} else { } else {
@@ -433,8 +436,9 @@ void qTabPlot::SetXYRange() {
//ymax //ymax
if (!chkYMax->isChecked() || dispYMax->text().isEmpty()) { if (!chkYMax->isChecked() || dispYMax->text().isEmpty()) {
myPlot->IsXYRangeValues(false, qDefs::YMAX); myPlot->IsXYRangeValues(false, qDefs::YMAX);
} else if (dispYMax->text().toDouble() < myPlot->GetYMaximum()) { } else if (dispYMax->text().toDouble() > myPlot->GetYMaximum()) {
qDefs::Message(qDefs::WARNING, "YMax Outside Plot Range", "qTabPlot::SetXYRange"); qDefs::Message(qDefs::WARNING, "YMax Outside Plot Range", "qTabPlot::SetXYRange");
FILE_LOG(logWARNING) << "Ymax entered " << dispYMax->text().toDouble() << " outside ymax range " << myPlot->GetYMaximum();
dispYMax->setText(""); dispYMax->setText("");
myPlot->IsXYRangeValues(false, qDefs::YMAX); myPlot->IsXYRangeValues(false, qDefs::YMAX);
} else { } else {

View File

@@ -3416,6 +3416,7 @@ void multiSlsDetector::readFrameFromReceiver() {
if (data) { if (data) {
int nCompletePixelsX = multi_shm()->numberOfChannelInclGapPixels[X]; int nCompletePixelsX = multi_shm()->numberOfChannelInclGapPixels[X];
int nCompletePixelsY = multi_shm()->numberOfChannelInclGapPixels[Y]; int nCompletePixelsY = multi_shm()->numberOfChannelInclGapPixels[Y];
setCurrentProgress(currentAcquisitionIndex + 1);
// 4bit gap pixels // 4bit gap pixels
if (dynamicRange == 4 && gappixelsenable) { if (dynamicRange == 4 && gappixelsenable) {
int n = processImageWithGapPixels(multiframe, multigappixels); int n = processImageWithGapPixels(multiframe, multigappixels);
@@ -3432,7 +3433,6 @@ void multiSlsDetector::readFrameFromReceiver() {
dataReady(thisData, currentFrameIndex, dataReady(thisData, currentFrameIndex,
((dynamicRange == 32) ? currentSubFrameIndex : -1), pCallbackArg); ((dynamicRange == 32) ? currentSubFrameIndex : -1), pCallbackArg);
delete thisData; delete thisData;
setCurrentProgress(currentAcquisitionIndex + 1);
} }
// all done // all done