trim tab works except for graph

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@51 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-09-07 08:17:16 +00:00
parent b67f3a83d8
commit a4a0237711
20 changed files with 776 additions and 303 deletions

View File

@ -31,7 +31,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="boxTrimming">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -55,6 +55,9 @@
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
<widget class="QWidget" name="gridLayoutWidget_3"> <widget class="QWidget" name="gridLayoutWidget_3">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -98,7 +101,7 @@
</spacer> </spacer>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_14"> <widget class="QLabel" name="lblExpTime">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -140,6 +143,9 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals"> <property name="decimals">
<number>5</number> <number>5</number>
</property> </property>
@ -248,29 +254,51 @@
</spacer> </spacer>
</item> </item>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_16"> <widget class="QLabel" name="lblFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Output Directory:</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="6">
<widget class="QLineEdit" name="dispOutput"/>
</item>
<item row="4" column="8">
<widget class="QPushButton" name="btnBrowseOutput">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;nobr&gt;
Trimfile to which the resulting trimbits will be written.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
An extension given by the modules serial number will be attached.
&lt;/nobr&gt;</string>
</property>
<property name="text">
<string>Output Trim File: </string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="6">
<widget class="QLineEdit" name="dispFile">
<property name="toolTip">
<string>&lt;nobr&gt;
Trimfile to which the resulting trimbits will be written.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
An extension given by the modules serial number will be attached.
&lt;/nobr&gt;</string>
</property>
</widget>
</item>
<item row="4" column="8">
<widget class="QPushButton" name="btnFile">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Trimfile to which the resulting trimbits will be written.
&lt;/nobr&gt;&lt;br&gt;&lt;nobr&gt;
An extension given by the modules serial number will be attached.
&lt;/nobr&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Browse</string> <string>Browse</string>
</property> </property>
@ -284,7 +312,7 @@
</layout> </layout>
</item> </item>
<item row="5" column="2"> <item row="5" column="2">
<widget class="QPushButton" name="btnStartTrimming"> <widget class="QPushButton" name="btnStart">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -297,12 +325,12 @@
</widget> </widget>
</item> </item>
<item row="3" column="7" colspan="2"> <item row="3" column="7" colspan="2">
<widget class="QDoubleSpinBox" name="spinExpTime_2"> <widget class="QDoubleSpinBox" name="spinThreshold">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -326,14 +354,17 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="decimals"> <property name="decimals">
<number>5</number> <number>3</number>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>0.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>2000000000.000000000000000</double> <double>10000.000000000000000</double>
</property> </property>
<property name="value"> <property name="value">
<double>560.000000000000000</double> <double>560.000000000000000</double>
@ -352,7 +383,7 @@
<string>Sets the Threshold DAC</string> <string>Sets the Threshold DAC</string>
</property> </property>
<property name="text"> <property name="text">
<string>Threshold:</string> <string>Threshold (DACu):</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -379,7 +410,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_17"> <widget class="QLabel" name="lblResolution">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -392,7 +423,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="2" colspan="2"> <item row="2" column="2" colspan="2">
<widget class="QSpinBox" name="spinNumMeasurements"> <widget class="QSpinBox" name="spinResolution">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -412,6 +443,9 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix"> <property name="suffix">
<string/> <string/>
</property> </property>
@ -419,7 +453,7 @@
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>2000000000</number> <number>9</number>
</property> </property>
<property name="value"> <property name="value">
<number>4</number> <number>4</number>
@ -453,7 +487,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="5"> <item row="2" column="5">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="lblCounts">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred"> <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -466,7 +500,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="7" colspan="2"> <item row="2" column="7" colspan="2">
<widget class="QSpinBox" name="spinNumMeasurements_2"> <widget class="QSpinBox" name="spinCounts">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -486,14 +520,17 @@
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property> </property>
<property name="keyboardTracking">
<bool>false</bool>
</property>
<property name="suffix"> <property name="suffix">
<string/> <string/>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>0</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>2000000000</number> <number>16000000</number>
</property> </property>
<property name="value"> <property name="value">
<number>500</number> <number>500</number>
@ -529,7 +566,7 @@
<number>34</number> <number>34</number>
</property> </property>
<item> <item>
<widget class="QRadioButton" name="radioButton_4"> <widget class="QRadioButton" name="radioNoPlot">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -539,10 +576,13 @@
<property name="text"> <property name="text">
<string>No Plot</string> <string>No Plot</string>
</property> </property>
<property name="checked">
<bool>true</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="radioButton_5"> <widget class="QRadioButton" name="radioDataGraph">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -555,7 +595,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QRadioButton" name="radioButton_6"> <widget class="QRadioButton" name="radioHistogram">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>

View File

@ -31,46 +31,6 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>30</x>
<y>50</y>
<width>321</width>
<height>36</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="lblModule">
<property name="text">
<string>Module Number:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -112,30 +72,23 @@
<widget class="QPushButton" name="btnDigital"> <widget class="QPushButton" name="btnDigital">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>15</x> <x>75</x>
<y>115</y> <y>115</y>
<width>291</width> <width>150</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Run</string> <string>Run</string>
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QPushButton" name="btnGetInfo">
<property name="geometry">
<rect>
<x>425</x>
<y>55</y>
<width>316</width>
<height>25</height>
</rect>
</property>
<property name="text">
<string>Get Detector Information</string>
</property>
</widget>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -177,17 +130,114 @@
<widget class="QPushButton" name="btnAnalog"> <widget class="QPushButton" name="btnAnalog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>15</x> <x>85</x>
<y>115</y> <y>115</y>
<width>291</width> <width>150</width>
<height>25</height> <height>25</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Run</string> <string>Run</string>
</property> </property>
</widget> </widget>
</widget> </widget>
<widget class="QWidget" name="horizontalLayoutWidget_3">
<property name="geometry">
<rect>
<x>45</x>
<y>30</y>
<width>291</width>
<height>36</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="lblModule_2">
<property name="text">
<string>Detector Status:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblStatus">
<property name="text">
<string>Offline</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="gridLayoutWidget">
<property name="geometry">
<rect>
<x>440</x>
<y>29</y>
<width>291</width>
<height>76</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblModule">
<property name="text">
<string>Module Number:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboModule">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<item>
<property name="text">
<string>All Modules</string>
</property>
</item>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="btnGetInfo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Get Information</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

View File

@ -10,8 +10,8 @@
/** Qt Project Class Headers */ /** Qt Project Class Headers */
class SlsQtH1D; class SlsQtH1D;
class SlsQt1DPlot; #include "SlsQt1DPlot.h"
class SlsQt2DPlotLayout; #include "SlsQt2DPlotLayout.h"
/** Qt Include Headers */ /** Qt Include Headers */
#include <QMainWindow> #include <QMainWindow>
#include <QMenu> #include <QMenu>
@ -29,6 +29,7 @@ class SlsQt2DPlotLayout;
#include <QCheckBox> #include <QCheckBox>
/** C++ Include Headers */ /** C++ Include Headers */
#include <string> #include <string>
#include <iostream>
using namespace std; using namespace std;
/** /**
@ -78,6 +79,16 @@ public:
* */ * */
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers); void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers);
/**Set the range of the 1d plot
* @param IsXYRange array of x,y,min,max if these values are set
* @param XYRangeValues array of set values of x,y, min, max
*/
void SetRange(bool IsXYRange[], double XYRangeValues[]);
/** Returns the 1d plot
*/
SlsQt1DPlot* Get1dPlot(){return cloneplot1D;};
public slots: public slots:
/** Save Plots automatically by save all clones /** Save Plots automatically by save all clones
* returns -1 if fail*/ * returns -1 if fail*/

View File

