mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 10:00:40 +02:00
fixed gettrimbits, histogram(still more),start stop,scans,not accessign shared memory duign acquisition
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@55 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
f7078c3700
commit
62b14f4199
@ -60,7 +60,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -120,7 +120,7 @@
|
|||||||
<item row="3" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -167,7 +167,7 @@
|
|||||||
<item row="3" column="3">
|
<item row="3" column="3">
|
||||||
<widget class="QComboBox" name="comboExpUnit">
|
<widget class="QComboBox" name="comboExpUnit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -339,7 +339,7 @@ An extension given by the modules serial number will be attached.
|
|||||||
<item row="3" column="7" colspan="2">
|
<item row="3" column="7" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinThreshold">
|
<widget class="QDoubleSpinBox" name="spinThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -402,7 +402,7 @@ An extension given by the modules serial number will be attached.
|
|||||||
<item row="0" column="5">
|
<item row="0" column="5">
|
||||||
<widget class="QCheckBox" name="chkOptimize">
|
<widget class="QCheckBox" name="chkOptimize">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
@ -567,6 +567,9 @@ An extension given by the modules serial number will be attached.
|
|||||||
<property name="checkable">
|
<property name="checkable">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget">
|
<widget class="QWidget" name="horizontalLayoutWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
@ -101,6 +101,12 @@ public:
|
|||||||
* @param enable enable */
|
* @param enable enable */
|
||||||
void setTriggerEnabled(bool enable){isTriggerEnabled = enable;};
|
void setTriggerEnabled(bool enable){isTriggerEnabled = enable;};
|
||||||
|
|
||||||
|
/** Updates the trimbit plot
|
||||||
|
* @param fromDetector is true if the trimbits should be loaded from detector
|
||||||
|
* @param Histogram true if histogram, else data graph
|
||||||
|
* returns ok/fail
|
||||||
|
* */
|
||||||
|
int UpdateTrimbitPlot(bool fromDetector,bool Histogram);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -110,7 +116,7 @@ public slots:
|
|||||||
@param i is 1 for 1D, else 2D plot */
|
@param i is 1 for 1D, else 2D plot */
|
||||||
void SelectPlot(int i=2);
|
void SelectPlot(int i=2);
|
||||||
/** To select 1D plot */
|
/** To select 1D plot */
|
||||||
void Select1DPlot() {SelectPlot(1);}
|
void Select1DPlot() {Clear1DPlot();SelectPlot(1);}
|
||||||
/** To select 2D plot */
|
/** To select 2D plot */
|
||||||
void Select2DPlot() {SelectPlot(2);}
|
void Select2DPlot() {SelectPlot(2);}
|
||||||
/** To clear plot */
|
/** To clear plot */
|
||||||
@ -124,7 +130,7 @@ void SaveClones();
|
|||||||
/** To Save plot */
|
/** To Save plot */
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
/** Save all plots **/
|
/** Save all plots **/
|
||||||
void SaveAll(bool enable);
|
void SaveAll(bool enable){saveAll = enable;};
|
||||||
/** Sets persistency from plot tab */
|
/** Sets persistency from plot tab */
|
||||||
void SetPersistency(int val);
|
void SetPersistency(int val);
|
||||||
/** sets style of plot to lines*/
|
/** sets style of plot to lines*/
|
||||||
@ -132,7 +138,7 @@ void SetLines(bool enable){lines = enable;};
|
|||||||
/** sets markers */
|
/** sets markers */
|
||||||
void SetMarkers(bool enable){markers = enable;};
|
void SetMarkers(bool enable){markers = enable;};
|
||||||
/** sets the scan argument to prepare the plot*/
|
/** sets the scan argument to prepare the plot*/
|
||||||
void SetScanArgument(int scanArg){scanArgument = scanArg;};
|
void SetScanArgument(int scanArg);
|
||||||
/** sets stop_signal to true */
|
/** sets stop_signal to true */
|
||||||
void StopAcquisition(){ stop_signal = true; };
|
void StopAcquisition(){ stop_signal = true; };
|
||||||
|
|
||||||
@ -140,6 +146,7 @@ void StopAcquisition(){ stop_signal = true; };
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Initializes all its members and the thread */
|
/** Initializes all its members and the thread */
|
||||||
void Initialization();
|
void Initialization();
|
||||||
@ -163,29 +170,53 @@ int UnlockLastImageArray() {return pthread_mutex_unlock(&last_image_complete
|
|||||||
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
|
int StartDaqForGui() {return StartOrStopThread(1) ? 1:0;}
|
||||||
/** Stops the acquisition */
|
/** Stops the acquisition */
|
||||||
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
int StopDaqForGui() {return StartOrStopThread(0) ? 0:1;}
|
||||||
|
|
||||||
/** Starts/stops Acquisition Thread */
|
/** Starts/stops Acquisition Thread */
|
||||||
bool StartOrStopThread(bool start);
|
bool StartOrStopThread(bool start);
|
||||||
/** Sets up measurement each time */
|
|
||||||
void SetupMeasurement();
|
/** Sets up measurement each time
|
||||||
|
* @param currentIndex file index given by detector class
|
||||||
|
* */
|
||||||
|
void SetupMeasurement(int currentIndex);
|
||||||
|
|
||||||
/** Resets the acquisition parameter like lastimagenumber */
|
/** Resets the acquisition parameter like lastimagenumber */
|
||||||
int ResetDaqForGui();
|
int ResetDaqForGui();
|
||||||
|
|
||||||
/** The function which is called when start acquisition thread is created */
|
/** The function which is called when start acquisition thread is created */
|
||||||
static void* DataStartAcquireThread(void *this_pointer);
|
static void* DataStartAcquireThread(void *this_pointer);
|
||||||
|
|
||||||
/** This is called by the detector class to copy the data it jus acquired */
|
/** This is called by the detector class to copy the data it jus acquired */
|
||||||
static int GetDataCallBack(detectorData *data, void *this_pointer);
|
static int GetDataCallBack(detectorData *data, void *this_pointer);
|
||||||
|
|
||||||
/** This is called by the GetDataCallBack function to copy the data */
|
/** This is called by the GetDataCallBack function to copy the data */
|
||||||
int GetData(detectorData *data);
|
int GetData(detectorData *data);
|
||||||
|
|
||||||
/** This is called by detector class when acquisition is finished
|
/** This is called by detector class when acquisition is finished
|
||||||
* @param currentProgress current progress of measurement
|
* @param currentProgress current progress of measurement
|
||||||
* @param detectorStatus current status of the detector
|
* @param detectorStatus current status of the detector
|
||||||
* @param this_pointer is the pointer pointing to this object
|
* @param this_pointer is the pointer pointing to this object
|
||||||
* */
|
* */
|
||||||
static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer);
|
static int GetAcquisitionFinishedCallBack(double currentProgress,int detectorStatus, void *this_pointer);
|
||||||
/** This is called by detector class when acquisition is finished
|
|
||||||
|
/** This is called by static function when acquisition is finished
|
||||||
* @param currentProgress current progress of measurement
|
* @param currentProgress current progress of measurement
|
||||||
* @param detectorStatus current status of the detector
|
* @param detectorStatus current status of the detector
|
||||||
* */
|
* */
|
||||||
int AcquisitionFinished(double currentProgress,int detectorStatus);
|
int AcquisitionFinished(double currentProgress,int detectorStatus);
|
||||||
|
|
||||||
|
/** This is called by detector class when a measurement is finished
|
||||||
|
* @param currentMeasurementIndex current measurement index
|
||||||
|
* @param fileIndex current file index
|
||||||
|
* @param this_pointer is the pointer pointing to this object
|
||||||
|
* */
|
||||||
|
static int GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer);
|
||||||
|
|
||||||
|
/** This is called by the static function when meausrement is finished
|
||||||
|
* @param currentMeasurementIndex current measurement index
|
||||||
|
* @param fileIndex current file index
|
||||||
|
* */
|
||||||
|
int MeasurementFinished(int currentMeasurementIndex, int fileIndex);
|
||||||
|
|
||||||
/** Saves all the plots. All sets saveError to true if not saved.*/
|
/** Saves all the plots. All sets saveError to true if not saved.*/
|
||||||
void SavePlotAutomatic();
|
void SavePlotAutomatic();
|
||||||
/** Sets the style of the 1d plot */
|
/** Sets the style of the 1d plot */
|
||||||
@ -199,24 +230,32 @@ void SetStyle(SlsQtH1D* h){
|
|||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** To update plot */
|
/** To update plot
|
||||||
|
* */
|
||||||
void UpdatePlot();
|
void UpdatePlot();
|
||||||
/** To stop updating plot */
|
/** To stop updating plot
|
||||||
|
* */
|
||||||
void StopUpdatePlot();
|
void StopUpdatePlot();
|
||||||
/** To start or stop acquisition
|
/** To start or stop acquisition
|
||||||
* @param start is 1 to start and 0 to stop acquisition */
|
* @param start is 1 to start and 0 to stop acquisition
|
||||||
|
* */
|
||||||
void StartDaq(bool start);
|
void StartDaq(bool start);
|
||||||
/** To set the reference to zero after closing a clone
|
/** To set the reference to zero after closing a clone
|
||||||
* @param id is the id of the clone */
|
* @param id is the id of the clone
|
||||||
|
* */
|
||||||
void CloneCloseEvent(int id);
|
void CloneCloseEvent(int id);
|
||||||
/**After a pause, the gui is allowed to collect the data
|
/**After a pause, the gui is allowed to collect the data
|
||||||
* this is called when it is over */
|
* this is called when it is over
|
||||||
|
* */
|
||||||
void UpdatePause(){data_pause_over=true;};
|
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*/
|
/**Shows an error message when acquisition stopped unexpectedly
|
||||||
void ShowAcquisitionErrorMessage();
|
* @param status is the status of the detector
|
||||||
|
* */
|
||||||
|
void ShowAcquisitionErrorMessage(QString status);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -330,10 +369,6 @@ double* histXAngleAxis;
|
|||||||
double* histYAngleAxis;
|
double* histYAngleAxis;
|
||||||
/** Current Image Values in 2D */
|
/** Current Image Values in 2D */
|
||||||
double* lastImageArray;
|
double* lastImageArray;
|
||||||
/** temporary Y Axis value in 1D */
|
|
||||||
double* yvalues[MAX_1DPLOTS];
|
|
||||||
/** temporary Image Values in 2D */
|
|
||||||
double* image_data;
|
|
||||||
|
|
||||||
/**persistency to be reached*/
|
/**persistency to be reached*/
|
||||||
int persistency;
|
int persistency;
|
||||||
@ -391,6 +426,13 @@ bool anglePlot;
|
|||||||
/** prevents err msg displaying twice when detector stopped, "transmitting" */
|
/** prevents err msg displaying twice when detector stopped, "transmitting" */
|
||||||
bool alreadyDisplayed;
|
bool alreadyDisplayed;
|
||||||
|
|
||||||
|
/**saves the file path and file name, not to access shared memory while running*/
|
||||||
|
QString filePath;
|
||||||
|
QString fileName;
|
||||||
|
|
||||||
|
/** Max Number of Clone Windows */
|
||||||
|
static const int TRIM_HISTOGRAM_XMAX = 600;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -402,7 +444,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();
|
void AcquisitionErrorSignal(QString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
/** Project Class Headers */
|
/** Project Class Headers */
|
||||||
class multiSlsDetector;
|
class multiSlsDetector;
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
/** Qt Project Class Headers */
|
||||||
|
class qDrawPlot;
|
||||||
/** Qt Include Header */
|
/** Qt Include Header */
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
|
|
||||||
@ -26,8 +28,9 @@ public:
|
|||||||
/** \short The constructor
|
/** \short The constructor
|
||||||
* @param parent is the parent tab widget
|
* @param parent is the parent tab widget
|
||||||
* @param detector is the detector returned from the detector tab
|
* @param detector is the detector returned from the detector tab
|
||||||
|
* @param plot plot object reference
|
||||||
*/
|
*/
|
||||||
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector);
|
qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot);
|
||||||
|
|
||||||
/** Destructor
|
/** Destructor
|
||||||
*/
|
*/
|
||||||
@ -90,13 +93,17 @@ private slots:
|
|||||||
*/
|
*/
|
||||||
void StartTrimming();
|
void StartTrimming();
|
||||||
|
|
||||||
/**Updates plot from shared memory
|
/** Updates the plot with trimbits from detector/shared memory
|
||||||
*/
|
*/
|
||||||
void UpdatePlot();
|
void UpdateTrimbitPlot(int id);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The sls detector object */
|
/** The sls detector object */
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
|
/** The Plot widget */
|
||||||
|
qDrawPlot *myPlot;
|
||||||
|
|
||||||
|
QButtonGroup *btnGroup;
|
||||||
|
|
||||||
/** Tool Tip for the output dir */
|
/** Tool Tip for the output dir */
|
||||||
QString outputDirTip;
|
QString outputDirTip;
|
||||||
|
@ -61,9 +61,8 @@ private:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Sets the output directory
|
/** Sets the output directory
|
||||||
* @param path output path to be set
|
|
||||||
*/
|
*/
|
||||||
void setOutputDir(const QString& path);
|
void setOutputDir();
|
||||||
|
|
||||||
/** Open dialog to choose the output directory */
|
/** Open dialog to choose the output directory */
|
||||||
void browseOutputDir();
|
void browseOutputDir();
|
||||||
|
@ -38,9 +38,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
~qTabPlot();
|
~qTabPlot();
|
||||||
|
|
||||||
/** To refresh and update widgets
|
|
||||||
*/
|
|
||||||
void Refresh();
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -111,6 +109,11 @@ void EnableNthFrame(bool enable){enableNFrame = enable;};
|
|||||||
*/
|
*/
|
||||||
void SetScanArgument();
|
void SetScanArgument();
|
||||||
|
|
||||||
|
/** To refresh and update widgets
|
||||||
|
*/
|
||||||
|
void Refresh();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
/** Selects the plot to display, enables/disables widgets
|
/** Selects the plot to display, enables/disables widgets
|
||||||
|
@ -37,6 +37,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
|
||||||
|
/** To enable expert mode
|
||||||
|
* @param enable to enable if true
|
||||||
|
*/
|
||||||
|
void SetExpertMode(bool enable){expertMode = enable;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** The sls detector object */
|
/** The sls detector object */
|
||||||
@ -45,7 +52,8 @@ private:
|
|||||||
/** detector type */
|
/** detector type */
|
||||||
slsDetectorDefs::detectorType detType;
|
slsDetectorDefs::detectorType detType;
|
||||||
|
|
||||||
|
/** expert mode */
|
||||||
|
bool expertMode;
|
||||||
|
|
||||||
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings};
|
enum{Standard,Fast,HighGain,DynamicGain,LowGain,MediumGain,VeryHighGain,Undefined,Uninitialized,NumSettings};
|
||||||
|
|
||||||
@ -89,6 +97,11 @@ void SetDynamicRange(int index);
|
|||||||
/** Set threshold energy
|
/** Set threshold energy
|
||||||
*/
|
*/
|
||||||
void SetEnergy();
|
void SetEnergy();
|
||||||
|
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/**Update Trimbits after Set Settings */
|
||||||
|
void UpdateTrimbitSignal(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void qActionsWidget::Refresh(){
|
|||||||
cout << "Updated\taction:" << id << "\t"
|
cout << "Updated\taction:" << id << "\t"
|
||||||
"mode:"<<mode<<"\t"
|
"mode:"<<mode<<"\t"
|
||||||
"script:" << script << "\t"
|
"script:" << script << "\t"
|
||||||
"parameter:" << parameter << endl << endl;
|
"parameter:" << parameter << "\t***" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ void qDetectorMain::SetUpWidgetWindow(){
|
|||||||
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
|
tab_plot = new qTabPlot (this, myDet,myPlot); cout<<"Plot ready"<<endl;
|
||||||
tab_actions = new qTabActions (this, myDet); cout<<"Actions ready"<<endl;
|
tab_actions = new qTabActions (this, myDet); cout<<"Actions ready"<<endl;
|
||||||
tab_settings = new qTabSettings (this, myDet); cout<<"Settings ready"<<endl;
|
tab_settings = new qTabSettings (this, myDet); cout<<"Settings ready"<<endl;
|
||||||
tab_advanced = new qTabAdvanced (this, myDet); cout<<"Advanced ready"<<endl;
|
tab_advanced = new qTabAdvanced (this, myDet,myPlot); cout<<"Advanced ready"<<endl;
|
||||||
tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<<endl;
|
tab_debugging = new qTabDebugging (this, myDet); cout<<"Debugging ready"<<endl;
|
||||||
tab_developer = new qTabDeveloper (this, myDet); cout<<"Developer ready"<<endl;
|
tab_developer = new qTabDeveloper (this, myDet); cout<<"Developer ready"<<endl;
|
||||||
// creating the scroll area widgets for the tabs
|
// creating the scroll area widgets for the tabs
|
||||||
@ -229,8 +229,8 @@ void qDetectorMain::Initialization(){
|
|||||||
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(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||||
|
connect(tab_measurement, SIGNAL(StartSignal()), tab_plot,SLOT(Refresh()));
|
||||||
connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
connect(tab_measurement, SIGNAL(StopSignal()), myPlot,SLOT(StopAcquisition()));
|
||||||
connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs()));
|
|
||||||
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
|
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
|
||||||
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
|
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
|
||||||
// Data Output Tab
|
// Data Output Tab
|
||||||
@ -239,10 +239,13 @@ void qDetectorMain::Initialization(){
|
|||||||
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||||
// Actions tab (also for angles)
|
// Actions tab (also for angles)
|
||||||
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
|
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
|
||||||
|
//settings to advanced tab(int=id is always 0 to only refresh)
|
||||||
|
connect(tab_settings, SIGNAL(UpdateTrimbitSignal(int)), tab_advanced,SLOT(UpdateTrimbitPlot(int)));
|
||||||
// Plotting
|
// Plotting
|
||||||
// When the acquisition is finished, must update the meas tab
|
// When the acquisition is finished, must update the meas tab
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_measurement, SLOT(UpdateFinished()));
|
||||||
|
connect(myPlot, SIGNAL(UpdatingPlotFinished()), tab_plot, SLOT(Refresh()));
|
||||||
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
|
connect(myPlot, SIGNAL(SetCurrentMeasurementSignal(int)), tab_measurement, SLOT(SetCurrentMeasurement(int)));
|
||||||
// menubar
|
// menubar
|
||||||
// Modes Menu
|
// Modes Menu
|
||||||
@ -287,8 +290,10 @@ void qDetectorMain::EnableModes(QAction *action){
|
|||||||
actionLoadCalibration->setVisible(enable);
|
actionLoadCalibration->setVisible(enable);
|
||||||
actionSaveCalibration->setVisible(enable);
|
actionSaveCalibration->setVisible(enable);
|
||||||
|
|
||||||
if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN)
|
if(digitalDetector){
|
||||||
tab_measurement->SetExpertMode(enable);
|
tab_measurement->SetExpertMode(enable);
|
||||||
|
tab_settings->SetExpertMode(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -476,7 +481,14 @@ void qDetectorMain::Refresh(int index){
|
|||||||
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
|
tabs->setCurrentIndex((index++)<(tabs->count()-1)?index:Measurement);
|
||||||
else{
|
else{
|
||||||
switch(tabs->currentIndex()){
|
switch(tabs->currentIndex()){
|
||||||
case Measurement: if(!myPlot->isRunning()) tab_measurement->Refresh(); break;
|
case Measurement:
|
||||||
|
if(!myPlot->isRunning()) {
|
||||||
|
tab_measurement->Refresh();
|
||||||
|
//to recover from a trimbit plot mode
|
||||||
|
tab_plot->Refresh();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case Settings: tab_settings->Refresh(); break;
|
case Settings: tab_settings->Refresh(); break;
|
||||||
case DataOutput: tab_dataoutput->Refresh(); break;
|
case DataOutput: tab_dataoutput->Refresh(); break;
|
||||||
case Plot: tab_plot->Refresh(); break;
|
case Plot: tab_plot->Refresh(); break;
|
||||||
@ -558,6 +570,17 @@ void qDetectorMain::EnableTabs(){
|
|||||||
tabs->setTabEnabled(Settings,enable);
|
tabs->setTabEnabled(Settings,enable);
|
||||||
tabs->setTabEnabled(Messages,enable);
|
tabs->setTabEnabled(Messages,enable);
|
||||||
|
|
||||||
|
//actions check
|
||||||
|
actionOpenSetup->setEnabled(enable);
|
||||||
|
actionSaveSetup->setEnabled(enable);
|
||||||
|
actionOpenConfiguration->setEnabled(enable);
|
||||||
|
actionSaveConfiguration->setEnabled(enable);
|
||||||
|
actionMeasurementWizard->setEnabled(enable);
|
||||||
|
actionDebug->setEnabled(enable);
|
||||||
|
actionBeamline->setEnabled(enable);
|
||||||
|
actionExpert->setEnabled(enable);
|
||||||
|
|
||||||
|
|
||||||
// special tabs
|
// special tabs
|
||||||
if(enable==false){
|
if(enable==false){
|
||||||
tabs->setTabEnabled(Debugging,enable);
|
tabs->setTabEnabled(Debugging,enable);
|
||||||
@ -589,6 +612,7 @@ void qDetectorMain::EnableTabs(){
|
|||||||
if(isDeveloper)
|
if(isDeveloper)
|
||||||
tabs->setTabEnabled(Developer,enable);
|
tabs->setTabEnabled(Developer,enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "qCloneWidget.h"
|
#include "qCloneWidget.h"
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
|
#include"fileIOStatic.h"
|
||||||
|
|
||||||
// Project Class Headers
|
// Project Class Headers
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
@ -76,7 +77,6 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
minPixelsY = 0;
|
minPixelsY = 0;
|
||||||
//2d
|
//2d
|
||||||
lastImageArray = 0;
|
lastImageArray = 0;
|
||||||
image_data = 0;
|
|
||||||
//1d
|
//1d
|
||||||
nHists = 0;
|
nHists = 0;
|
||||||
histNBins = 0;
|
histNBins = 0;
|
||||||
@ -103,7 +103,9 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
alreadyDisplayed = false;
|
alreadyDisplayed = false;
|
||||||
// This is so that it initially stop and plots
|
// This is so that it initially stop and plots
|
||||||
running = 1;
|
running = 1;
|
||||||
for(int i=0;i<MAX_1DPLOTS;i++) {histYAxis[i]=0;yvalues[i]=0; }
|
for(int i=0;i<MAX_1DPLOTS;i++)
|
||||||
|
histYAxis[i]=0;
|
||||||
|
|
||||||
|
|
||||||
// clone
|
// clone
|
||||||
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
|
for(int i=0;i<MAXCloneWindows;i++) winClone[i]=0;
|
||||||
@ -170,7 +172,9 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
noMarker = new QwtSymbol();
|
noMarker = new QwtSymbol();
|
||||||
|
|
||||||
|
|
||||||
|
//filepath and file name
|
||||||
|
filePath = QString(myDet->getFilePath().c_str());
|
||||||
|
fileName = QString(myDet->getFileName().c_str());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +190,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()));
|
connect(this, SIGNAL(AcquisitionErrorSignal(QString)), this, SLOT(ShowAcquisitionErrorMessage(QString)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -205,8 +209,6 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
|||||||
running=!running;
|
running=!running;
|
||||||
}else if(!stop_if_running){ //then start
|
}else if(!stop_if_running){ //then start
|
||||||
|
|
||||||
//number of measurements
|
|
||||||
int numMeasurements = (int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1);
|
|
||||||
// Reset Current Measurement
|
// Reset Current Measurement
|
||||||
currentMeasurement = 0;
|
currentMeasurement = 0;
|
||||||
emit SetCurrentMeasurementSignal(currentMeasurement);
|
emit SetCurrentMeasurementSignal(currentMeasurement);
|
||||||
@ -235,7 +237,7 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
|||||||
if(anglePlot) number_of_exposures = numScan0 * numScan1;
|
if(anglePlot) number_of_exposures = numScan0 * numScan1;
|
||||||
|
|
||||||
|
|
||||||
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
|
cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl;
|
||||||
|
|
||||||
// ExposureTime
|
// ExposureTime
|
||||||
exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9);
|
exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9);
|
||||||
@ -244,6 +246,8 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
|||||||
acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
|
acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
|
||||||
cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl;
|
cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl;
|
||||||
|
|
||||||
|
cout << "\tFile Index:" << myDet->getFileIndex() << endl;
|
||||||
|
|
||||||
//to take the first data if frameFactor
|
//to take the first data if frameFactor
|
||||||
numFactor = 0;
|
numFactor = 0;
|
||||||
|
|
||||||
@ -252,6 +256,10 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
|||||||
lastSavedFrame = -1;
|
lastSavedFrame = -1;
|
||||||
lastSavedMeasurement = -1;
|
lastSavedMeasurement = -1;
|
||||||
|
|
||||||
|
//update file path and file name
|
||||||
|
filePath = QString(myDet->getFilePath().c_str());
|
||||||
|
fileName = QString(myDet->getFileName().c_str());
|
||||||
|
|
||||||
|
|
||||||
StartDaq(true);
|
StartDaq(true);
|
||||||
running=!running;
|
running=!running;
|
||||||
@ -312,13 +320,15 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
if(start){
|
if(start){
|
||||||
progress = 0;
|
progress = 0;
|
||||||
//sets up the measurement parameters
|
//sets up the measurement parameters
|
||||||
SetupMeasurement();
|
SetupMeasurement(myDet->getFileIndex());
|
||||||
|
|
||||||
cout << "Starting new acquisition threadddd ...." << endl;
|
cout << "Starting new acquisition threadddd ...." << endl;
|
||||||
// Setting the callback function to get data from detector class
|
// Setting the callback function to get data from detector class
|
||||||
myDet->registerDataCallback(&(GetDataCallBack),this);
|
myDet->registerDataCallback(&(GetDataCallBack),this);
|
||||||
//Setting the callback function to alert when acquisition finished from detector class
|
//Setting the callback function to alert when acquisition finished from detector class
|
||||||
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
|
myDet->registerAcquisitionFinishedCallback(&(GetAcquisitionFinishedCallBack),this);
|
||||||
|
//Setting the callback function to alert when each measurement finished from detector class
|
||||||
|
myDet->registerMeasurementFinishedCallback(&(GetMeasurementFinishedCallBack),this);
|
||||||
// Start acquiring data from server
|
// Start acquiring data from server
|
||||||
if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits
|
if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits
|
||||||
pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this);
|
pthread_create(&gui_acquisition_thread, NULL,DataStartAcquireThread, (void*) this);
|
||||||
@ -337,69 +347,37 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SetupMeasurement(){
|
void qDrawPlot::SetScanArgument(int scanArg){
|
||||||
if(myDet->getRunStatus()==slsDetectorDefs::IDLE)
|
#ifdef VERBOSE
|
||||||
cout<<endl<<endl<<"IDLE"<<endl;
|
cout << "SetScanArgument function" << endl;
|
||||||
else cout<<endl<<endl<<"ERRORRRRRR: "<<myDet->getRunStatus()<<endl;
|
#endif
|
||||||
// Defaults
|
scanArgument = scanArg;
|
||||||
currentFrame = 0;
|
|
||||||
stop_signal = 0;
|
|
||||||
histTitle[0] = "";
|
|
||||||
|
|
||||||
//for 2d scans
|
LockLastImageArray();
|
||||||
int currentIndex = myDet->getFileIndex();
|
|
||||||
currentScanValue = 0;
|
|
||||||
currentScanDivLevel = 0;
|
|
||||||
|
|
||||||
|
nPixelsX = myDet->getTotalNumberOfChannels();
|
||||||
|
nPixelsY = 100;//if number of exposures, this should be checked before acquisition
|
||||||
|
|
||||||
if(scanArgument!=None){
|
//cannot do this in between measurements , so update instantly
|
||||||
if(scanArgument==AllFrames){
|
if(scanArgument==Level0){
|
||||||
maxPixelsY = currentIndex + number_of_exposures - 1;
|
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
||||||
minPixelsY = currentIndex;
|
int numSteps = myDet->getScanSteps(0);
|
||||||
nPixelsY = number_of_exposures;
|
double *values = new double[numSteps];
|
||||||
}else if(scanArgument==FileIndex){
|
myDet->getScanSteps(0,values);
|
||||||
maxPixelsY = currentIndex + number_of_frames - 1;
|
|
||||||
minPixelsY = currentIndex;
|
|
||||||
nPixelsY = number_of_frames;
|
|
||||||
}else if(scanArgument==Level0){
|
|
||||||
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
|
||||||
int numSteps = myDet->getScanSteps(0);
|
|
||||||
double *values = new double[numSteps];
|
|
||||||
myDet->getScanSteps(0,values);
|
|
||||||
|
|
||||||
maxPixelsY = values[numSteps-1];
|
maxPixelsY = values[numSteps-1];
|
||||||
minPixelsY = values[0];
|
minPixelsY = values[0];
|
||||||
nPixelsY = numSteps;
|
nPixelsY = numSteps;
|
||||||
currentScanValue = values[0];
|
}else if(scanArgument==Level1) {
|
||||||
}
|
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
||||||
else {
|
int numSteps = myDet->getScanSteps(1);
|
||||||
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
|
double *values = new double[numSteps];
|
||||||
int numSteps = myDet->getScanSteps(1);
|
myDet->getScanSteps(1,values);
|
||||||
double *values = new double[numSteps];
|
|
||||||
myDet->getScanSteps(1,values);
|
|
||||||
|
|
||||||
maxPixelsY = values[numSteps-1];
|
maxPixelsY = values[numSteps-1];
|
||||||
minPixelsY = values[0];
|
minPixelsY = values[0];
|
||||||
nPixelsY = numSteps;
|
nPixelsY = numSteps;
|
||||||
currentScanValue = values[0];
|
|
||||||
}
|
|
||||||
pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1);
|
|
||||||
startPixel = minPixelsY -(pixelWidth/2);
|
|
||||||
endPixel = maxPixelsY + (pixelWidth/2);
|
|
||||||
}else{//no scan
|
|
||||||
nPixelsY = 100;//number_of_exposures;
|
|
||||||
maxPixelsY = 100;
|
|
||||||
minPixelsY = 0;
|
|
||||||
startPixel = -0.5;
|
|
||||||
endPixel = nPixelsY-0.5;
|
|
||||||
}
|
}
|
||||||
cout<<"nPixelsY:"<<nPixelsY<<endl;
|
|
||||||
cout<<"minPixelsY:"<<minPixelsY<<endl;
|
|
||||||
cout<<"maxPixelsY:"<<maxPixelsY<<endl;
|
|
||||||
cout<<"startPixel:"<<startPixel<<endl;
|
|
||||||
cout<<"endPixel:"<<endPixel<<endl;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//1d
|
//1d
|
||||||
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
||||||
@ -408,20 +386,87 @@ void qDrawPlot::SetupMeasurement(){
|
|||||||
//2d
|
//2d
|
||||||
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
||||||
|
|
||||||
//sorta useless
|
//initializing 1d x axis
|
||||||
if(yvalues[0]) delete [] yvalues[0]; yvalues[0] = new double [nPixelsX];
|
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;/*+10;*/
|
||||||
if(image_data) delete [] image_data; image_data = new double[nPixelsY*nPixelsX];
|
|
||||||
|
|
||||||
//initializing 1d xaxis
|
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;/*+10;*/
|
|
||||||
|
|
||||||
histYAxis[0][4] = 190.56;
|
|
||||||
|
|
||||||
//initializing 2d array
|
//initializing 2d array
|
||||||
for(int py=0;py<nPixelsY;py++)
|
for(int py=0;py<(int)nPixelsY;py++)
|
||||||
for(int px=0;px<nPixelsX;px++)
|
for(int px=0;px<(int)nPixelsX;px++)
|
||||||
lastImageArray[py*nPixelsX+px] = 0;
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
UnlockLastImageArray();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qDrawPlot::SetupMeasurement(int currentIndex){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "SetupMeasurement function" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
LockLastImageArray();
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
if(!running)
|
||||||
|
stop_signal = 0;
|
||||||
|
currentFrame = 0;
|
||||||
|
//for 2d scans
|
||||||
|
currentScanDivLevel = 0;
|
||||||
|
lastImageNumber = 0;
|
||||||
|
|
||||||
|
//initializing 2d array
|
||||||
|
for(int py=0;py<(int)nPixelsY;py++)
|
||||||
|
for(int px=0;px<(int)nPixelsX;px++)
|
||||||
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
|
||||||
|
|
||||||
|
//no scan
|
||||||
|
if(scanArgument==None){
|
||||||
|
if(!running){
|
||||||
|
maxPixelsY = 100;
|
||||||
|
minPixelsY = 0;
|
||||||
|
startPixel = -0.5;
|
||||||
|
endPixel = nPixelsY-0.5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {//all frames
|
||||||
|
if(scanArgument==AllFrames){
|
||||||
|
maxPixelsY = currentIndex + number_of_exposures - 1;
|
||||||
|
minPixelsY = currentIndex;
|
||||||
|
if(!running) nPixelsY = number_of_exposures;
|
||||||
|
}//file index
|
||||||
|
else if(scanArgument==FileIndex){
|
||||||
|
maxPixelsY = currentIndex + number_of_frames - 1;
|
||||||
|
minPixelsY = currentIndex;
|
||||||
|
if(!running) nPixelsY = number_of_frames;
|
||||||
|
}//level0 or level1
|
||||||
|
else currentScanValue = minPixelsY;
|
||||||
|
|
||||||
|
//cannot divide by 0
|
||||||
|
if(nPixelsY==1){
|
||||||
|
pixelWidth = 0;
|
||||||
|
startPixel = minPixelsY-0.5;
|
||||||
|
endPixel = minPixelsY+0.5;
|
||||||
|
}else{
|
||||||
|
pixelWidth = (maxPixelsY -minPixelsY)/(nPixelsY-1);
|
||||||
|
startPixel = minPixelsY -(pixelWidth/2);
|
||||||
|
endPixel = maxPixelsY + (pixelWidth/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cout<<"\nnPixelsY:"<<nPixelsY<<endl;
|
||||||
|
cout<<"minPixelsY:"<<minPixelsY;
|
||||||
|
cout<<"\tmaxPixelsY:"<<maxPixelsY<<endl;
|
||||||
|
cout<<"startPixel:"<<startPixel;
|
||||||
|
cout<<"\tendPixel:"<<endPixel<<endl<<endl;
|
||||||
|
|
||||||
|
UnlockLastImageArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -452,15 +497,15 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Entering GetDatafunction" << endl;
|
cout << "Entering GetDatafunction" << endl;
|
||||||
#endif
|
#endif
|
||||||
cout<<"progress:"<<(int)data->progressIndex<<endl;
|
|
||||||
if(!stop_signal){
|
if(!stop_signal){
|
||||||
|
|
||||||
//set title
|
//set title
|
||||||
SetPlotTitle(QString(data->fileName).section('/',-1));
|
SetPlotTitle(QString(data->fileName).section('/',-1));
|
||||||
//set progress
|
//set progress
|
||||||
progress=(int)data->progressIndex;
|
progress=(int)data->progressIndex;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "progress:" << progress << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
//Plot Disabled
|
//Plot Disabled
|
||||||
if(!plotEnable) return 0;
|
if(!plotEnable) return 0;
|
||||||
@ -522,7 +567,7 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
//title
|
//title
|
||||||
char temp_title[2000];
|
char temp_title[2000];
|
||||||
sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName)));
|
sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName)));
|
||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
//copy data
|
//copy data
|
||||||
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
|
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
|
||||||
@ -536,7 +581,7 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
if(scanArgument==FileIndex){
|
if(scanArgument==FileIndex){
|
||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
//variables
|
//variables
|
||||||
int currentIndex = myDet->getFileIndexFromFileName(string(data->fileName));
|
int currentIndex = fileIOStatic::getFileIndexFromFileName(string(data->fileName));
|
||||||
if(currentIndex == minPixelsY) currentScanDivLevel = 0;
|
if(currentIndex == minPixelsY) currentScanDivLevel = 0;
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
//title
|
//title
|
||||||
@ -556,8 +601,10 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
//get scanvariable0
|
//get scanvariable0
|
||||||
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||||
myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
||||||
int currentScanVariable0 = (int)cs0;
|
int currentScanVariable0 = (int)cs0;
|
||||||
|
cout<<"currentScanValue:"<<currentScanValue<<endl;
|
||||||
|
cout<<"currentScanVariable0:"<<currentScanVariable0<<endl;
|
||||||
//variables
|
//variables
|
||||||
if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
|
if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
|
||||||
currentScanValue = currentScanVariable0;
|
currentScanValue = currentScanVariable0;
|
||||||
@ -577,7 +624,7 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
//get scanvariable1
|
//get scanvariable1
|
||||||
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||||
myDet->getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
||||||
int currentScanVariable1 = (int)cs1;
|
int currentScanVariable1 = (int)cs1;
|
||||||
//variables
|
//variables
|
||||||
if(currentScanVariable1!=currentScanValue) currentScanDivLevel++;
|
if(currentScanVariable1!=currentScanValue) currentScanDivLevel++;
|
||||||
@ -618,14 +665,13 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
//2d
|
//2d
|
||||||
else{
|
else{
|
||||||
// Titles
|
// Titles
|
||||||
sprintf(temp_title,"Image Index %d",myDet->getFileIndexFromFileName(string(data->fileName)));
|
sprintf(temp_title,"Image Index %d",fileIOStatic::getFileIndexFromFileName(string(data->fileName)));
|
||||||
imageTitle = temp_title;
|
imageTitle = temp_title;
|
||||||
// manufacture data for now
|
// manufacture data for now
|
||||||
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++)
|
||||||
image_data[py*nPixelsX+px] = sqrt(pow(currentFrame+1,2)*pow(double(px)-nPixelsX/2,2)/pow(nPixelsX/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-nPixelsY/2,2)/pow(nPixelsY/2,2))/sqrt(2);
|
lastImageArray[py*nPixelsX+px] = sqrt(pow(currentFrame+1,2)*pow(double(px)-nPixelsX/2,2)/pow(nPixelsX/2,2)/pow(number_of_exposures+1,2) + pow(double(py)-nPixelsY/2,2)/pow(nPixelsY/2,2))/sqrt(2);
|
||||||
// copy data
|
// copy data
|
||||||
memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double));
|
|
||||||
//SHOULD BE memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));
|
//SHOULD BE memcpy(lastImageArray,data->values,nPixelsX*nPixelsY*sizeof(double));
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||||
@ -653,38 +699,30 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto
|
|||||||
|
|
||||||
|
|
||||||
int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
||||||
|
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Entering Acquisition Finished with status " <<
|
cout << "\nEntering Acquisition Finished with status " << status.toAscii().constData() << " and progress " << currentProgress << endl;
|
||||||
slsDetectorBase::runStatusType((slsDetectorDefs::runStatus(detectorStatus))) << " and progress " << currentProgress << endl;
|
|
||||||
#endif
|
#endif
|
||||||
//error or stopped
|
//error or stopped
|
||||||
if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){
|
if((stop_signal)||(detectorStatus==slsDetectorDefs::ERROR)){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Error in Acquisition" << endl;
|
cout << "Error in Acquisition" << endl << endl;
|
||||||
#endif
|
#endif
|
||||||
//just to be sure
|
//stop_signal = 1;//just to be sure
|
||||||
stop_signal = 1;
|
emit AcquisitionErrorSignal(status);
|
||||||
StartStopDaqToggle(true);
|
|
||||||
emit AcquisitionErrorSignal();
|
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
//all measurements are over
|
//all measurements are over
|
||||||
if(currentProgress==100){
|
else if(currentProgress==100){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Acquisition Finished" << endl;
|
cout << "Acquisition Finished" << endl << endl;
|
||||||
#endif
|
#endif
|
||||||
StartStopDaqToggle(true);
|
|
||||||
emit UpdatingPlotFinished();
|
|
||||||
}
|
|
||||||
else{//next measurement
|
|
||||||
currentMeasurement++;
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "currentMeasurement:" << currentMeasurement << endl;
|
|
||||||
#endif
|
|
||||||
emit SetCurrentMeasurementSignal(currentMeasurement);
|
|
||||||
SetupMeasurement();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StartStopDaqToggle(true);
|
||||||
|
//this lets the measurement tab know its over, and to enable tabs
|
||||||
|
emit UpdatingPlotFinished();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,12 +730,12 @@ int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::ShowAcquisitionErrorMessage(){
|
void qDrawPlot::ShowAcquisitionErrorMessage(QString status){
|
||||||
if(!alreadyDisplayed){
|
if(!alreadyDisplayed){
|
||||||
alreadyDisplayed = true;
|
alreadyDisplayed = true;
|
||||||
int detStatus = (int)myDet->getRunStatus();
|
qDefs::Message(qDefs::WARNING,string("<nobr>The acquisiton has ended abruptly. "
|
||||||
string status = slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detStatus));
|
"Current Detector Status: ")+status.toAscii().constData()+
|
||||||
qDefs::Message(qDefs::WARNING,string("<nobr>The acquisiton has ended abruptly. Current Detector Status: ")+status+string(".</nobr>"),"Dock");
|
string(".</nobr>"),"Dock");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,8 +743,38 @@ void qDrawPlot::ShowAcquisitionErrorMessage(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int fileIndex, void *this_pointer){
|
||||||
|
((qDrawPlot*)this_pointer)->MeasurementFinished(currentMeasurementIndex, fileIndex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl;
|
||||||
|
#endif
|
||||||
|
//to make sure it plots the last frame before setting lastimagearray all to 0
|
||||||
|
if(plot_in_scope==2) usleep(500000);
|
||||||
|
|
||||||
|
currentMeasurement = currentMeasurementIndex + 1;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "currentMeasurement:" << currentMeasurement << endl;
|
||||||
|
#endif
|
||||||
|
emit SetCurrentMeasurementSignal(currentMeasurement);
|
||||||
|
SetupMeasurement(fileIndex);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
|
void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
|
||||||
if(i==1){
|
if(i==1){
|
||||||
|
Clear1DPlot();
|
||||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||||
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
|
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
|
||||||
plot1D->show();
|
plot1D->show();
|
||||||
@ -724,13 +792,16 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::Clear1DPlot(){
|
void qDrawPlot::Clear1DPlot(){
|
||||||
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();
|
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin();
|
||||||
h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot
|
h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -813,6 +884,7 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
|
|
||||||
if(plotEnable) UnlockLastImageArray();
|
if(plotEnable) UnlockLastImageArray();
|
||||||
|
|
||||||
|
|
||||||
//if acqq stopped before this line, it continues from here, shouldnt restart plotting timer
|
//if acqq stopped before this line, it continues from here, shouldnt restart plotting timer
|
||||||
if(!stop_signal){
|
if(!stop_signal){
|
||||||
if(!frameFactor)
|
if(!frameFactor)
|
||||||
@ -823,8 +895,10 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::StopUpdatePlot(){
|
void qDrawPlot::StopUpdatePlot(){
|
||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Entering StopUpdatePlot()" << endl;
|
cout << "Entering StopUpdatePlot()" << endl;
|
||||||
@ -832,8 +906,10 @@ void qDrawPlot::StopUpdatePlot(){
|
|||||||
plot_update_timer->stop();
|
plot_update_timer->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::ClonePlot(){
|
void qDrawPlot::ClonePlot(){
|
||||||
int i=0;
|
int i=0;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@ -850,8 +926,16 @@ void qDrawPlot::ClonePlot(){
|
|||||||
// save height to keep maintain same height of plot
|
// save height to keep maintain same height of plot
|
||||||
int preheight = height();
|
int preheight = height();
|
||||||
|
|
||||||
|
string sFilePath;
|
||||||
|
if(running) sFilePath = filePath.toAscii().constData();
|
||||||
|
else sFilePath = myDet->getFilePath();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LockLastImageArray();
|
||||||
|
|
||||||
// create clone
|
// create clone
|
||||||
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,myDet->getFilePath());
|
winClone[i] = new qCloneWidget(this,i,boxPlot->title(),(int)plot_in_scope,plot1D,plot2D,sFilePath);
|
||||||
if(plot_in_scope==1){
|
if(plot_in_scope==1){
|
||||||
plot1D = new SlsQt1DPlot(boxPlot);
|
plot1D = new SlsQt1DPlot(boxPlot);
|
||||||
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
plot1D->setFont(QFont("Sans Serif",9,QFont::Normal));
|
||||||
@ -885,6 +969,10 @@ void qDrawPlot::ClonePlot(){
|
|||||||
plot2D->SetZTitle(imageZAxisTitle);
|
plot2D->SetZTitle(imageZAxisTitle);
|
||||||
plotLayout->addWidget(plot2D,1,1,1,1);
|
plotLayout->addWidget(plot2D,1,1,1,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UnlockLastImageArray();
|
||||||
|
|
||||||
|
|
||||||
setMinimumHeight(preheight);
|
setMinimumHeight(preheight);
|
||||||
resize(width(),preheight);
|
resize(width(),preheight);
|
||||||
|
|
||||||
@ -899,8 +987,10 @@ void qDrawPlot::ClonePlot(){
|
|||||||
connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int)));
|
connect(winClone[i], SIGNAL(CloneClosedSignal(int)),this, SLOT(CloneCloseEvent(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SaveClones(){
|
void qDrawPlot::SaveClones(){
|
||||||
char errID[200];
|
char errID[200];
|
||||||
string errMessage= "The Snapshots with ID's: ";
|
string errMessage= "The Snapshots with ID's: ";
|
||||||
@ -922,6 +1012,7 @@ void qDrawPlot::SaveClones(){
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::CloseClones(){
|
void qDrawPlot::CloseClones(){
|
||||||
for(int i=0;i<MAXCloneWindows;i++)
|
for(int i=0;i<MAXCloneWindows;i++)
|
||||||
if(winClone[i])
|
if(winClone[i])
|
||||||
@ -929,8 +1020,10 @@ void qDrawPlot::CloseClones(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::CloneCloseEvent(int id){
|
void qDrawPlot::CloneCloseEvent(int id){
|
||||||
winClone[id]=0;
|
winClone[id]=0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -938,15 +1031,20 @@ void qDrawPlot::CloneCloseEvent(int id){
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SavePlot(){
|
void qDrawPlot::SavePlot(){
|
||||||
// render image
|
// render image
|
||||||
QImage savedImage(size().width(),size().height(),QImage::Format_RGB32);
|
QImage savedImage(size().width(),size().height(),QImage::Format_RGB32);
|
||||||
QPainter painter(&savedImage);
|
QPainter painter(&savedImage);
|
||||||
render(&painter);
|
render(&painter);
|
||||||
|
|
||||||
QString fName = QString(myDet->getFilePath().c_str());
|
QString fName;
|
||||||
|
if(running) fName = filePath;
|
||||||
|
else fName = QString(myDet->getFilePath().c_str());
|
||||||
|
|
||||||
if(boxPlot->title().contains('.')){
|
if(boxPlot->title().contains('.')){
|
||||||
fName.append(QString('/')+boxPlot->title());
|
fName.append(QString('/')+boxPlot->title());
|
||||||
fName.replace(".dat",".png");
|
fName.replace(".dat",".png");
|
||||||
@ -965,6 +1063,7 @@ void qDrawPlot::SavePlot(){
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
void qDrawPlot::SaveAll(bool enable){
|
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")+
|
||||||
@ -973,19 +1072,27 @@ void qDrawPlot::SaveAll(bool enable){
|
|||||||
qDefs::Message(qDefs::INFORMATION,msg,"Dock");
|
qDefs::Message(qDefs::INFORMATION,msg,"Dock");
|
||||||
saveAll = enable;
|
saveAll = enable;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SavePlotAutomatic(){
|
void qDrawPlot::SavePlotAutomatic(){
|
||||||
//no need to save the same plot many times
|
//no need to save the same plot many times
|
||||||
if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){
|
if((currentFrame>lastSavedFrame)&&(currentMeasurement>=lastSavedMeasurement)){
|
||||||
|
|
||||||
|
QString qFilePath;
|
||||||
|
if(running) qFilePath = filePath;
|
||||||
|
else qFilePath = QString(myDet->getFilePath().c_str());
|
||||||
|
|
||||||
|
|
||||||
lastSavedFrame = currentFrame;
|
lastSavedFrame = currentFrame;
|
||||||
lastSavedMeasurement = currentMeasurement;
|
lastSavedMeasurement = currentMeasurement;
|
||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID,"%d",lastSavedFrame);
|
sprintf(cID,"%d",lastSavedFrame);
|
||||||
//title
|
//title
|
||||||
QString fName = QString(myDet->getFilePath().c_str());
|
QString fName = qFilePath;
|
||||||
if(boxPlot->title().contains('.')){
|
if(boxPlot->title().contains('.')){
|
||||||
fName.append(QString('/')+boxPlot->title());
|
fName.append(QString('/')+boxPlot->title());
|
||||||
fName.replace(".dat",".png");
|
fName.replace(".dat",".png");
|
||||||
@ -1007,6 +1114,7 @@ void qDrawPlot::SavePlotAutomatic(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -1021,15 +1129,15 @@ void qDrawPlot::ShowSaveErrorMessage(QString fileName){
|
|||||||
|
|
||||||
|
|
||||||
void qDrawPlot::SetPersistency(int val){
|
void qDrawPlot::SetPersistency(int val){
|
||||||
for(int i=0;i<=val;i++){
|
for(int i=0;i<=val;i++)
|
||||||
if(!yvalues[i]) yvalues[i] = new double [nPixelsX];
|
|
||||||
if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX];
|
if(!histYAxis[i]) histYAxis[i] = new double [nPixelsX];
|
||||||
}
|
|
||||||
persistency = val;
|
persistency = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::EnablePlot(bool enable){
|
void qDrawPlot::EnablePlot(bool enable){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Plotting set to:" << enable << endl;
|
cout << "Plotting set to:" << enable << endl;
|
||||||
@ -1041,8 +1149,10 @@ void qDrawPlot::EnablePlot(bool enable){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qDrawPlot::DisableZoom(bool disable){
|
void qDrawPlot::DisableZoom(bool disable){
|
||||||
if(plot_in_scope==1)
|
if(plot_in_scope==1)
|
||||||
plot1D->DisableZoom(disable);
|
plot1D->DisableZoom(disable);
|
||||||
@ -1050,4 +1160,133 @@ void qDrawPlot::DisableZoom(bool disable){
|
|||||||
plot2D->GetPlot()->DisableZoom(disable);
|
plot2D->GetPlot()->DisableZoom(disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
||||||
|
int ret,i,actualPixelsX;
|
||||||
|
double *temp;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
if(fromDetector) cout << "Geting Trimbits from Detector: ";
|
||||||
|
else cout << "Getting Trimbits from Shared Memory: ";
|
||||||
|
if(Histogram) cout << "Histogram" << endl;
|
||||||
|
else cout << "Data Graph" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
switch(myDet->getDetectorsType()){
|
||||||
|
|
||||||
|
|
||||||
|
case slsDetectorDefs::MYTHEN:
|
||||||
|
//get trimbits
|
||||||
|
actualPixelsX = myDet->getTotalNumberOfChannels();
|
||||||
|
temp = new double[actualPixelsX];
|
||||||
|
ret = myDet->getChanRegs(temp,fromDetector);
|
||||||
|
if(!ret){
|
||||||
|
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock");
|
||||||
|
return qDefs::FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//defining axes
|
||||||
|
if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX;
|
||||||
|
else nPixelsX = actualPixelsX;
|
||||||
|
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
||||||
|
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
||||||
|
//initializing
|
||||||
|
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;
|
||||||
|
for(int i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
|
||||||
|
|
||||||
|
//clear/select plot and set titles
|
||||||
|
Clear1DPlot();
|
||||||
|
Select1DPlot();
|
||||||
|
|
||||||
|
if(!Histogram){
|
||||||
|
//data
|
||||||
|
memcpy(histYAxis[0],temp,nPixelsX*sizeof(double));
|
||||||
|
//title
|
||||||
|
SetPlotTitle("Trimbits Plot - Data Graph");
|
||||||
|
plot1D->SetXTitle("Channel Number");
|
||||||
|
plot1D->SetYTitle("Trimbits");
|
||||||
|
//set plot parameters
|
||||||
|
SlsQtH1D* h;
|
||||||
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0)));
|
||||||
|
h->SetLineColor(1);
|
||||||
|
h->setTitle(GetHistTitle(0));
|
||||||
|
//attach plot
|
||||||
|
h->Attach(plot1D);
|
||||||
|
}else{
|
||||||
|
//data
|
||||||
|
for(i=0;i<actualPixelsX;i++){
|
||||||
|
if((temp[i]<=TRIM_HISTOGRAM_XMAX))/**shouldnt be the case*/
|
||||||
|
histYAxis[0][(int)temp[i]]+=1;
|
||||||
|
//else cout<<"OUT OF BOUNDS:"<<i<<"-"<<temp[i]<<endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for(i=0;i<TRIM_HISTOGRAM_XMAX;i++)
|
||||||
|
if((histYAxis[0][i]<=TRIM_HISTOGRAM_XMAX)&&(histYAxis[0][i]>0))
|
||||||
|
cout<<"HIsty["<<i<<"]:"<<histYAxis[0][i]<<endl;*/
|
||||||
|
|
||||||
|
//title
|
||||||
|
SetPlotTitle("Trimbits Plot - Histogram");
|
||||||
|
plot1D->SetXTitle("Trimbits");
|
||||||
|
plot1D->SetYTitle("Frequency");
|
||||||
|
//set plot parameters
|
||||||
|
SlsQtH1D* h;
|
||||||
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0)));
|
||||||
|
h->SetLineColor(1);
|
||||||
|
h->setTitle(GetHistTitle(0));
|
||||||
|
//attach plot
|
||||||
|
h->Attach(plot1D);
|
||||||
|
|
||||||
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Trimbits Plot updated" << endl;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//2d
|
||||||
|
case slsDetectorDefs::EIGER:
|
||||||
|
//defining axes
|
||||||
|
nPixelsX = 100;/**??*/
|
||||||
|
nPixelsY = 100;
|
||||||
|
if(lastImageArray) delete [] lastImageArray; lastImageArray = new double[nPixelsY*nPixelsX];
|
||||||
|
//initializing 2d array
|
||||||
|
for(int py=0;py<(int)nPixelsY;py++)
|
||||||
|
for(int px=0;px<(int)nPixelsX;px++)
|
||||||
|
lastImageArray[py*nPixelsX+px] = 0;
|
||||||
|
//get trimbits
|
||||||
|
ret = 1;/*myDet->getChanRegs(lastImageArray,fromDetector);*/
|
||||||
|
if(!ret){
|
||||||
|
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock");
|
||||||
|
return qDefs::FAIL;
|
||||||
|
}
|
||||||
|
//clear/select plot and set titles
|
||||||
|
Select2DPlot();
|
||||||
|
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
|
||||||
|
plot2D->setTitle("Image");
|
||||||
|
plot2D->SetXTitle("Pixel");
|
||||||
|
plot2D->SetYTitle("Pixel");
|
||||||
|
plot2D->SetZTitle("Trimbits");
|
||||||
|
plot2D->UpdateNKeepSetRangeIfSet();
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Trimbits Plot updated" << endl;
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//shouldnt be here
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return qDefs::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -1028,7 +1028,7 @@ void qScanWidget::Refresh(){
|
|||||||
"numSteps:" << actualNumSteps << "\t"
|
"numSteps:" << actualNumSteps << "\t"
|
||||||
//"values:" << arrSteps << "\t"
|
//"values:" << arrSteps << "\t"
|
||||||
"parameter:" << parameter << "\t"
|
"parameter:" << parameter << "\t"
|
||||||
"precision:" << precision << endl << endl;
|
"precision:" << precision << "\t***" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,19 +354,24 @@ void qTabActions::DeletePosition(){
|
|||||||
|
|
||||||
void qTabActions::EnablePositions(bool enable){
|
void qTabActions::EnablePositions(bool enable){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "\nEnable Positions: " << enable << endl;
|
cout << "Enable Positions: " << enable << endl;
|
||||||
#endif
|
#endif
|
||||||
if(enable){
|
if(enable){
|
||||||
lblName[NumPositions]->setEnabled(true);
|
lblName[NumPositions]->setEnabled(true);
|
||||||
btnExpand[NumPositions]->setEnabled(true);
|
btnExpand[NumPositions]->setEnabled(true);
|
||||||
}else{
|
}else{
|
||||||
//to collapse if it was expanded
|
//deletes all positions
|
||||||
if(btnExpand[NumPositions]->text()=="-")
|
|
||||||
Expand(group->button(NumPositions));
|
|
||||||
for(int i=0;i<comboPos->count();i++)
|
for(int i=0;i<comboPos->count();i++)
|
||||||
comboPos->removeItem(i);
|
comboPos->removeItem(i);
|
||||||
cout<<"Number of Positions set to :"<<myDet->getPositions()<<endl;
|
cout<<"Number of Positions set to :"<<myDet->getPositions()<<endl;
|
||||||
lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette());
|
lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette());
|
||||||
|
//to collapse if it was expanded
|
||||||
|
if(btnExpand[NumPositions]->isChecked()){
|
||||||
|
disconnect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||||
|
btnExpand[NumPositions]->setChecked(false);
|
||||||
|
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||||
|
Expand(group->button(NumPositions));
|
||||||
|
}
|
||||||
lblName[NumPositions]->setEnabled(false);
|
lblName[NumPositions]->setEnabled(false);
|
||||||
btnExpand[NumPositions]->setEnabled(false);
|
btnExpand[NumPositions]->setEnabled(false);
|
||||||
}
|
}
|
||||||
@ -378,7 +383,7 @@ void qTabActions::EnablePositions(bool enable){
|
|||||||
|
|
||||||
void qTabActions::Refresh(){
|
void qTabActions::Refresh(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "\nUpdating all action widgets " << endl;
|
cout << "\nUpdating all action widgets: " << endl;
|
||||||
#endif
|
#endif
|
||||||
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){
|
if((detType == slsDetectorDefs::MYTHEN) || (detType == slsDetectorDefs::GOTTHARD)){
|
||||||
//positions is enabled only if angular conversion is enabled
|
//positions is enabled only if angular conversion is enabled
|
||||||
@ -415,7 +420,7 @@ void qTabActions::Refresh(){
|
|||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Updated position widget\tnum:" << numPos << endl << endl;
|
cout << "Updated position widget\tnum:" << numPos << "\t***" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +428,7 @@ void qTabActions::Refresh(){
|
|||||||
scanWidget[i]->Refresh();
|
scanWidget[i]->Refresh();
|
||||||
for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++)
|
for(int i=0;i<qActionsWidget::NUM_ACTION_WIDGETS;i++)
|
||||||
actionWidget[i]->Refresh();
|
actionWidget[i]->Refresh();
|
||||||
|
cout << endl;
|
||||||
UpdateCollapseColors();
|
UpdateCollapseColors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "qTabAdvanced.h"
|
#include "qTabAdvanced.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
#include "qDrawPlot.h"
|
||||||
/** Project Class Headers */
|
/** Project Class Headers */
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "multiSlsDetector.h"
|
||||||
@ -19,7 +20,8 @@ using namespace std;
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector):QWidget(parent),myDet(detector){
|
qTabAdvanced::qTabAdvanced(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot):
|
||||||
|
QWidget(parent),myDet(detector),myPlot(plot),btnGroup(NULL){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
Initialization();
|
Initialization();
|
||||||
@ -52,7 +54,12 @@ void qTabAdvanced::SetupWidgetWindow(){
|
|||||||
|
|
||||||
boxTrimming->setChecked(false);
|
boxTrimming->setChecked(false);
|
||||||
SetOptimize(false);
|
SetOptimize(false);
|
||||||
|
|
||||||
|
btnGroup = new QButtonGroup(this);
|
||||||
|
btnGroup->addButton(btnRefresh,0);
|
||||||
|
btnGroup->addButton(btnGetTrimbits,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +95,8 @@ void qTabAdvanced::Initialization(){
|
|||||||
connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming()));
|
connect(btnStart, SIGNAL(clicked()), this, SLOT(StartTrimming()));
|
||||||
|
|
||||||
//refresh
|
//refresh
|
||||||
connect(btnRefresh, SIGNAL(clicked()), this, SLOT(UpdatePlot()));
|
connect(btnGroup, SIGNAL(buttonClicked(int)), this, SLOT(UpdateTrimbitPlot(int)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -331,7 +339,7 @@ void qTabAdvanced::StartTrimming(){
|
|||||||
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
|
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,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
|
||||||
//updates plots
|
//updates plots
|
||||||
UpdatePlot();
|
myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
|
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
|
||||||
@ -341,36 +349,17 @@ void qTabAdvanced::StartTrimming(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabAdvanced::UpdatePlot(){
|
void qTabAdvanced::UpdateTrimbitPlot(int id){
|
||||||
#ifdef VERBOSE
|
//refresh
|
||||||
cout << "Updating Plot" << endl;
|
if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||||
#endif
|
//from detector
|
||||||
|
else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked());
|
||||||
int nPixelsX = myDet->getTotalNumberOfChannels();
|
|
||||||
|
|
||||||
int *histXAxis = new int[nPixelsX];
|
|
||||||
int *histYAxis = new int[100];
|
|
||||||
for(int i=0;i<nPixelsX;i++) histXAxis[i] = i;
|
|
||||||
|
|
||||||
int channelsPerDetector;
|
|
||||||
/*
|
|
||||||
for(int det=0;det<myDet->getNumberOfDetectors();det++){
|
|
||||||
slsDetector *s = myDet->getSlsDetector(det);
|
|
||||||
channelsPerDetector=s->getTotalNumberOfChannels();
|
|
||||||
if(s->chanregs){
|
|
||||||
for(int i=0;i<channelsPerDetector;i++){
|
|
||||||
memcpy(histYAxis + (det*channelsPerDetector*sizeof(int)),s->chanregs,channelsPerDetector*sizeof(int));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
cout<<"histyaxis[500]:"<<histYAxis[500]<<endl;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabAdvanced::Refresh(){
|
void qTabAdvanced::Refresh(){
|
||||||
//disconnect
|
//disconnect
|
||||||
disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
|
disconnect(chkEnergyLog, SIGNAL(toggled(bool)), this, SLOT(SetLogs()));
|
||||||
|
@ -46,7 +46,7 @@ qTabDataOutput::~qTabDataOutput(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<<endl;
|
void qTabDataOutput::SetupWidgetWindow(){
|
||||||
// Detector Type
|
// Detector Type
|
||||||
detType=myDet->getDetectorsType();
|
detType=myDet->getDetectorsType();
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ void qTabDataOutput::SetupWidgetWindow(){cout<<"in here"<<endl;
|
|||||||
|
|
||||||
void qTabDataOutput::Initialization(){
|
void qTabDataOutput::Initialization(){
|
||||||
//output dir
|
//output dir
|
||||||
connect(dispOutputDir, SIGNAL(textChanged(const QString&)), this, SLOT(setOutputDir(const QString&)));
|
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir()));
|
||||||
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir()));
|
connect(btnOutputBrowse, SIGNAL(clicked()), this, SLOT(browseOutputDir()));
|
||||||
//flat field correction
|
//flat field correction
|
||||||
connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField()));
|
connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField()));
|
||||||
@ -93,11 +93,20 @@ void qTabDataOutput::Initialization(){
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
void qTabDataOutput::setOutputDir(const QString& path){
|
void qTabDataOutput::setOutputDir(){
|
||||||
|
QString path = dispOutputDir->text();
|
||||||
|
|
||||||
|
//gets rid of the end '/'s
|
||||||
|
disconnect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir()));
|
||||||
|
while(path.endsWith('/')) path.chop(1);
|
||||||
|
dispOutputDir->setText(path);
|
||||||
|
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir()));
|
||||||
|
|
||||||
myDet->setFilePath(string(path.toAscii().constData()));
|
myDet->setFilePath(string(path.toAscii().constData()));
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
|
cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -306,6 +306,7 @@ void qTabMeasurement::startStopAcquisition(){
|
|||||||
progressTimer->start(100);
|
progressTimer->start(100);
|
||||||
|
|
||||||
emit StartSignal();
|
emit StartSignal();
|
||||||
|
|
||||||
myPlot->StartStopDaqToggle();
|
myPlot->StartStopDaqToggle();
|
||||||
}else{
|
}else{
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -326,14 +327,16 @@ void qTabMeasurement::startStopAcquisition(){
|
|||||||
|
|
||||||
|
|
||||||
void qTabMeasurement::UpdateFinished(){
|
void qTabMeasurement::UpdateFinished(){
|
||||||
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
if(btnStartStop->isChecked()){
|
||||||
btnStartStop->setText("Start");
|
disconnect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||||
btnStartStop->setIcon(*iconStart);
|
btnStartStop->setText("Start");
|
||||||
btnStartStop->setChecked(false);
|
btnStartStop->setIcon(*iconStart);
|
||||||
Enable(1);
|
btnStartStop->setChecked(false);
|
||||||
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
Enable(1);
|
||||||
UpdateProgress();
|
connect(btnStartStop,SIGNAL(clicked()),this,SLOT(startStopAcquisition()));
|
||||||
progressTimer->stop();
|
UpdateProgress();
|
||||||
|
progressTimer->stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -723,20 +726,22 @@ void qTabMeasurement::EnableFileWrite(bool enable){
|
|||||||
|
|
||||||
|
|
||||||
void qTabMeasurement::Refresh(){
|
void qTabMeasurement::Refresh(){
|
||||||
//Number of measurements
|
if(!myPlot->isRunning()){
|
||||||
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
//Number of measurements
|
||||||
//File Name
|
spinNumMeasurements->setValue((int)myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER,-1));
|
||||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
//File Name
|
||||||
//File Index
|
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||||
spinIndex->setValue(myDet->getFileIndex());
|
//File Index
|
||||||
//progress label index
|
spinIndex->setValue(myDet->getFileIndex());cout<<"file index:"<<myDet->getFileIndex()<<endl;
|
||||||
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
//progress label index
|
||||||
//Timing mode*
|
lblProgressIndex->setText(QString::number(myDet->getFileIndex()));
|
||||||
SetupTimingMode();
|
//Timing mode*
|
||||||
|
SetupTimingMode();
|
||||||
|
|
||||||
// to let qdrawplot know that triggers or frames are used
|
// to let qdrawplot know that triggers or frames are used
|
||||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ void qTabPlot::EnableScanBox(){
|
|||||||
int mode1 = myDet->getScanMode(1);
|
int mode1 = myDet->getScanMode(1);
|
||||||
|
|
||||||
//if it was checked before or disabled before, it remembers to check it again
|
//if it was checked before or disabled before, it remembers to check it again
|
||||||
bool checkedBefore = (boxScan->isChecked()||(!boxScan->isEnabled()));
|
bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled()));
|
||||||
|
|
||||||
|
|
||||||
//none of these scan plotting options make sense if positions>0
|
//none of these scan plotting options make sense if positions>0
|
||||||
@ -548,7 +548,8 @@ void qTabPlot::EnableScanBox(){
|
|||||||
//positions
|
//positions
|
||||||
if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);
|
if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);
|
||||||
chkSuperimpose->setEnabled(!positionsExist);
|
chkSuperimpose->setEnabled(!positionsExist);
|
||||||
boxFrequency->setEnabled(!positionsExist);
|
//box frequency should be enabled cuz its a normal 1d plot
|
||||||
|
boxFrequency->setEnabled(positionsExist);
|
||||||
myPlot->EnableAnglePlot(positionsExist);
|
myPlot->EnableAnglePlot(positionsExist);
|
||||||
|
|
||||||
|
|
||||||
@ -673,8 +674,14 @@ void qTabPlot::SetScanArgument(){
|
|||||||
|
|
||||||
|
|
||||||
void qTabPlot::Refresh(){
|
void qTabPlot::Refresh(){
|
||||||
SetFrequency();
|
if(!myPlot->isRunning()){
|
||||||
if(!myPlot->isRunning()) EnableScanBox();
|
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
|
SetFrequency();
|
||||||
|
EnableScanBox();
|
||||||
|
}else{
|
||||||
|
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
|
boxScan->setEnabled(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ using namespace std;
|
|||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector):
|
qTabSettings::qTabSettings(QWidget *parent,multiSlsDetector*& detector):
|
||||||
QWidget(parent),myDet(detector){
|
QWidget(parent),myDet(detector),expertMode(false){
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
@ -170,7 +170,7 @@ void qTabSettings::setSettings(int index){
|
|||||||
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
if((detType==slsDetectorDefs::GOTTHARD)||(detType==slsDetectorDefs::AGIPD)){
|
||||||
lblThreshold->setEnabled(false);
|
lblThreshold->setEnabled(false);
|
||||||
spinThreshold->setEnabled(false);
|
spinThreshold->setEnabled(false);
|
||||||
}else{
|
}else{//mythen or eiger
|
||||||
if((index==Undefined)||(index==Uninitialized)){
|
if((index==Undefined)||(index==Uninitialized)){
|
||||||
|
|
||||||
lblThreshold->setEnabled(false);
|
lblThreshold->setEnabled(false);
|
||||||
@ -179,8 +179,12 @@ void qTabSettings::setSettings(int index){
|
|||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
SetEnergy();
|
SetEnergy();
|
||||||
|
//also update trimbits plot
|
||||||
|
if(expertMode) emit UpdateTrimbitSignal(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -234,10 +238,10 @@ void qTabSettings::SetDynamicRange(int index){
|
|||||||
|
|
||||||
|
|
||||||
void qTabSettings::SetEnergy(){
|
void qTabSettings::SetEnergy(){
|
||||||
|
int index = spinThreshold->value();
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Settings threshold energy to "<< index << endl;
|
cout << "Settings threshold energy to "<< index << endl;
|
||||||
#endif
|
#endif
|
||||||
int index = spinThreshold->value();
|
|
||||||
myDet->setThresholdEnergy(index);
|
myDet->setThresholdEnergy(index);
|
||||||
int ret = (int)myDet->getThresholdEnergy();
|
int ret = (int)myDet->getThresholdEnergy();
|
||||||
if((ret-index)>200){
|
if((ret-index)>200){
|
||||||
@ -256,7 +260,11 @@ void qTabSettings::SetEnergy(){
|
|||||||
void qTabSettings::Refresh(){
|
void qTabSettings::Refresh(){
|
||||||
// Settings
|
// Settings
|
||||||
SetupDetectorSettings();
|
SetupDetectorSettings();
|
||||||
|
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
|
||||||
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
comboSettings->setCurrentIndex(myDet->getSettings());
|
comboSettings->setCurrentIndex(myDet->getSettings());
|
||||||
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
|
|
||||||
// Number of Modules
|
// Number of Modules
|
||||||
spinNumModules->setValue(myDet->setNumberOfModules());
|
spinNumModules->setValue(myDet->setNumberOfModules());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user