mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
the angles should work now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@44 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -196,11 +196,14 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>20</y>
|
<y>20</y>
|
||||||
<width>350</width>
|
<width>361</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QCheckBox" name="chkSuperimpose">
|
<widget class="QCheckBox" name="chkSuperimpose">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -243,20 +246,39 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>170</width>
|
<width>140</width>
|
||||||
<height>10</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QCheckBox" name="chkLines">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Lines</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>145</x>
|
<x>120</x>
|
||||||
<y>20</y>
|
<y>21</y>
|
||||||
<width>126</width>
|
<width>121</width>
|
||||||
<height>23</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -65,6 +65,15 @@ public:
|
|||||||
* */
|
* */
|
||||||
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]);
|
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis[],string histTitle[]);
|
||||||
|
|
||||||
|
/** Get the 1D hist values to plot for angle plotting
|
||||||
|
* @param nHists Number of graphs in 1D
|
||||||
|
* @param histNBins Total Number of X axis values/channels in 1D
|
||||||
|
* @param histXAxis X Axis value in 1D
|
||||||
|
* @param histYAxis Y Axis value in 1D
|
||||||
|
* @param histTitle Title for all the graphs in 1D
|
||||||
|
* */
|
||||||
|
void SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]);
|
||||||
|
|
||||||
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*/
|
||||||
|
@ -24,6 +24,7 @@ class qCloneWidget;
|
|||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "qwt_symbol.h"
|
||||||
|
|
||||||
/** C++ Include Headers */
|
/** C++ Include Headers */
|
||||||
|
|
||||||
@ -68,6 +69,8 @@ public:
|
|||||||
void DisableZoom(bool disable);
|
void DisableZoom(bool disable);
|
||||||
/** Enables plot from the plot tab*/
|
/** Enables plot from the plot tab*/
|
||||||
void EnablePlot(bool enable);
|
void EnablePlot(bool enable);
|
||||||
|
/** Enable angle plot */
|
||||||
|
void EnableAnglePlot(bool enable){anglePlot = enable;};
|
||||||
|
|
||||||
/** Its a reminder to update plot to set the xy range
|
/** Its a reminder to update plot to set the xy range
|
||||||
* This is done only when there is a plot to update */
|
* This is done only when there is a plot to update */
|
||||||
@ -129,8 +132,10 @@ void SavePlot();
|
|||||||
void SaveAll(bool enable);
|
void SaveAll(bool enable);
|
||||||
/** Sets persistency from plot tab */
|
/** Sets persistency from plot tab */
|
||||||
void SetPersistency(int val);
|
void SetPersistency(int val);
|
||||||
/** sets style of plot to dotted */
|
/** sets style of plot to lines*/
|
||||||
void SetDottedPlot(bool enable){plotDotted = enable;};
|
void SetLines(bool enable){lines = enable;};
|
||||||
|
/** sets markers */
|
||||||
|
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){scanArgument = scanArg;};
|
||||||
|
|
||||||
@ -176,6 +181,10 @@ int GetData(detectorData *data);
|
|||||||
/** 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();
|
||||||
|
|
||||||
|
void SetStyle(SlsQtH1D* h){
|
||||||
|
if(lines) h->setStyle(QwtPlotCurve::Lines); else h->setStyle(QwtPlotCurve::Dots);
|
||||||
|
if(markers) h->setSymbol(*marker); else h->setSymbol(*noMarker);};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -281,6 +290,8 @@ std::string imageTitle;
|
|||||||
unsigned int plot_in_scope;
|
unsigned int plot_in_scope;
|
||||||
/** Number of Pixels in X Axis */
|
/** Number of Pixels in X Axis */
|
||||||
unsigned int nPixelsX;
|
unsigned int nPixelsX;
|
||||||
|
/** Number of angle Pixels in X Axis */
|
||||||
|
int nAnglePixelsX;
|
||||||
/** Number of pixel bins in Y Axis */
|
/** Number of pixel bins in Y Axis */
|
||||||
int nPixelsY;
|
int nPixelsY;
|
||||||
/** Min Pixel number for Y Axis*/
|
/** Min Pixel number for Y Axis*/
|
||||||
@ -306,6 +317,10 @@ int histNBins;
|
|||||||
double* histXAxis;
|
double* histXAxis;
|
||||||
/** Y Axis value in 1D */
|
/** Y Axis value in 1D */
|
||||||
double* histYAxis[MAX_1DPLOTS];
|
double* histYAxis[MAX_1DPLOTS];
|
||||||
|
/** X Axis for angles in 1D */
|
||||||
|
double* histXAngleAxis;
|
||||||
|
/** Y Axis for angles in 1D (no persistency) */
|
||||||
|
double* histYAngleAxis;
|
||||||
/** Current Image Values in 2D */
|
/** Current Image Values in 2D */
|
||||||
double* lastImageArray;
|
double* lastImageArray;
|
||||||
/** temporary Y Axis value in 1D */
|
/** temporary Y Axis value in 1D */
|
||||||
@ -324,7 +339,11 @@ int progress;
|
|||||||
/**If plot is enabled from plot tab*/
|
/**If plot is enabled from plot tab*/
|
||||||
bool plotEnable;
|
bool plotEnable;
|
||||||
/**If plot is dotted */
|
/**If plot is dotted */
|
||||||
bool plotDotted;
|
bool lines;
|
||||||
|
bool markers;
|
||||||
|
/** Plot marker */
|
||||||
|
QwtSymbol *marker;
|
||||||
|
QwtSymbol *noMarker;
|
||||||
/** Save all plots */
|
/** Save all plots */
|
||||||
bool saveAll;
|
bool saveAll;
|
||||||
/** If error, while automatically saving plots, checks this at the end of an acquistion */
|
/** If error, while automatically saving plots, checks this at the end of an acquistion */
|
||||||
@ -360,6 +379,9 @@ bool isTriggerEnabled;
|
|||||||
enum scanArgumentList{None,Level0,Level1,FileIndex,AllFrames};
|
enum scanArgumentList{None,Level0,Level1,FileIndex,AllFrames};
|
||||||
int scanArgument;
|
int scanArgument;
|
||||||
|
|
||||||
|
/** enable angle plot */
|
||||||
|
bool anglePlot;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -8,8 +8,6 @@
|
|||||||
* DisableZoom,
|
* DisableZoom,
|
||||||
* SetXMinMax,SetYMinMax,
|
* SetXMinMax,SetYMinMax,
|
||||||
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
* GetXMinimum,GetXMaximum,GetYMinimum,GetYMaximum}
|
||||||
* 07.08.2012:{function to change lines, points etc }
|
|
||||||
* SetDotStyle
|
|
||||||
* */
|
* */
|
||||||
|
|
||||||
#ifndef SLSQT1DPLOT_H
|
#ifndef SLSQT1DPLOT_H
|
||||||
@ -62,9 +60,7 @@ class SlsQtH1D:public QwtPlotCurve{
|
|||||||
|
|
||||||
SlsQtH1D* Add(double v);
|
SlsQtH1D* Add(double v);
|
||||||
|
|
||||||
/** Added by Dhanya to change style of graph*/
|
|
||||||
void SetDotStyle(bool enable){if(enable) setStyle(QwtPlotCurve::Dots); else setStyle(QwtPlotCurve::Lines);};
|
|
||||||
/**---*/
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int ndata;
|
int ndata;
|
||||||
|
@ -114,8 +114,29 @@ void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,doub
|
|||||||
}
|
}
|
||||||
//cloneplot1D->UnZoom();
|
//cloneplot1D->UnZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qCloneWidget::SetCloneHists(int nHists,int histNBins,double* histXAxis,double* histYAxis,string histTitle[]){
|
||||||
|
/** for each plot*/cout<<"qclone nhists:"<<nHists<<endl;
|
||||||
|
for(int hist_num=0;hist_num<nHists;hist_num++){
|
||||||
|
/** create hists */
|
||||||
|
SlsQtH1D* k;
|
||||||
|
if(hist_num+1>cloneplot1D_hists.size()){
|
||||||
|
cloneplot1D_hists.append(k=new SlsQtH1D("1d plot",histNBins,histXAxis,histYAxis));
|
||||||
|
k->SetLineColor(hist_num+1);
|
||||||
|
}else{
|
||||||
|
k=cloneplot1D_hists.at(hist_num);
|
||||||
|
k->SetData(histNBins,histXAxis,histYAxis);
|
||||||
|
}
|
||||||
|
k->setTitle(histTitle[hist_num].c_str());
|
||||||
|
k->Attach(cloneplot1D);
|
||||||
|
}
|
||||||
|
//cloneplot1D->UnZoom();
|
||||||
|
}//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
char* qCloneWidget::GetCurrentTimeStamp(){
|
char* qCloneWidget::GetCurrentTimeStamp(){
|
||||||
char output[30];
|
char output[30];
|
||||||
char *result;
|
char *result;
|
||||||
@ -129,6 +150,7 @@ char* qCloneWidget::GetCurrentTimeStamp(){
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qCloneWidget::SavePlot(){
|
void qCloneWidget::SavePlot(){
|
||||||
|
@ -232,7 +232,7 @@ void qDetectorMain::Initialization(){
|
|||||||
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
|
connect(tab_dataoutput, SIGNAL(AngularConversionSignal(bool)), tab_actions,SLOT(EnablePositions(bool)));
|
||||||
// Plot tab
|
// Plot tab
|
||||||
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||||
// Actions tab
|
// Actions tab (also for angles)
|
||||||
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
|
connect(tab_actions, SIGNAL(EnableScanBox()), tab_plot,SLOT(EnableScanBox()));
|
||||||
// Plotting
|
// Plotting
|
||||||
// When the acquisition is finished, must update the meas tab
|
// When the acquisition is finished, must update the meas tab
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
#include "qCloneWidget.h"
|
#include "qCloneWidget.h"
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
|
|
||||||
// Project Class Headers
|
// Project Class Headers
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
#include "multiSlsDetector.h"
|
#include "multiSlsDetector.h"
|
||||||
@ -66,20 +67,27 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
|
|
||||||
nPixelsX = myDet->getTotalNumberOfChannels();
|
nPixelsX = myDet->getTotalNumberOfChannels();
|
||||||
nPixelsY = 100;
|
nPixelsY = 100;
|
||||||
|
nAnglePixelsX = 1;
|
||||||
|
|
||||||
minPixelsY = 0;
|
minPixelsY = 0;
|
||||||
|
//2d
|
||||||
lastImageArray = 0;
|
lastImageArray = 0;
|
||||||
image_data = 0;
|
image_data = 0;
|
||||||
//1d
|
//1d
|
||||||
nHists = 0;
|
nHists = 0;
|
||||||
histNBins = 0;
|
histNBins = 0;
|
||||||
histXAxis = 0;
|
histXAxis = 0;
|
||||||
|
histXAngleAxis = 0;
|
||||||
|
histYAngleAxis = 0;
|
||||||
persistency = 0;
|
persistency = 0;
|
||||||
currentPersistency = 0;
|
currentPersistency = 0;
|
||||||
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
plotEnable=true;
|
plotEnable = true;
|
||||||
|
anglePlot = false;
|
||||||
|
|
||||||
saveAll = false;
|
saveAll = false;
|
||||||
plotDotted = false;
|
|
||||||
XYRangeChanged = false;
|
XYRangeChanged = false;
|
||||||
timerValue = PLOT_TIMER_MS;
|
timerValue = PLOT_TIMER_MS;
|
||||||
frameFactor=0;
|
frameFactor=0;
|
||||||
@ -114,8 +122,9 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
|
|
||||||
char temp_title[2000];
|
char temp_title[2000];
|
||||||
for(int i=0;i<MAX_1DPLOTS;i++){
|
for(int i=0;i<MAX_1DPLOTS;i++){
|
||||||
sprintf(temp_title,"Frame -%d",i);
|
histTitle[i] = "";
|
||||||
histTitle[i] = temp_title;
|
//sprintf(temp_title,"Frame -%d",i);
|
||||||
|
//histTitle[i] = temp_title;
|
||||||
}
|
}
|
||||||
imageTitle.assign("Start Image");
|
imageTitle.assign("Start Image");
|
||||||
imageXAxisTitle="Pixel";
|
imageXAxisTitle="Pixel";
|
||||||
@ -144,6 +153,18 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
plotLayout = new QGridLayout(boxPlot);
|
plotLayout = new QGridLayout(boxPlot);
|
||||||
plotLayout->addWidget(plot1D,1,1,1,1);
|
plotLayout->addWidget(plot1D,1,1,1,1);
|
||||||
plotLayout->addWidget(plot2D,1,1,1,1);
|
plotLayout->addWidget(plot2D,1,1,1,1);
|
||||||
|
|
||||||
|
//marker
|
||||||
|
lines = true;
|
||||||
|
markers = false;
|
||||||
|
marker = new QwtSymbol();
|
||||||
|
marker->setStyle(QwtSymbol::Cross);
|
||||||
|
marker->setSize(5,5);
|
||||||
|
noMarker = new QwtSymbol();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
@ -190,8 +211,9 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
|||||||
//get #scansets for level 0 and level 1
|
//get #scansets for level 0 and level 1
|
||||||
int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0);
|
int numScan0 = myDet->getScanSteps(0); numScan0 = ((numScan0==0)?1:numScan0);
|
||||||
int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1);
|
int numScan1 = myDet->getScanSteps(1); numScan1 = ((numScan1==0)?1:numScan1);
|
||||||
|
int numPos = myDet->getPositions(); numPos = ((numPos==0) ?1:numPos);
|
||||||
|
|
||||||
number_of_exposures = number_of_frames * numScan0 * numScan1;
|
number_of_exposures = number_of_frames * numScan0 * numScan1 * numPos;
|
||||||
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
|
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
|
||||||
|
|
||||||
// ExposureTime
|
// ExposureTime
|
||||||
@ -260,6 +282,9 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
//start part
|
//start part
|
||||||
if(start){
|
if(start){
|
||||||
|
|
||||||
|
if(myDet->getRunStatus()==slsDetectorDefs::IDLE)
|
||||||
|
cout<<endl<<endl<<"IDLE"<<endl<<endl;
|
||||||
|
else cout<<endl<<endl<<"ERRORRRRRR: "<<myDet->getRunStatus()<<endl<<endl;
|
||||||
// Defaults
|
// Defaults
|
||||||
progress = 0;
|
progress = 0;
|
||||||
currentFrame = 0;
|
currentFrame = 0;
|
||||||
@ -321,9 +346,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//1d
|
//1d
|
||||||
histNBins = nPixelsX;
|
|
||||||
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
||||||
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
||||||
|
|
||||||
@ -335,8 +358,10 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
|||||||
if(image_data) delete [] image_data; image_data = new double[nPixelsY*nPixelsX];
|
if(image_data) delete [] image_data; image_data = new double[nPixelsY*nPixelsX];
|
||||||
|
|
||||||
//initializing 1d xaxis
|
//initializing 1d xaxis
|
||||||
for(unsigned int px=0;px<nPixelsX;px++)
|
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;/*+10;*/
|
||||||
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<nPixelsY;py++)
|
||||||
for(int px=0;px<nPixelsX;px++)
|
for(int px=0;px<nPixelsX;px++)
|
||||||
@ -415,14 +440,16 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
|
|
||||||
//Not Nth Frame, Not time out yet
|
//Not Nth Frame, Not time out yet
|
||||||
else{
|
else{
|
||||||
//if the time is not over, RETURN
|
if((scanArgument==None)&&(!anglePlot)){
|
||||||
if(!data_pause_over){
|
//if the time is not over, RETURN
|
||||||
progress=(int)data->progressIndex;
|
if(!data_pause_over){
|
||||||
currentFrame++;
|
progress=(int)data->progressIndex;
|
||||||
return 0;
|
currentFrame++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
data_pause_over=false;
|
||||||
|
data_pause_timer->start((int)(PLOT_TIMER_MS/2));
|
||||||
}
|
}
|
||||||
data_pause_over=false;
|
|
||||||
data_pause_timer->start((int)(PLOT_TIMER_MS/2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -442,8 +469,25 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
#ifdef VERYVERBOSE
|
#ifdef VERYVERBOSE
|
||||||
cout << "Reading in image: " << currentIndex << endl;
|
cout << "Reading in image: " << currentIndex << endl;
|
||||||
#endif
|
#endif
|
||||||
|
//angle plotting
|
||||||
|
if(anglePlot){
|
||||||
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
|
lastImageNumber= currentFrame+1;
|
||||||
|
nAnglePixelsX = data->npoints;
|
||||||
|
histNBins = nAnglePixelsX;
|
||||||
|
nHists=1;
|
||||||
|
if(histXAngleAxis) delete [] histXAngleAxis; histXAngleAxis = new double[nAnglePixelsX];
|
||||||
|
if(histYAngleAxis) delete [] histYAngleAxis; histYAngleAxis = new double[nAnglePixelsX];
|
||||||
|
memcpy(histXAngleAxis,data->angles,nAnglePixelsX*sizeof(double));
|
||||||
|
memcpy(histYAngleAxis,data->values,nAnglePixelsX*sizeof(double));
|
||||||
|
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||||
|
}
|
||||||
|
currentFrame++;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
//if scan argument is 2d
|
//if scan argument is 2d
|
||||||
if(scanArgument!=None){
|
if(scanArgument!=None){
|
||||||
|
//alframes
|
||||||
if(scanArgument==AllFrames){
|
if(scanArgument==AllFrames){
|
||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
@ -455,7 +499,8 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
currentScanDivLevel++;
|
currentScanDivLevel++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(scanArgument==FileIndex){
|
//file index
|
||||||
|
if(scanArgument==FileIndex){
|
||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
if(currentIndex == minPixelsY) currentScanDivLevel = 0;
|
if(currentIndex == minPixelsY) currentScanDivLevel = 0;
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
@ -467,7 +512,8 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
currentScanDivLevel++;
|
currentScanDivLevel++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if(scanArgument==Level0){
|
//level0
|
||||||
|
if(scanArgument==Level0){
|
||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
|
if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
|
||||||
currentScanValue = currentScanVariable0;
|
currentScanValue = currentScanVariable0;
|
||||||
@ -479,18 +525,18 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
currentFrame++;
|
currentFrame++;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else {
|
//level1
|
||||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||||
if(currentScanVariable1!=currentScanValue) currentScanDivLevel++;
|
if(currentScanVariable1!=currentScanValue) currentScanDivLevel++;
|
||||||
currentScanValue = currentScanVariable1;
|
currentScanValue = currentScanVariable1;
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
|
char temp_title[2000]; sprintf(temp_title,"Image Index %d",currentIndex); imageTitle = temp_title;
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||||
}
|
|
||||||
currentFrame++;
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
currentFrame++;
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//normal measurement or 1d scans
|
//normal measurement or 1d scans
|
||||||
@ -502,18 +548,15 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
//1d
|
//1d
|
||||||
if(plot_in_scope==1){
|
if(plot_in_scope==1){
|
||||||
// Titles changed to "" inside startstopthread
|
// Titles changed to "" inside startstopthread
|
||||||
//sprintf(temp_title,"Frame Index %d",currentIndex); histTitle[0] = temp_title;
|
|
||||||
|
|
||||||
// Persistency
|
// Persistency
|
||||||
if(currentPersistency < persistency)currentPersistency++;
|
if(currentPersistency < persistency)currentPersistency++;
|
||||||
else currentPersistency=persistency;
|
else currentPersistency=persistency;
|
||||||
nHists = currentPersistency+1;
|
nHists = currentPersistency+1;
|
||||||
|
histNBins = nPixelsX;
|
||||||
// copy data
|
// copy data
|
||||||
//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
|
|
||||||
for(int i=currentPersistency;i>0;i--)
|
for(int i=currentPersistency;i>0;i--)
|
||||||
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
|
memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
|
||||||
memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
|
memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
|
||||||
//for(int i=0;i<(int)nPixelsX;i++) *(yvalues[0]+i) = (double)*(data->values+i);
|
|
||||||
}
|
}
|
||||||
//2d
|
//2d
|
||||||
else{
|
else{
|
||||||
@ -593,13 +636,21 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
for(int hist_num=0;hist_num<(int)nHists;hist_num++){
|
for(int hist_num=0;hist_num<(int)nHists;hist_num++){
|
||||||
SlsQtH1D* h;
|
SlsQtH1D* h;
|
||||||
if(hist_num+1>plot1D_hists.size()){
|
if(hist_num+1>plot1D_hists.size()){
|
||||||
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
|
if(anglePlot)
|
||||||
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAngleAxis,histYAngleAxis));
|
||||||
|
else
|
||||||
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",histNBins,histXAxis,GetHistYAxis(hist_num)));
|
||||||
h->SetLineColor(hist_num+1);
|
h->SetLineColor(hist_num+1);
|
||||||
}else{
|
}else{
|
||||||
h=plot1D_hists.at(hist_num);
|
h=plot1D_hists.at(hist_num);
|
||||||
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
|
if(anglePlot)
|
||||||
|
h->SetData(histNBins,histXAngleAxis,histYAngleAxis);
|
||||||
|
else
|
||||||
|
h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
|
||||||
}
|
}
|
||||||
h->SetDotStyle(plotDotted);
|
//h->setSymbol(*noSymbol);
|
||||||
|
//h->SetDotStyle(plotDotted);
|
||||||
|
SetStyle(h);
|
||||||
h->setTitle(GetHistTitle(hist_num));
|
h->setTitle(GetHistTitle(hist_num));
|
||||||
h->Attach(plot1D);
|
h->Attach(plot1D);
|
||||||
}
|
}
|
||||||
@ -701,7 +752,12 @@ void qDrawPlot::ClonePlot(){
|
|||||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||||
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) winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle);
|
if(running){
|
||||||
|
if(anglePlot)
|
||||||
|
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAxis,histYAxis,histTitle);
|
||||||
|
else
|
||||||
|
winClone[i]->SetCloneHists((int)nHists,histNBins,histXAngleAxis,histYAngleAxis,histTitle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
plot2D = new SlsQt2DPlotLayout(boxPlot);
|
||||||
|
@ -341,11 +341,11 @@ void qScanWidget::SetMode(int mode){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//set the group box widgets
|
//set the group box widgets and also calls setscan
|
||||||
EnableSizeWidgets();
|
EnableSizeWidgets();
|
||||||
|
|
||||||
//set the mode
|
//set the mode if mode = none
|
||||||
/*SetScan(mode);*/
|
if(!mode) SetScan(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -273,17 +273,20 @@ void qTabActions::SetPosition(){
|
|||||||
lblPosList->setPalette(normal);
|
lblPosList->setPalette(normal);
|
||||||
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
lblPosList->setToolTip("<nobr>Enter the positions at which the detector should be moved.</nobr><br>"
|
||||||
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr>");
|
"<nobr>Number of entries is restricted to <b>Number of Positions</b> field.</nobr>");
|
||||||
//delete existing positions
|
|
||||||
if (positions) delete [] positions;
|
|
||||||
positions=new double[numPos];
|
|
||||||
//copying the list
|
|
||||||
for(int i=0;i<numPos;i++)
|
|
||||||
positions[i] = comboPos->itemText(i).toDouble();
|
|
||||||
//setting the list and catching error
|
|
||||||
if(myDet->setPositions(numPos,positions)!=numPos)
|
|
||||||
qDefs::WarningMessage("The positions list was not set for some reason.","Actions");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//delete existing positions
|
||||||
|
if (positions) delete [] positions;
|
||||||
|
positions=new double[comboPos->count()];
|
||||||
|
//copying the list
|
||||||
|
for(int i=0;i<comboPos->count();i++)
|
||||||
|
positions[i] = comboPos->itemText(i).toDouble();
|
||||||
|
//setting the list and catching error
|
||||||
|
if(myDet->setPositions(comboPos->count(),positions)!=comboPos->count())
|
||||||
|
qDefs::WarningMessage("The positions list was not set for some reason.","Actions");
|
||||||
|
|
||||||
|
|
||||||
|
emit EnableScanBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -323,6 +326,7 @@ void qTabActions::EnablePositions(bool enable){
|
|||||||
if(btnExpand[NumPositions]->text()=="-")
|
if(btnExpand[NumPositions]->text()=="-")
|
||||||
Expand(group->button(NumPositions));
|
Expand(group->button(NumPositions));
|
||||||
comboPos->clear();
|
comboPos->clear();
|
||||||
|
cout<<"Number of Positions set to :"<<myDet->getPositions()<<endl;
|
||||||
lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette());
|
lblName[NumPositions]->setPalette(lblName[NumPositions-1]->palette());
|
||||||
lblName[NumPositions]->setEnabled(false);
|
lblName[NumPositions]->setEnabled(false);
|
||||||
btnExpand[NumPositions]->setEnabled(false);
|
btnExpand[NumPositions]->setEnabled(false);
|
||||||
@ -345,7 +349,7 @@ void qTabActions::Refresh(){
|
|||||||
//delete existing positions
|
//delete existing positions
|
||||||
if (positions) delete [] positions;
|
if (positions) delete [] positions;
|
||||||
//get number of positions
|
//get number of positions
|
||||||
int numPos=myDet->getPositions();
|
int numPos=myDet->getPositions();cout<<"numPOs:"<<numPos<<endl;
|
||||||
comboPos->setMaxCount(numPos);
|
comboPos->setMaxCount(numPos);
|
||||||
|
|
||||||
//set the number of positions in the gui
|
//set the number of positions in the gui
|
||||||
|
@ -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.","Data Output");
|
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");
|
||||||
chkAngular->setChecked(false);
|
chkAngular->setChecked(false);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
@ -197,7 +197,8 @@ void qTabPlot::Initialization(){
|
|||||||
// 1D Plot box
|
// 1D Plot box
|
||||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
||||||
connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int)));
|
connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int)));
|
||||||
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetDottedPlot(bool)));
|
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetMarkers(bool)));
|
||||||
|
connect(chkLines, SIGNAL(toggled(bool)), myPlot, SLOT(SetLines(bool)));
|
||||||
// 2D Plot box
|
// 2D Plot box
|
||||||
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
|
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
|
||||||
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
|
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
|
||||||
@ -500,8 +501,14 @@ void qTabPlot::EnableScanBox(){
|
|||||||
|
|
||||||
//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
|
||||||
|
bool positionsExist = myDet->getPositions();
|
||||||
|
|
||||||
//only now enable/disable
|
//only now enable/disable
|
||||||
boxScan->setEnabled(mode0||mode1);
|
boxScan->setEnabled((mode0||mode1)&&(!positionsExist));
|
||||||
|
|
||||||
|
|
||||||
//if there are scan
|
//if there are scan
|
||||||
if(boxScan->isEnabled()){
|
if(boxScan->isEnabled()){
|
||||||
@ -534,6 +541,12 @@ void qTabPlot::EnableScanBox(){
|
|||||||
}
|
}
|
||||||
else EnablingNthFrameFunction(enableNFrame);
|
else EnablingNthFrameFunction(enableNFrame);
|
||||||
|
|
||||||
|
//positions
|
||||||
|
if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);
|
||||||
|
chkSuperimpose->setEnabled(!positionsExist);
|
||||||
|
boxFrequency->setEnabled(!positionsExist);
|
||||||
|
myPlot->EnableAnglePlot(positionsExist);
|
||||||
|
|
||||||
|
|
||||||
//sets the scan argument
|
//sets the scan argument
|
||||||
SetScanArgument();
|
SetScanArgument();
|
||||||
@ -568,22 +581,14 @@ void qTabPlot::EnablingNthFrameFunction(bool enable){
|
|||||||
void qTabPlot::SetScanArgument(){
|
void qTabPlot::SetScanArgument(){
|
||||||
|
|
||||||
//as default from histogram and default titles are set here if scanbox is disabled
|
//as default from histogram and default titles are set here if scanbox is disabled
|
||||||
Select1DPlot(isOrginallyOneD);
|
dispTitle->setText(defaultPlotTitle);
|
||||||
|
myPlot->SetPlotTitle(defaultPlotTitle);
|
||||||
//if scans
|
if(isOrginallyOneD){
|
||||||
if(boxScan->isEnabled()){
|
|
||||||
//setting the title according to the scans
|
|
||||||
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
|
|
||||||
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
|
||||||
dispTitle->setText(mainTitle);
|
|
||||||
myPlot->SetPlotTitle(mainTitle);
|
|
||||||
}else{
|
|
||||||
dispTitle->setText(defaultPlotTitle);
|
|
||||||
myPlot->SetPlotTitle(defaultPlotTitle);
|
|
||||||
dispXAxis->setText(defaultHistXAxisTitle);
|
dispXAxis->setText(defaultHistXAxisTitle);
|
||||||
dispYAxis->setText(defaultHistYAxisTitle);
|
dispYAxis->setText(defaultHistYAxisTitle);
|
||||||
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
||||||
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
||||||
|
}else{
|
||||||
dispXAxis->setText(defaultImageXAxisTitle);
|
dispXAxis->setText(defaultImageXAxisTitle);
|
||||||
dispYAxis->setText(defaultImageYAxisTitle);
|
dispYAxis->setText(defaultImageYAxisTitle);
|
||||||
dispZAxis->setText(defaultImageZAxisTitle);
|
dispZAxis->setText(defaultImageZAxisTitle);
|
||||||
@ -591,6 +596,31 @@ void qTabPlot::SetScanArgument(){
|
|||||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
||||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||||
}
|
}
|
||||||
|
Select1DPlot(isOrginallyOneD);
|
||||||
|
|
||||||
|
//if scans(1D or 2D)
|
||||||
|
if(boxScan->isEnabled()){
|
||||||
|
//setting the title according to the scans
|
||||||
|
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
|
||||||
|
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||||
|
dispTitle->setText(mainTitle);
|
||||||
|
myPlot->SetPlotTitle(mainTitle);
|
||||||
|
Select1DPlot(isOrginallyOneD);
|
||||||
|
|
||||||
|
}//angles (1D)
|
||||||
|
else if(myDet->getPositions()){
|
||||||
|
//if scan, change title
|
||||||
|
if((myDet->getScanMode(0))||(myDet->getScanMode(1))){
|
||||||
|
QString mainTitle = QString(" Level 0 : ") + modeNames[myDet->getScanMode(0)] +
|
||||||
|
QString(" | Level 1 : ") + modeNames[myDet->getScanMode(1)] + QString("");
|
||||||
|
dispTitle->setText(mainTitle);
|
||||||
|
myPlot->SetPlotTitle(mainTitle);
|
||||||
|
}
|
||||||
|
dispXAxis->setText("Angles");
|
||||||
|
myPlot->SetHistXAxisTitle("Angles");
|
||||||
|
Select1DPlot(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//for 2d
|
//for 2d
|
||||||
if((boxScan->isEnabled())&&(boxScan->isChecked())){
|
if((boxScan->isEnabled())&&(boxScan->isChecked())){
|
||||||
|
Reference in New Issue
Block a user