@ -26,6 +26,16 @@ public:
OK, OK,
FAIL FAIL
}; };
//-------------------------------------------------------------------------------------------------------------------------------------------------
enum MessageIndex{
WARNING,
CRITICAL,
INFORMATION,
QUESTION
};
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
/** unit of time /** unit of time
*/ */
@ -112,45 +122,34 @@ public:
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
/**displays an warning message /**displays an warning,error,info message
* @param warningMessage the message to be displayed * @param message the message to be displayed
* @param source is the tab or the source of the warning * @param source is the tab or the source of the message
* */ * */
static void WarningMessage(string warningMessage,string source) static int Message(MessageIndex index, string message,string source)
{
static QMessageBox* warningBox;
source.append(": WARNING");
warningBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(warningMessage.c_str()),QMessageBox::Ok, warningBox);
warningBox->exec();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**displays an error message
* @param errorMessage the message to be displayed
* @param source is the tab or the source of the error
* */
static void ErrorMessage(string errorMessage,string source)
{
static QMessageBox* errorBox;
source.append(": ERROR");
errorBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(errorMessage.c_str()),QMessageBox::Ok, errorBox);
errorBox->exec();
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
/**displays an information message
* @param infoMessage the message to be displayed
* @param source is the tab or the source of the information
* */
static void InfoMessage(string infoMessage,string source)
{ {
static QMessageBox* msgBox; static QMessageBox* msgBox;
switch(index){
case WARNING:
source.append(": WARNING");
msgBox= new QMessageBox(QMessageBox::Warning,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case CRITICAL:
source.append(": CRITICAL");
msgBox= new QMessageBox(QMessageBox::Critical,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
break;
case INFORMATION:
source.append(": INFORMATION"); source.append(": INFORMATION");
msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(infoMessage.c_str()),QMessageBox::Ok, msgBox); msgBox= new QMessageBox(QMessageBox::Information,source.c_str(),tr(message.c_str()),QMessageBox::Ok, msgBox);
msgBox->exec(); break;
default:
source.append(": QUESTION");
msgBox= new QMessageBox(QMessageBox::Question,source.c_str(),tr(message.c_str()),QMessageBox::Ok| QMessageBox::Cancel, msgBox);
break;
} }
if(msgBox->exec()==QMessageBox::Ok) return OK; else return FAIL;
}
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -15,8 +15,6 @@ class multiSlsDetector;
#include "SlsQt1DPlot.h" #include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h" #include "SlsQt2DPlotLayout.h"
#include "qDefs.h" #include "qDefs.h"
class SlsQt1DPlot;
class SlsQt2DPlotLayout;
class qCloneWidget; class qCloneWidget;
/** Qt Include Headers */ /** Qt Include Headers */
#include <QWidget> #include <QWidget>
@ -218,8 +216,8 @@ void UpdatePause(){data_pause_over=true;};
/** Shows the first save error message while automatic saving /** Shows the first save error message while automatic saving
* @param fileName file name of the first file that it tried to save.*/ * @param fileName file name of the first file that it tried to save.*/
void ShowSaveErrorMessage(QString fileName); void ShowSaveErrorMessage(QString fileName);
/**Shows an error message when acquisition stopped unexpectedly*/
void ShowAcquisitionErrorMessage();
private: private:
@ -405,6 +403,7 @@ void SetZRangeSignal(double,double);
void EnableZRangeSignal(bool); void EnableZRangeSignal(bool);
void SetCurrentMeasurementSignal(int); void SetCurrentMeasurementSignal(int);
void saveErrorSignal(QString); void saveErrorSignal(QString);
void AcquisitionErrorSignal();
}; };

View File

@ -12,6 +12,7 @@
#include "ui_form_tab_advanced.h" #include "ui_form_tab_advanced.h"
/** Project Class Headers */ /** Project Class Headers */
class multiSlsDetector; class multiSlsDetector;
#include "sls_detector_defs.h"
/** Qt Include Header */ /** Qt Include Header */
#include <QStackedLayout> #include <QStackedLayout>
@ -37,6 +38,7 @@ public:
void Refresh(); void Refresh();
private: private:
/** Sets up the widget /** Sets up the widget
*/ */
@ -47,14 +49,59 @@ private:
void Initialization(); void Initialization();
private slots:
/** Enable/Disable Energy and Calibration Logs
*/
void SetLogs();
/** Set acquisition time
*/
void SetExposureTime();
/** Set the Threshold dac value
*/
void SetThreshold();
/** Set output directory for trimming
*/
void SetOutputFile();
/** Browse output directory for trimming
*/
void BrowseOutputFile();
/** Enables trimming method and calls SetTrimmingMethod if enabled
* @param enable to enable trimming
*/
void EnableTrimming(bool enable);
/** Enabling resolution and Counts if this is enabled
* @param enable to enable
*/
void SetOptimize(bool enable);
/** Sets the trimming method
* @param mode trimming method
*/
void SetTrimmingMethod(int mode);
/** Ensures the right trimming mode and Executes Trimming
*/
void StartTrimming();
private:
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
/** Tool Tip for the output dir */
QString outputDirTip;
QString errOutputTip;
QPalette red;
/** Trimming mode */
slsDetectorDefs::trimMode trimmingMode;
private slots:
/** Enable/Disable Energy and Calibration Logs
*/
void SetLogs();
}; };

View File

@ -84,13 +84,13 @@ void qActionsWidget::SetMode(int mode){
if(!fName.isEmpty()){ if(!fName.isEmpty()){
//check if mode didnt get set //check if mode didnt get set
if(mode!=myDet->getActionMode(id)){ if(mode!=myDet->getActionMode(id)){
qDefs::WarningMessage("The mode could not be changed.","ActionsWidget"); qDefs::Message(qDefs::WARNING,"The mode could not be changed.","ActionsWidget");
comboScript->setCurrentIndex(myDet->getActionMode(id)); comboScript->setCurrentIndex(myDet->getActionMode(id));
}//if mode got set and its custom script }//if mode got set and its custom script
else if(mode){ else if(mode){
//when the file name did not get set correctly //when the file name did not get set correctly
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
qDefs::WarningMessage("The file path could not be set.","ActionsWidget"); qDefs::Message(qDefs::WARNING,"The file path could not be set.","ActionsWidget");
dispScript->setText(QString(myDet->getActionScript(id).c_str())); dispScript->setText(QString(myDet->getActionScript(id).c_str()));
SetScriptFile(); SetScriptFile();
} }
@ -141,12 +141,12 @@ void qActionsWidget::SetScriptFile(){
if(QFile::exists(fName)) set = true; if(QFile::exists(fName)) set = true;
//if the file doesnt exist, set it to what it was before //if the file doesnt exist, set it to what it was before
else{ else{
qDefs::WarningMessage("The script file entered does not exist","ActionsWidget"); qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ActionsWidget");
dispScript->setText(QString(myDet->getActionScript(id).c_str())); dispScript->setText(QString(myDet->getActionScript(id).c_str()));
} }
}//not a file, set it to what it was before }//not a file, set it to what it was before
else { else {
qDefs::WarningMessage("The script file path entered is not a file","ActionsWidget"); qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ActionsWidget");
dispScript->setText(QString(myDet->getActionScript(id).c_str())); dispScript->setText(QString(myDet->getActionScript(id).c_str()));
} }
} }
@ -158,7 +158,7 @@ void qActionsWidget::SetScriptFile(){
if(fName.compare(QString(myDet->getActionScript(id).c_str()))){ if(fName.compare(QString(myDet->getActionScript(id).c_str()))){
//did not get set, write what is was before //did not get set, write what is was before
if(!fName.isEmpty()) if(!fName.isEmpty())
qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ActionsWidget"); qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ActionsWidget");
dispScript->setText(QString(myDet->getActionScript(id).c_str())); dispScript->setText(QString(myDet->getActionScript(id).c_str()));
} }
} }

View File

@ -8,16 +8,13 @@
/** Qt Project Class Headers */ /** Qt Project Class Headers */
#include "qCloneWidget.h" #include "qCloneWidget.h"
#include "qDefs.h" #include "qDefs.h"
#include "SlsQt1DPlot.h"
#include "SlsQt2DPlotLayout.h"
/** Qt Include Headers */ /** Qt Include Headers */
#include <QImage> #include <QImage>
#include <QPainter> #include <QPainter>
#include <QFileDialog> #include <QFileDialog>
#include "qwt_symbol.h" #include "qwt_symbol.h"
/** C++ Include Headers */ /** C++ Include Headers */
#include <iostream>
using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -99,7 +96,7 @@ void qCloneWidget::SetupWidgetWindow(QString title,int numDim,SlsQt1DPlot*& plot
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[],bool lines,bool markers){
/** for each plot*/cout<<"qclone nhists:"<<nHists<<endl; /** for each plot*/cout<<"qclone histYAxis[0][500]:"<<histYAxis[0][500]<<endl;
for(int hist_num=0;hist_num<nHists;hist_num++){ for(int hist_num=0;hist_num<nHists;hist_num++){
/** create hists */ /** create hists */
SlsQtH1D* k; SlsQtH1D* k;
@ -134,7 +131,7 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[],bool lines,bool markers){
/** for each plot*/cout<<"qclone nhists:"<<nHists<<endl; /** for each plot*/cout<<"qclone angle nhists:"<<nHists<<endl;
for(int hist_num=0;hist_num<nHists;hist_num++){ for(int hist_num=0;hist_num<nHists;hist_num++){
/** create hists */ /** create hists */
SlsQtH1D* k; SlsQtH1D* k;
@ -162,7 +159,28 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub
k->Attach(cloneplot1D); k->Attach(cloneplot1D);
} }
//cloneplot1D->UnZoom(); //cloneplot1D->UnZoom();
}//------------------------------------------------------------------------------------------------------------------------------------------------- }
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qCloneWidget::SetRange(bool IsXYRange[],double XYRangeValues[]){
double XYCloneRangeValues[4];
if(!IsXYRange[qDefs::XMINIMUM]) XYCloneRangeValues[qDefs::XMINIMUM]= cloneplot1D->GetXMinimum();
else XYCloneRangeValues[qDefs::XMINIMUM]= XYRangeValues[qDefs::XMINIMUM];
if(!IsXYRange[qDefs::XMAXIMUM]) XYCloneRangeValues[qDefs::XMAXIMUM]= cloneplot1D->GetXMaximum();
else XYCloneRangeValues[qDefs::XMAXIMUM]= XYRangeValues[qDefs::XMAXIMUM];
if(!IsXYRange[qDefs::YMINIMUM]) XYCloneRangeValues[qDefs::YMINIMUM]= cloneplot1D->GetYMinimum();
else XYCloneRangeValues[qDefs::YMINIMUM]= XYRangeValues[qDefs::YMINIMUM];
if(!IsXYRange[qDefs::YMAXIMUM]) XYCloneRangeValues[qDefs::YMAXIMUM]= cloneplot1D->GetYMaximum();
else XYCloneRangeValues[qDefs::YMAXIMUM]= XYRangeValues[qDefs::YMAXIMUM];
cloneplot1D->SetXMinMax(XYCloneRangeValues[qDefs::XMINIMUM],XYCloneRangeValues[qDefs::XMAXIMUM]);
cloneplot1D->SetYMinMax(XYCloneRangeValues[qDefs::YMINIMUM],XYCloneRangeValues[qDefs::YMAXIMUM]);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
char* qCloneWidget::GetCurrentTimeStamp(){ char* qCloneWidget::GetCurrentTimeStamp(){
char output[30]; char output[30];
@ -198,9 +216,9 @@ void qCloneWidget::SavePlot(){
fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly); fName = QFileDialog::getSaveFileName(this,tr("Save Snapshot "),fName,tr("PNG Files (*.png);;XPM Files(*.xpm);;JPEG Files(*.jpg)"),0,QFileDialog::ShowDirsOnly);
if (!fName.isEmpty()) if (!fName.isEmpty())
if((img.save(fName))) if((img.save(fName)))
qDefs::InfoMessage("The SnapShot has been successfully saved","Snapshot"); qDefs::Message(qDefs::INFORMATION,"The SnapShot has been successfully saved","Snapshot");
else else
qDefs::WarningMessage("Attempt to save snapshot failed.\n" qDefs::Message(qDefs::WARNING,"Attempt to save snapshot failed.\n"
"Formats: .png, .jpg, .xpm.","Snapshot"); "Formats: .png, .jpg, .xpm.","Snapshot");
} }

View File

@ -184,11 +184,11 @@ void qDetectorMain::SetUpDetector(){
#endif #endif
char cIndex[10]; char cIndex[10];
sprintf(cIndex,"%d",detID); sprintf(cIndex,"%d",detID);
qDefs::ErrorMessage(string("No Detector Connected at id : ")+string(cIndex),"Main"); qDefs::Message(qDefs::CRITICAL,string("No Detector Connected at id : ")+string(cIndex),"Main");
exit(-1); exit(-1);
}//if the detector is not even connected }//if the detector is not even connected
else if(s->setTCPSocket()==slsDetectorDefs::FAIL){ else if(s->setTCPSocket()==slsDetectorDefs::FAIL){
qDefs::ErrorMessage(string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main"); qDefs::Message(qDefs::CRITICAL,string("The detector ")+host+string(" is not connected. Exiting GUI."),"Main");
cout << "The detector " << host << "is not connected. Exiting GUI." << endl; cout << "The detector " << host << "is not connected. Exiting GUI." << endl;
exit(-1); exit(-1);
} }
@ -204,7 +204,7 @@ void qDetectorMain::SetUpDetector(){
string detName = myDet->slsDetectorBase::getDetectorType(detType); string detName = myDet->slsDetectorBase::getDetectorType(detType);
string errorMess = host+string(" has unknown detector type \"")+ string errorMess = host+string(" has unknown detector type \"")+
detName+string("\". Exiting GUI."); detName+string("\". Exiting GUI.");
qDefs::ErrorMessage(errorMess,"Main"); qDefs::Message(qDefs::CRITICAL,errorMess,"Main");
exit(-1); exit(-1);
} }
setWindowTitle("SLS Detector GUI : "+ setWindowTitle("SLS Detector GUI : "+
@ -326,8 +326,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) if(myDet->retrieveDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Setup Parameters have been loaded successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been loaded successfully.","Main");
else qDefs::WarningMessage(string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionSaveSetup){ else if(action==actionSaveSetup){
@ -341,8 +341,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) if(myDet->dumpDetectorSetup(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Setup Parameters have been saved successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Setup Parameters have been saved successfully.","Main");
else qDefs::WarningMessage(string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Setup Parameters from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionMeasurementWizard){ else if(action==actionMeasurementWizard){
@ -361,8 +361,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) if(myDet->readConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Configuration Parameters have been configured successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been configured successfully.","Main");
else qDefs::WarningMessage(string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionSaveConfiguration){ else if(action==actionSaveConfiguration){
@ -376,8 +376,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL) if(myDet->writeConfigurationFile(string(fName.toAscii().constData()))!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Configuration Parameters have been saved successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Configuration Parameters have been saved successfully.","Main");
else qDefs::WarningMessage(string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Configuration Parameters from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionLoadTrimbits){ else if(action==actionLoadTrimbits){
@ -391,8 +391,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) if(myDet->loadSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Trimbits have been loaded successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Trimbits have been loaded successfully.","Main");
else qDefs::WarningMessage(string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Trimbits from file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionSaveTrimbits){ else if(action==actionSaveTrimbits){
@ -406,8 +406,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) if(myDet->saveSettingsFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Trimbits have been saved successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Main");
else qDefs::WarningMessage(string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Trimbits to file:\n")+fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionLoadCalibration){ else if(action==actionLoadCalibration){
@ -421,8 +421,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) if(myDet->loadCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Calibration Data have been loaded successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been loaded successfully.","Main");
else qDefs::WarningMessage(string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not load the Calibration data from file:\n")+ fName.toAscii().constData(),"Main");
} }
} }
else if(action==actionSaveCalibration){ else if(action==actionSaveCalibration){
@ -436,8 +436,8 @@ void qDetectorMain::ExecuteUtilities(QAction *action){
// Gets called when cancelled as well // Gets called when cancelled as well
if (!fName.isEmpty()){ if (!fName.isEmpty()){
if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL) if(myDet->saveCalibrationFile(string(fName.toAscii().constData()),-1)!=slsDetectorDefs::FAIL)
qDefs::InfoMessage("The Calibration Data have been saved successfully.","Main"); qDefs::Message(qDefs::INFORMATION,"The Calibration Data have been saved successfully.","Main");
else qDefs::WarningMessage(string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main"); else qDefs::Message(qDefs::WARNING,string("Could not save the Calibration data to file:\n")+fName.toAscii().constData(),"Main");
} }
} }
@ -455,7 +455,7 @@ void qDetectorMain::ExecuteHelp(QAction *action){
cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl; cout << "About: Common GUI for Mythen, Eiger, Gotthard and Agipd detectors" << endl;
#endif #endif
//<h1 style="font-family:verdana;">A heading</h1> //<h1 style="font-family:verdana;">A heading</h1>
qDefs::InfoMessage("<p style=\"font-family:verdana;\">SLS Detector GUI version: 1.0<br><br>" qDefs::Message(qDefs::INFORMATION,"<p style=\"font-family:verdana;\">SLS Detector GUI version: 1.0<br><br>"
"Common GUI to control the SLS Detectors: " "Common GUI to control the SLS Detectors: "
"Mythen, Eiger, Gotthard and Agipd.<br><br>" "Mythen, Eiger, Gotthard and Agipd.<br><br>"
"It can be operated in parallel with the command line interface:<br>" "It can be operated in parallel with the command line interface:<br>"

View File

@ -120,9 +120,10 @@ void qDrawPlot::SetupWidgetWindow(){
histXAxisTitle="Channel Number"; histXAxisTitle="Channel Number";
histYAxisTitle="Counts"; histYAxisTitle="Counts";
char temp_title[2000];
for(int i=0;i<MAX_1DPLOTS;i++){ for(int i=0;i<MAX_1DPLOTS;i++){
histTitle[i] = ""; histTitle[i] = "";
//char temp_title[2000];
//sprintf(temp_title,"Frame -%d",i); //sprintf(temp_title,"Frame -%d",i);
//histTitle[i] = temp_title; //histTitle[i] = temp_title;
} }
@ -177,6 +178,7 @@ void qDrawPlot::Initialization(){
connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double))); connect(this, SIGNAL(SetZRangeSignal(double,double)), plot2D, SLOT(SetZRange(double,double)));
connect(this, SIGNAL(AcquisitionErrorSignal()), this, SLOT(ShowAcquisitionErrorMessage()));
} }
@ -289,7 +291,6 @@ bool qDrawPlot::StartOrStopThread(bool start){
//start part //start part
if(start){ if(start){
if(myDet->getRunStatus()==slsDetectorDefs::IDLE) if(myDet->getRunStatus()==slsDetectorDefs::IDLE)
cout<<endl<<endl<<"IDLE"<<endl; cout<<endl<<endl<<"IDLE"<<endl;
else cout<<endl<<endl<<"ERRORRRRRR: "<<myDet->getRunStatus()<<endl; else cout<<endl<<endl<<"ERRORRRRRR: "<<myDet->getRunStatus()<<endl;
@ -624,12 +625,14 @@ int qDrawPlot::AcquisitionFinished(double currentProgress,int detectorStatus){
#endif #endif
//error //error
if((detectorStatus==slsDetectorDefs::IDLE) && (currentProgress!=100)){ if(currentProgress!=100){
cout<<"in here"<<endl; //just to be sure
stop_signal = 1;
StartStopDaqToggle(true); StartStopDaqToggle(true);
emit AcquisitionErrorSignal();
} }
//normal stop
else if(!stop_signal){ else if(!stop_signal){
cout<<"COMMENCING"<<endl;
currentMeasurement++; currentMeasurement++;
cout<<"currentMeasurement:"<<currentMeasurement<<endl; cout<<"currentMeasurement:"<<currentMeasurement<<endl;
// To start the next measurement // To start the next measurement
@ -643,10 +646,14 @@ int qDrawPlot::AcquisitionFinished(double currentProgress,int detectorStatus){
emit UpdatingPlotFinished(); emit UpdatingPlotFinished();
} }
} }
return 0; return 0;
} }
void qDrawPlot::ShowAcquisitionErrorMessage(){
int detStatus = (int)myDet->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
qDefs::Message(qDefs::WARNING,string("<nobr>The acquisiton has ended abruptly. Current Detector Status: ")+status+string(".</nobr>"),"Dock");
}
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -684,13 +691,13 @@ void qDrawPlot::UpdatePlot(){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "Entering UpdatePlot function" << endl; cout << "Entering UpdatePlot function" << endl;
#endif #endif
plot_update_timer->stop(); plot_update_timer->stop();
// only if no plot isnt enabled // only if no plot isnt enabled
if(plotEnable){ if(plotEnable){
LockLastImageArray(); LockLastImageArray();
//1-d plot stuff //1-d plot stuff
if(plot_in_scope==1){
if(lastImageNumber){ if(lastImageNumber){
if(histNBins){ if(histNBins){
Clear1DPlot(); Clear1DPlot();
@ -711,8 +718,6 @@ void qDrawPlot::UpdatePlot(){
else else
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num)); h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
} }
//h->setSymbol(*noSymbol);
//h->SetDotStyle(plotDotted);
SetStyle(h); SetStyle(h);
h->setTitle(GetHistTitle(hist_num)); h->setTitle(GetHistTitle(hist_num));
h->Attach(plot1D); h->Attach(plot1D);
@ -730,8 +735,8 @@ void qDrawPlot::UpdatePlot(){
if(saveAll) SavePlotAutomatic(); if(saveAll) SavePlotAutomatic();
} }
} }
//2-d plot stuff }//2-d plot stuff
//cout<<"npixelsx:"<<nPixelsX<< else{
if(lastImageArray){ if(lastImageArray){
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){ nPixelsX>0&&nPixelsY>0){
@ -756,15 +761,18 @@ void qDrawPlot::UpdatePlot(){
if(saveAll) SavePlotAutomatic(); if(saveAll) SavePlotAutomatic();
} }
} }
}
last_plot_number=lastImageNumber; last_plot_number=lastImageNumber;
if(plotEnable) UnlockLastImageArray(); if(plotEnable) UnlockLastImageArray();
//if acqq stopped before this line, it continues from here, shouldnt restart plotting timer
if(!stop_signal){
if(!frameFactor) if(!frameFactor)
plot_update_timer->start((int)timerValue); plot_update_timer->start((int)timerValue);
else else
plot_update_timer->start((int)PLOT_TIMER_MS); plot_update_timer->start((int)PLOT_TIMER_MS);
}
} }
@ -804,17 +812,21 @@ void qDrawPlot::ClonePlot(){
plot1D->SetYTitle(histYAxisTitle.toAscii().constData()); plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
plotLayout->addWidget(plot1D,1,1,1,1); plotLayout->addWidget(plot1D,1,1,1,1);
if(running){ if(running){
if(anglePlot)
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle);
else
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle);
// update range // update range
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum(); bool found =false;
if(!IsXYRange[qDefs::XMAXIMUM]) XYRangeValues[qDefs::XMAXIMUM]= plot1D->GetXMaximum(); for(int index=0;index<4;index++)
if(!IsXYRange[qDefs::YMINIMUM]) XYRangeValues[qDefs::YMINIMUM]= plot1D->GetYMinimum(); if(IsXYRange[index]){
if(!IsXYRange[qDefs::YMAXIMUM]) XYRangeValues[qDefs::YMAXIMUM]= plot1D->GetYMaximum(); found=true;
plot1D->SetXMinMax(XYRangeValues[qDefs::XMINIMUM],XYRangeValues[qDefs::XMAXIMUM]); break;
plot1D->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]); }
if(found) winClone[i]->SetRange(IsXYRange,XYRangeValues);
//copy data
LockLastImageArray();
if(!anglePlot)
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle,lines,markers);
else
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle,lines,markers);
UnlockLastImageArray();
} }
} }
else{ else{
@ -855,9 +867,9 @@ void qDrawPlot::SaveClones(){
} }
} }
if(success) if(success)
qDefs::InfoMessage("The Snapshots have all been saved successfully in .png.","Dock"); qDefs::Message(qDefs::INFORMATION,"The Snapshots have all been saved successfully in .png.","Dock");
else else
qDefs::WarningMessage(errMessage + string("were not saved."),"Dock"); qDefs::Message(qDefs::WARNING,errMessage + string("were not saved."),"Dock");
} }
@ -897,9 +909,9 @@ void qDrawPlot::SavePlot(){
if (!fName.isEmpty()) if (!fName.isEmpty())
if(savedImage.save(fName)) if(savedImage.save(fName))
qDefs::InfoMessage("The Image has been successfully saved","Dock"); qDefs::Message(qDefs::INFORMATION,"The Image has been successfully saved","Dock");
else else
qDefs::WarningMessage("Attempt to save image failed.\n" qDefs::Message(qDefs::WARNING,"Attempt to save image failed.\n"
"Formats: .png, .jpg, .xpm.","Dock"); "Formats: .png, .jpg, .xpm.","Dock");
} }
@ -911,7 +923,7 @@ void qDrawPlot::SaveAll(bool enable){
string msg = string("The Files will be saved as:\n")+ string msg = string("The Files will be saved as:\n")+
string(myDet->getFilePath().c_str())+string("/")+ string(myDet->getFilePath().c_str())+string("/")+
string(myDet->getFileName().c_str())+string("[title].png"); string(myDet->getFileName().c_str())+string("[title].png");
qDefs::InfoMessage(msg,"Dock"); qDefs::Message(qDefs::INFORMATION,msg,"Dock");
saveAll = enable; saveAll = enable;
} }
@ -952,7 +964,7 @@ void qDrawPlot::SavePlotAutomatic(){
void qDrawPlot::ShowSaveErrorMessage(QString fileName){ void qDrawPlot::ShowSaveErrorMessage(QString fileName){
qDefs::WarningMessage(string("Automatic Saving: Could not save the first file:\n")+ qDefs::Message(qDefs::WARNING,string("Automatic Saving: Could not save the first file:\n")+
string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock"); string(fileName.toAscii().constData()) + string("\n\nNote: Will not show future file save errors for this acquisition."),"Dock");
} }

View File

@ -277,7 +277,7 @@ void qScanWidget::EnableSizeWidgets(){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cNum[200];sprintf(cNum,"%d",actualNumSteps);
char cId[5];sprintf(cId,"%d",id); char cId[5];sprintf(cId,"%d",id);
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Specific Values</font></nobr><br><br><nobr>Number of positions added: ")+ string(": Specific Values</font></nobr><br><br><nobr>Number of positions added: ")+
string(cNum)+string("</nobr>"),"ScanWidget"); string(cNum)+string("</nobr>"),"ScanWidget");
#endif #endif
@ -385,7 +385,7 @@ int qScanWidget::SetScan(int mode){
return qDefs::OK; return qDefs::OK;
}else{//mode NOT set }else{//mode NOT set
if((mode!=actualMode)&&(actualNumSteps)){ if((mode!=actualMode)&&(actualNumSteps)){
qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget"); qDefs::Message(qDefs::WARNING,"The mode could not be changed for an unknown reason.","ScanWidget");
comboScript->setCurrentIndex(actualMode); comboScript->setCurrentIndex(actualMode);
return qDefs::FAIL; return qDefs::FAIL;
} }
@ -455,12 +455,12 @@ void qScanWidget::SetScriptFile(){
set = true; set = true;
//if the file doesnt exist, set it to what it was before //if the file doesnt exist, set it to what it was before
else{ else{
qDefs::WarningMessage("The script file entered does not exist","ScanWidget"); qDefs::Message(qDefs::WARNING,"The script file entered does not exist","ScanWidget");
dispScript->setText(QString(myDet->getScanScript(id).c_str())); dispScript->setText(QString(myDet->getScanScript(id).c_str()));
} }
}//not a file, set it to what it was before }//not a file, set it to what it was before
else { else {
qDefs::WarningMessage("The script file path entered is not a file","ScanWidget"); qDefs::Message(qDefs::WARNING,"The script file path entered is not a file","ScanWidget");
dispScript->setText(QString(myDet->getScanScript(id).c_str())); dispScript->setText(QString(myDet->getScanScript(id).c_str()));
} }
} }
@ -471,7 +471,7 @@ void qScanWidget::SetScriptFile(){
if(fName.compare(QString(myDet->getScanScript(id).c_str()))){ if(fName.compare(QString(myDet->getScanScript(id).c_str()))){
//did not get set, write what is was before //did not get set, write what is was before
if(!fName.isEmpty()) if(!fName.isEmpty())
qDefs::WarningMessage("The script file could not be set. Reverting to previous file.","ScanWidget"); qDefs::Message(qDefs::WARNING,"The script file could not be set. Reverting to previous file.","ScanWidget");
dispScript->setText(QString(myDet->getScanScript(id).c_str())); dispScript->setText(QString(myDet->getScanScript(id).c_str()));
} }
@ -524,7 +524,7 @@ void qScanWidget::SetPrecision(int value){
#endif #endif
myDet->setScanPrecision(id,value); myDet->setScanPrecision(id,value);
if(myDet->getScanPrecision(id)!=value) if(myDet->getScanPrecision(id)!=value)
qDefs::WarningMessage("The precision was not set for an unknown reason.","ScanWidget");; qDefs::Message(qDefs::WARNING,"The precision was not set for an unknown reason.","ScanWidget");;
} }
@ -633,13 +633,13 @@ void qScanWidget::SetRangeSteps(){
//positions wont be loaded if its custom script //positions wont be loaded if its custom script
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Constant Step Size</font></nobr><br><br>" string(": Constant Step Size</font></nobr><br><br>"
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget"); "<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
}else{ }else{
//error loading positions //error loading positions
if(myDet->getScanSteps(id)!=actualNumSteps){ if(myDet->getScanSteps(id)!=actualNumSteps){
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::WARNING,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Values From File</font></nobr><br><br>" string(": Values From File</font></nobr><br><br>"
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget"); "<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
/*LoadPositions(); /*LoadPositions();
@ -648,7 +648,7 @@ void qScanWidget::SetRangeSteps(){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
else{//SUCCESS else{//SUCCESS
char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cNum[200];sprintf(cNum,"%d",actualNumSteps);
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Constant Step Size</font></nobr><br><br><nobr>Number of positions added: ")+ string(": Constant Step Size</font></nobr><br><br><nobr>Number of positions added: ")+
string(cNum)+string("</nobr>"),"ScanWidget"); string(cNum)+string("</nobr>"),"ScanWidget");
} }
@ -712,13 +712,13 @@ int qScanWidget::SetCustomSteps(){
QString script = dispScript->text(); QString script = dispScript->text();
//positions wont be loaded if its custom script //positions wont be loaded if its custom script
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Values From File</font></nobr><br><br>" string(": Values From File</font></nobr><br><br>"
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget"); "<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
return qDefs::FAIL; return qDefs::FAIL;
}else{ }else{
if(myDet->getScanSteps(id)!=actualNumSteps){ if(myDet->getScanSteps(id)!=actualNumSteps){
qDefs::WarningMessage("The positions list was not set for an unknown reason.","ScanWidget"); qDefs::Message(qDefs::WARNING,"The positions list was not set for an unknown reason.","ScanWidget");
LoadPositions(); LoadPositions();
comboScript->setCurrentIndex(myDet->getScanMode(id)); comboScript->setCurrentIndex(myDet->getScanMode(id));
return qDefs::FAIL; return qDefs::FAIL;
@ -870,20 +870,20 @@ void qScanWidget::SetFileSteps(){
radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip); radioFile->setToolTip(fileTip);dispFile->setToolTip(fileTip);btnFile->setToolTip(fileTip);
//positions wont be loaded if its custom script //positions wont be loaded if its custom script
if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){ if((comboScript->currentIndex()==CustomScript)&&((script=="")||(script=="none"))){
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Values From File</font></nobr><br><br>" string(": Values From File</font></nobr><br><br>"
"<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget"); "<nobr>Positions could not be loaded as the script file path is empty.</nobr>"),"ScanWidget");
}else{ }else{
//error loading positions //error loading positions
if(myDet->getScanSteps(id)!=actualNumSteps){ if(myDet->getScanSteps(id)!=actualNumSteps){
qDefs::WarningMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::WARNING,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Values From File</font></nobr><br><br>" string(": Values From File</font></nobr><br><br>"
"<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget"); "<nobr>The positions list was not set for an unknown reason.</nobr>"),"ScanWidget");
} }
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
else{//SUCCESS else{//SUCCESS
char cNum[200];sprintf(cNum,"%d",actualNumSteps); char cNum[200];sprintf(cNum,"%d",actualNumSteps);
qDefs::InfoMessage(string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+ qDefs::Message(qDefs::INFORMATION,string("<nobr><font color=\"blue\">Scan Level ")+string(cId)+
string(": Values From File</font></nobr><br><br><nobr>Number of positions added: ")+ string(": Values From File</font></nobr><br><br><nobr>Number of positions added: ")+
string(cNum)+string("</nobr>"),"ScanWidget"); string(cNum)+string("</nobr>"),"ScanWidget");
} }

View File

@ -295,7 +295,7 @@ void qTabActions::SetPosition(){
positions[i] = comboPos->itemText(i).toDouble(); positions[i] = comboPos->itemText(i).toDouble();
//setting the list and catching error //setting the list and catching error
if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count()) if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count())
qDefs::WarningMessage("The positions list was not set for some reason.","Actions"); qDefs::Message(qDefs::WARNING,"The positions list was not set for some reason.","Actions");
emit EnableScanBox(); emit EnableScanBox();

View File

@ -9,6 +9,8 @@
/** Project Class Headers */ /** Project Class Headers */
#include "slsDetector.h" #include "slsDetector.h"
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
/** Qt Include Headers */
#include <QFileDialog>
/** C++ Include Headers */ /** C++ Include Headers */
#include<iostream> #include<iostream>
using namespace std; using namespace std;
@ -37,7 +39,20 @@ qTabAdvanced::~qTabAdvanced(){
void qTabAdvanced::SetupWidgetWindow(){ void qTabAdvanced::SetupWidgetWindow(){
//executed even for non digital, so make sure its necessary
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
if((detType==slsDetectorDefs::MYTHEN)||(detType==slsDetectorDefs::EIGER)){
outputDirTip = dispFile->toolTip();
errOutputTip = QString("<br><br><font color=\"red\"><nobr>"
"<b>Output Trim File</b> should contain both existing directory and a file name.</nobr><br>"
"<nobr>The extensions are automatically added.</nobr><br><br>"
"<nobr>Enter valid<b> Output Trim File</b> to enable <b>Start Trimming</b> button.</nobr></font>");
red = QPalette();
red.setColor(QPalette::Active,QPalette::WindowText,Qt::red);
boxTrimming->setChecked(false);
SetOptimize(false);
}
} }
@ -49,6 +64,28 @@ void qTabAdvanced::Initialization(){
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs())); connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
//exptime
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
//threshold dac
connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
//output directory
connect(dispFile, SIGNAL(editingFinished()), this, SLOT(SetOutputFile()));
connect(btnFile, SIGNAL(clicked()), this, SLOT(BrowseOutputFile()));
//enable trimming method group box
connect(boxTrimming, SIGNAL(toggled(bool)), this, SLOT(EnableTrimming(bool)));
//trimming method combo
connect(comboMethod, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTrimmingMethod(int)));
//method options
connect(chkOptimize, SIGNAL(toggled(bool)), this, SLOT(SetOptimize(bool)));
//start Trimming
connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming()));
} }
@ -73,7 +110,7 @@ void qTabAdvanced::SetLogs(){
#ifdef VERBOSE #ifdef VERBOSE
cout << "Could not set/reset Log." << endl; cout << "Could not set/reset Log." << endl;
#endif #endif
qDefs::WarningMessage("Could not set/reset Log.","Advanced"); qDefs::Message(qDefs::WARNING,"Could not set/reset Log.","Advanced");
checkedBox->setChecked(!enable); checkedBox->setChecked(!enable);
} }
@ -83,7 +120,233 @@ void qTabAdvanced::SetLogs(){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetExposureTime(){
//Get the value of timer in ns
double exptimeNS = qDefs::getNSTime((qDefs::timeUnit)comboExpUnit->currentIndex(),spinExpTime->value());
#ifdef VERBOSE
cout << "Setting Exposure Time to " << exptimeNS << " clocks" << "/" << spinExpTime->value() << qDefs::getUnitString((qDefs::timeUnit)comboExpUnit->currentIndex()) << endl;
#endif
myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,(int64_t)exptimeNS);
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetThreshold(){
#ifdef VERBOSE
cout << "Setting Threshold DACu:" << spinThreshold->value() << endl;
#endif
spinThreshold->setValue((double)myDet->setDAC((dacs_t)spinThreshold->value(),slsDetectorDefs::THRESHOLD));
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetOutputFile(){
#ifdef VERBOSE
cout << "Setting Output File for Trimming" << endl;
#endif
QString dirPath = dispFile->text().section('/',0,-2,QString::SectionIncludeLeadingSep);
cout<<"directory:"<<dirPath.toAscii().constData()<<"..."<<endl;
QString fName = dispFile->text().section('/',-1);
cout<<"file name:"<<fName.toAscii().constData()<<"..."<<endl;
//checks if directory exists and file name is not empty
if((QFile::exists(dirPath))&&(!fName.isEmpty())){
dispFile->setToolTip(outputDirTip);
lblFile->setToolTip(outputDirTip);
lblFile->setPalette(lblExpTime->palette());
lblFile->setText("Output Trim File: ");
btnStart->setEnabled(true);
//check if you're overwriting original trimsettings
QDir dir;
//gets the clean absolute path
dirPath = dir.absoluteFilePath(dirPath);
dirPath = dir.cleanPath(dirPath);
QString trimdir = QString(myDet->getSettingsFile()).section('/',0,-2,QString::SectionIncludeLeadingSep);
trimdir = dir.absoluteFilePath(trimdir);
trimdir = dir.cleanPath(trimdir);
if(!dirPath.compare(trimdir)){
int ret = qDefs::Message(qDefs::QUESTION,string("<nobr>This will possibly overwrite your original trimbits.</nobr><br>"
"<nobr>Proposed file path:") + string(dirPath.toAscii().constData())+
string("</nobr><br><nobr>Do you still want to continue?</nobr>"),"Advanced");
if(ret==qDefs::FAIL){
dispFile->setText("");
dispFile->setToolTip(outputDirTip + errOutputTip);
lblFile->setToolTip(outputDirTip + errOutputTip);
lblFile->setPalette(red);
lblFile->setText("Output Trim File:*");
btnStart->setEnabled(false);
}
}
}//if the directory doesnt exist or if file name is empty
else{
cout<<"Invalid Trimming output File"<<endl;
dispFile->setToolTip(outputDirTip + errOutputTip);
lblFile->setToolTip(outputDirTip + errOutputTip);
lblFile->setPalette(red);
lblFile->setText("Output Trim File:*");
btnStart->setEnabled(false);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::BrowseOutputFile(){
#ifdef VERBOSE
cout << "Browsing Output Dir for Trimming:" << endl;
#endif
QString fName = dispFile->text();
//dialog
fName = QFileDialog::getSaveFileName(this,
tr("Choose file to write the trimbits to"),fName,
tr("Trimbit files (*.trim noise.sn*) "));
//if empty, set the file name and it calls SetFileSteps, else ignore
if (!fName.isEmpty()){
dispFile->setText(fName);
SetOutputFile();
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::EnableTrimming(bool enable){
#ifdef VERBOSE
cout << "Enable Trimming set to:" << enable << endl;
#endif
if(enable){
//show error label if invalid output dir
SetOutputFile();
SetTrimmingMethod(comboMethod->currentIndex());
}else{
//error label shouldnt show when disabled
dispFile->setToolTip(outputDirTip);
lblFile->setToolTip(outputDirTip);
lblFile->setPalette(lblExpTime->palette());
lblFile->setText("Output Trim File: ");
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetOptimize(bool enable){
#ifdef VERBOSE
cout << "Setting Optimize to:" << enable << endl;
#endif
//trimming method is adjust to count
if(!comboMethod->currentIndex()){
lblCounts->setEnabled(true);
spinCounts->setEnabled(true);
lblResolution->setEnabled(enable);
spinResolution->setEnabled(enable);
}//trimming method is equalize to median
else{
lblCounts->setEnabled(false);
spinCounts->setEnabled(false);
lblResolution->setEnabled(true);
spinResolution->setEnabled(true);
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::SetTrimmingMethod(int mode){
#ifdef VERBOSE
cout << "Setting Trimming method to :" << mode << endl;
#endif
//make sure the right resolution/Counts is enabled
SetOptimize(chkOptimize->isChecked());
//set mode
switch(mode){
case 0: trimmingMode = slsDetectorDefs::NOISE_TRIMMING; break;
case 1: trimmingMode = slsDetectorDefs::IMPROVE_TRIMMING; break;
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::StartTrimming(){
int parameter1, parameter2;
//optimize
bool optimize = chkOptimize->isChecked();
//set the mode again and also set resolution, counts
switch(trimmingMode){
case slsDetectorDefs::NOISE_TRIMMING:
//define parameters
parameter1 = spinCounts->value();
parameter2 = spinResolution->value();
if(!optimize){
parameter2 = -1;
trimmingMode = slsDetectorDefs::FIXEDSETTINGS_TRIMMING;
#ifdef VERBOSE
cout << "Trimming Mode: FIXEDSETTINGS_TRIMMING" << endl;
#endif
}else{
#ifdef VERBOSE
cout << "Trimming Mode: NOISE_TRIMMING" << endl;
#endif
}
break;
case slsDetectorDefs::IMPROVE_TRIMMING:
#ifdef VERBOSE
cout << "Trimming Mode: IMPROVE_TRIMMING" << endl;
#endif
//define parameters
parameter1 = spinResolution->value();
parameter2 = 1;
if(!optimize) parameter2 = 0;
break;
default:
cout << "Should never come here. Start Trimming will have only 2 methods." << endl;
break;
}
#ifdef VERBOSE
#endif
//execute
int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1);
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){
//save trim file
ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1);
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1))
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
}
else
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabAdvanced::Refresh(){ void qTabAdvanced::Refresh(){
//disconnect
disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
disconnect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
disconnect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
disconnect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
disconnect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
//energy/angular logs //energy/angular logs
chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog)); chkEnergyLog->setChecked(myDet->getActionMode(slsDetectorDefs::enCalLog));
chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog)); chkAngularLog->setChecked(myDet->getActionMode(slsDetectorDefs::angCalLog));
@ -92,6 +355,29 @@ void qTabAdvanced::Refresh(){
cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl; cout << "Angular Calibration Log set to " << chkAngularLog->isChecked() << endl;
#endif #endif
//exptime
qDefs::timeUnit unit;
double time = qDefs::getCorrectTime(unit,((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))));
#ifdef VERBOSE
cout << "Getting acquisition time : " << time << qDefs::getUnitString(unit) << endl;
#endif
spinExpTime->setValue(time);
comboExpUnit->setCurrentIndex((int)unit);
//threshold
double threshold = (double)myDet->setDAC(-1,slsDetectorDefs::THRESHOLD);
#ifdef VERBOSE
cout << "Getting Threshold DACu : " << threshold << endl;
#endif
spinThreshold->setValue(threshold);
//connect
connect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(chkAngularLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
connect(comboExpUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetExposureTime()));
connect(spinThreshold, SIGNAL(valueChanged(double)), this, SLOT(SetThreshold()));
} }

View File

@ -149,7 +149,7 @@ void qTabDataOutput::SetFlatField(){
if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){ if(myDet->setFlatFieldCorrectionFile(file.toAscii().constData())<0){
string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData(); string sDir = dir.toAscii().constData(),sFile = file.toAscii().constData();
if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/} if(sDir.length()<1) {sDir = string(QDir::current().absolutePath().toAscii().constData()); /*"/home/";*/}
qDefs::WarningMessage("Invalid Flat Field file: "+sDir+"/"+sFile+ qDefs::Message(qDefs::WARNING,"Invalid Flat Field file: "+sDir+"/"+sFile+
".\nUnsetting Flat Field.","Data Output"); ".\nUnsetting Flat Field.","Data Output");
//Unsetting flat field //Unsetting flat field
@ -348,7 +348,7 @@ void qTabDataOutput::SetAngularCorrection(){
cout << "Setting angular conversion to default" << endl; cout << "Setting angular conversion to default" << endl;
#endif #endif
}else{ }else{
qDefs::WarningMessage("Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output"); qDefs::Message(qDefs::WARNING,"Angular Conversion could not be set. Please set the default file name using the command line, if you haven't already.","Data Output");
chkAngular->setChecked(false); chkAngular->setChecked(false);
} }
}else{ }else{

View File

@ -40,12 +40,18 @@ void qTabDebugging::SetupWidgetWindow(){
// Detector Type // Detector Type
detType=myDet->getDetectorsType(); detType=myDet->getDetectorsType();
//status
int detStatus = (int)myDet->getRunStatus();
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
lblStatus->setText(QString(status.c_str()).toUpper());
if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:"); if(detType==slsDetectorDefs::EIGER) lblModule->setText("Half Module Number:");
else lblModule->setText("Module Number:"); else lblModule->setText("Module Number:");
// loading combo box module numbers // loading combo box module numbers
int max = myDet->setNumberOfModules(); int max = myDet->setNumberOfModules();
/* for(int i=0;i<max;i++){ /* for(int i=0;i<max;i++){
slsDetector *s = myDet->getSlsDetector(i); slsDetector *s = myDet->getSlsDetector(i);
if(s->setTCPSocket()!=slsDetectorDefs::FAIL){ if(s->setTCPSocket()!=slsDetectorDefs::FAIL){

View File

@ -85,7 +85,7 @@ void qTabDeveloper::SetupWidgetWindow(){
break; break;
default: default:
qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer");
exit(-1); exit(-1);
break; break;
} }
@ -228,7 +228,7 @@ void qTabDeveloper::SetHighVoltage(){
int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT); int ret = myDet->setDAC(highvoltage,slsDetectorDefs::HV_POT);
//error //error
if(ret != highvoltage){ if(ret != highvoltage){
qDefs::ErrorMessage("High Voltage could not be set to this value.","Developer"); qDefs::Message(qDefs::CRITICAL,"High Voltage could not be set to this value.","Developer");
lblHV->setPalette(red); lblHV->setPalette(red);
lblHV->setText("High Voltage:*"); lblHV->setText("High Voltage:*");
QString errTip = tipHV+QString("<br><br><font color=\"red\"><nobr>High Voltage could not be set. The return value is ")+ QString errTip = tipHV+QString("<br><br><font color=\"red\"><nobr>High Voltage could not be set. The return value is ")+
@ -258,7 +258,7 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){
case 4: return slsDetectorDefs::CALIBRATION_PULSE; case 4: return slsDetectorDefs::CALIBRATION_PULSE;
case 5: return slsDetectorDefs::PREAMP; case 5: return slsDetectorDefs::PREAMP;
default: default:
qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer");
Refresh(); Refresh();
break; break;
} }
@ -280,13 +280,13 @@ slsDetectorDefs::dacIndex qTabDeveloper::getSLSIndex(int index){
case 8: return slsDetectorDefs::TEMPERATURE_ADC; case 8: return slsDetectorDefs::TEMPERATURE_ADC;
case 9:return slsDetectorDefs::TEMPERATURE_FPGA; case 9:return slsDetectorDefs::TEMPERATURE_FPGA;
default: default:
qDefs::ErrorMessage("Unknown DAC/ADC Index. Weird Error","Developer"); qDefs::Message(qDefs::CRITICAL,"Unknown DAC/ADC Index. Weird Error","Developer");
Refresh(); Refresh();
break; break;
} }
break; break;
default: default:
qDefs::ErrorMessage(string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer"); qDefs::Message(qDefs::CRITICAL,string("Unknown detector type:")+myDet->slsDetectorBase::getDetectorType(detType),"Developer");
exit(-1); exit(-1);
break; break;
} }

View File

@ -127,7 +127,7 @@ void qTabMeasurement::SetupTimingMode(){
item[(int)Trigger_Window]->setEnabled(false); item[(int)Trigger_Window]->setEnabled(false);
break; break;
default: default:
qDefs::ErrorMessage("Unknown detector type.","Measurement"); qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Measurement");
exit(-1); exit(-1);
break; break;
} }
@ -157,7 +157,7 @@ void qTabMeasurement::SetupTimingMode(){
// This should not happen -only if the server and gui has a mismatch // This should not happen -only if the server and gui has a mismatch
// on which all modes are allowed in detectors // on which all modes are allowed in detectors
else{ else{
qDefs::WarningMessage("Unknown Timing Mode detected from detector." qDefs::Message(qDefs::WARNING,"Unknown Timing Mode detected from detector."
"\n\nSetting the following defaults:\nTiming Mode \t: None\n" "\n\nSetting the following defaults:\nTiming Mode \t: None\n"
"Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement");
comboTimingMode->setCurrentIndex((int)None); comboTimingMode->setCurrentIndex((int)None);
@ -191,20 +191,20 @@ void qTabMeasurement::Initialization(int timingChange){
//Number of Frames //Number of Frames
connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int))); connect(spinNumFrames,SIGNAL(valueChanged(int)), this, SLOT(setNumFrames(int)));
//Exposure Time //Exposure Time
connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));//..myplot connect(spinExpTime,SIGNAL(valueChanged(double)), this, SLOT(setExposureTime()));
connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime())); connect(comboExpUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setExposureTime()));
//Frame Period between exposures //Frame Period between exposures
connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));//..myplot connect(spinPeriod,SIGNAL(valueChanged(double)), this, SLOT(setAcquisitionPeriod()));
connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod())); connect(comboPeriodUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setAcquisitionPeriod()));
//Number of Triggers //Number of Triggers
connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));// connect(spinNumTriggers,SIGNAL(valueChanged(int)), this, SLOT(setNumTriggers(int)));
//Delay After Trigger //Delay After Trigger
connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));// connect(spinDelay,SIGNAL(valueChanged(double)), this, SLOT(setDelay()));
connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay())); connect(comboDelayUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(setDelay()));
//Number of Gates //Number of Gates
connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));// connect(spinNumGates,SIGNAL(valueChanged(int)), this, SLOT(setNumGates(int)));
//Number of Probes //Number of Probes
connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));// connect(spinNumProbes,SIGNAL(valueChanged(int)), this, SLOT(setNumProbes(int)));
} }
@ -548,11 +548,11 @@ void qTabMeasurement::SetTimingMode(int mode){
break; break;
default: default:
//This should never happen //This should never happen
qDefs::ErrorMessage("Timing mode unknown to GUI","Measurement"); qDefs::Message(qDefs::CRITICAL,"Timing mode unknown to GUI","Measurement");
exit(-1); exit(-1);
} }
if(!success){ if(!success){
qDefs::WarningMessage("The detector timing mode could not be set.\n" qDefs::Message(qDefs::WARNING,"The detector timing mode could not be set.\n"
"Please check the external flags." "Please check the external flags."
"\n\nSetting the following defaults:\nTiming Mode \t: None\n" "\n\nSetting the following defaults:\nTiming Mode \t: None\n"
"Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement"); "Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement");

View File

@ -91,10 +91,10 @@ void qTabMessages::SaveLog() {
if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append if(outfile.open(QIODevice::WriteOnly | QIODevice::Text)){//Append
QTextStream out(&outfile); QTextStream out(&outfile);
out<<dispLog->toPlainText() << endl; out<<dispLog->toPlainText() << endl;
qDefs::InfoMessage(string("The Log has been successfully saved to " qDefs::Message(qDefs::INFORMATION,string("The Log has been successfully saved to "
"")+fName.toAscii().constData(),"Messages"); "")+fName.toAscii().constData(),"Messages");
} }
else qDefs::WarningMessage("Attempt to save log file failed.","Messages"); else qDefs::Message(qDefs::WARNING,"Attempt to save log file failed.","Messages");
} }
} }

View File

@ -226,12 +226,12 @@ void qTabPlot::Initialization(){
connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange())); connect(chkZMax, SIGNAL(toggled(bool)), this, SLOT(EnableZRange()));
connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool))); connect(this, SIGNAL(EnableZRangeSignal(bool)), myPlot, SIGNAL(EnableZRangeSignal(bool)));
connect(dispXMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispXMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
connect(dispXMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispXMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
connect(dispYMin, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispYMin, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange())); connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetAxesRange()));
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange())); connect(dispZMin, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange())); connect(dispZMax, SIGNAL(editingFinished()), this, SLOT(SetZRange()));
// Save // Save
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot())); connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool))); connect(chkSaveAll, SIGNAL(toggled(bool)), myPlot, SLOT(SaveAll(bool)));
@ -344,6 +344,10 @@ void qTabPlot::EnableRange(){
void qTabPlot::SetAxesRange(){ void qTabPlot::SetAxesRange(){
#ifdef VERBOSE
cout << "Setting Range" << endl;
#endif
bool changed = false; bool changed = false;
// x min // x min
changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty()); changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty());
@ -448,7 +452,7 @@ void qTabPlot::SetFrequency(){
// Get the time interval from gui in ms // Get the time interval from gui in ms
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6); timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6);
if(timeMS<minPlotTimer){ if(timeMS<minPlotTimer){
qDefs::WarningMessage("Interval between Plots - The Time Interval between plots " qDefs::Message(qDefs::WARNING,"Interval between Plots - The Time Interval between plots "
"must be atleast "+string(cplotms)+".","Plot"); "must be atleast "+string(cplotms)+".","Plot");
spinTimeGap->setValue(minPlotTimer); spinTimeGap->setValue(minPlotTimer);
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS); comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
@ -468,7 +472,7 @@ void qTabPlot::SetFrequency(){
// To make sure the period between plotting is not less than minimum plot timer in ms // To make sure the period between plotting is not less than minimum plot timer in ms
if(timeMS<minPlotTimer){ if(timeMS<minPlotTimer){
int minFrame = (int)(ceil)(minPlotTimer/acqPeriodMS); int minFrame = (int)(ceil)(minPlotTimer/acqPeriodMS);
qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>" qDefs::Message(qDefs::WARNING,"<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>"
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms." "Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms."
"<br><br>Nth image adjusted to minimum, " "<br><br>Nth image adjusted to minimum, "
"for the chosen Acquisition Period.","Plot"); "for the chosen Acquisition Period.","Plot");

View File

@ -12,6 +12,7 @@
#include "multiSlsDetector.h" #include "multiSlsDetector.h"
// C++ Include Headers // C++ Include Headers
#include<iostream> #include<iostream>
#include <cmath>
using namespace std; using namespace std;
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
@ -115,7 +116,7 @@ void qTabSettings::SetupDetectorSettings(){
item[(int)VeryHighGain]->setEnabled(true); item[(int)VeryHighGain]->setEnabled(true);
break; break;
default: default:
qDefs::ErrorMessage("Unknown detector type.","Settings"); qDefs::Message(qDefs::CRITICAL,"Unknown detector type.","Settings");
exit(-1); exit(-1);
break; break;
} }
@ -123,7 +124,7 @@ void qTabSettings::SetupDetectorSettings(){
// This should not happen -only if the server and gui has a mismatch // This should not happen -only if the server and gui has a mismatch
// on which all modes are allowed in detectors // on which all modes are allowed in detectors
if(!(item[(int)sett]->isEnabled())){ if(!(item[(int)sett]->isEnabled())){
qDefs::ErrorMessage("Unknown Detector Settings retrieved from detector. " qDefs::Message(qDefs::CRITICAL,"Unknown Detector Settings retrieved from detector. "
"Exiting GUI.","Settings"); "Exiting GUI.","Settings");
#ifdef VERBOSE #ifdef VERBOSE
cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl; cout << "ERROR: Unknown Detector Settings retrieved from detector." << endl;
@ -190,7 +191,7 @@ void qTabSettings::SetNumberOfModules(int index){
#endif #endif
int i = myDet->setNumberOfModules(index); int i = myDet->setNumberOfModules(index);
if(index!=i) if(index!=i)
qDefs::WarningMessage("Number of modules cannot be set for this value.","Settings"); qDefs::Message(qDefs::WARNING,"Number of modules cannot be set for this value.","Settings");
#ifdef VERBOSE #ifdef VERBOSE
cout << "ERROR: Setting number of modules to "<< i << endl; cout << "ERROR: Setting number of modules to "<< i << endl;
#endif #endif
@ -214,7 +215,7 @@ void qTabSettings::SetDynamicRange(int index){
#endif #endif
ret=myDet->setDynamicRange(dr); ret=myDet->setDynamicRange(dr);
if(ret!=dr){ if(ret!=dr){
qDefs::WarningMessage("Dynamic Range cannot be set to this value.","Settings"); qDefs::Message(qDefs::WARNING,"Dynamic Range cannot be set to this value.","Settings");
#ifdef VERBOSE #ifdef VERBOSE
cout << "ERROR: Setting dynamic range to "<< ret << endl; cout << "ERROR: Setting dynamic range to "<< ret << endl;
#endif #endif
@ -239,8 +240,8 @@ void qTabSettings::SetEnergy(){
int index = spinThreshold->value(); int index = spinThreshold->value();
myDet->setThresholdEnergy(index); myDet->setThresholdEnergy(index);
int ret = (int)myDet->getThresholdEnergy(); int ret = (int)myDet->getThresholdEnergy();
if(ret!=index){ if((ret-index)>200){
qDefs::WarningMessage("Threshold energy could not be set.","Settings"); qDefs::Message(qDefs::WARNING,"Threshold energy could not be set. The difference is greater than 200.","Settings");
disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); disconnect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));
spinThreshold->setValue(ret); spinThreshold->setValue(ret);
connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy())); connect(spinThreshold, SIGNAL(valueChanged(int)), this, SLOT(SetEnergy()));