diff --git a/slsDetectorGui/forms/form_tab_plot.ui b/slsDetectorGui/forms/form_tab_plot.ui
index 47791aba3..6376da9ce 100644
--- a/slsDetectorGui/forms/form_tab_plot.ui
+++ b/slsDetectorGui/forms/form_tab_plot.ui
@@ -99,7 +99,7 @@
- 4
+ 5
@@ -186,7 +186,7 @@
-
+
@@ -294,7 +294,7 @@
-
+
@@ -580,6 +580,167 @@ Displays minimum, maximum and sum of values for each plot.
+
+
+ true
+
+
+
+
+ 25
+ 5
+ 311
+ 26
+
+
+
+
+ 1
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ from
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 0
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ to
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 10000
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ size
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 1000
+
+
+
+
+
+
@@ -610,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot.
- 0
+ 6
@@ -782,7 +943,7 @@ Displays minimum, maximum and sum of values for each plot.
-
+
@@ -890,7 +1051,7 @@ Displays minimum, maximum and sum of values for each plot.
-
+
@@ -1186,6 +1347,167 @@ Displays minimum, maximum and sum of values for each plot.
+
+
+ true
+
+
+
+
+ 25
+ 5
+ 311
+ 26
+
+
+
+
+ 1
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ from
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 0
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ to
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 10000
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+ size
+
+
+
+ -
+
+
+ true
+
+
+
+ 0
+ 0
+
+
+
+
+ 16777215
+ 16777215
+
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 0
+
+
+ 16777215
+
+
+ 1000
+
+
+
+
+
+
@@ -1336,7 +1658,7 @@ Displays minimum, maximum and sum of values for each plot.
10
20
- 341
+ 342
26
@@ -1902,7 +2224,7 @@ Displays minimum, maximum and sum of values for each plot.
-
- false
+ true
@@ -2443,6 +2765,16 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
true
+ box1D
+ box2D
+ boxSave
+ boxScan
+ boxPlotAxis
+ groupBox_3
+ boxFrequency
+ boxSnapshot
+ btnRight
+ btnLeft
radioNoPlot
diff --git a/slsDetectorGui/include/qDrawPlot.h b/slsDetectorGui/include/qDrawPlot.h
index df010adac..4f2459f64 100644
--- a/slsDetectorGui/include/qDrawPlot.h
+++ b/slsDetectorGui/include/qDrawPlot.h
@@ -25,6 +25,14 @@ class qCloneWidget;
#include
#include "qwt_symbol.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
/** C++ Include Headers */
@@ -134,6 +142,9 @@ public:
/** set binary range */
void SetBinary(bool enable, int from=0, int to=0);
+ /** Enable/Disable Histogram */
+ void SetHistogram(bool enable,int min=0, int max=0, int size=0){histogram = enable;histFrom=min;histTo=max;histSize=size;};
+
public slots:
/** To select 1D or 2D plot
@param i is 1 for 1D, else 2D plot */
@@ -545,6 +556,17 @@ QLabel *lblSumDisp;
bool displayStatistics;
+/* histogram */
+bool histogram;
+int histFrom;
+int histTo;
+int histSize;
+QwtPlotGrid *grid;
+QwtPlotHistogram *plotHistogram;
+QVector histogramSamples;
+
+
+
signals:
void UpdatingPlotFinished();
diff --git a/slsDetectorGui/include/qTabPlot.h b/slsDetectorGui/include/qTabPlot.h
index 08390742f..dd4f65e75 100644
--- a/slsDetectorGui/include/qTabPlot.h
+++ b/slsDetectorGui/include/qTabPlot.h
@@ -70,6 +70,7 @@ private:
QDoubleSpinBox *spinTimeGap;
QComboBox *comboTimeGapUnit;
QButtonGroup *btnGroupScan;
+ QButtonGroup *btnGroupPlotType;
/** some Default Values */
static QString defaultPlotTitle;
@@ -97,12 +98,6 @@ private:
*/
void Initialization();
- /** This enabled/disables the nth frame from frequency plot
- * @param enable enable/disable
- */
- void EnablingNthFrameFunction(bool enable);
-
-
public slots:
/** Set frequency between plots*/
@@ -110,7 +105,7 @@ public slots:
/** Enable Scan box
*/
- void EnableScanBox();
+ void EnableScanBox(bool Histo=false);
/** Update all ranges, interpolate etc after cloning
*/
diff --git a/slsDetectorGui/include/svnInfoGui.h b/slsDetectorGui/include/svnInfoGui.h
index 906073b92..7d40dd535 100644
--- a/slsDetectorGui/include/svnInfoGui.h
+++ b/slsDetectorGui/include/svnInfoGui.h
@@ -2,10 +2,10 @@
#define SVNURL "file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui"
//#define SVNREPPATH ""
#define SVNREPUUID "af1100a4-978c-4157-bff7-07162d2ba061"
-//#define SVNREV 0x226
+//#define SVNREV 0x229
//#define SVNKIND ""
//#define SVNSCHED ""
#define SVNAUTH "l_maliakal_d"
-#define SVNREV 0x226
-#define SVNDATE 0x20130813
+#define SVNREV 0x229
+#define SVNDATE 0x20130816
//
diff --git a/slsDetectorGui/src/qDrawPlot.cpp b/slsDetectorGui/src/qDrawPlot.cpp
index d071fb1d3..0cd468372 100644
--- a/slsDetectorGui/src/qDrawPlot.cpp
+++ b/slsDetectorGui/src/qDrawPlot.cpp
@@ -9,7 +9,6 @@
#include "qCloneWidget.h"
#include "slsDetector.h"
#include"fileIOStatic.h"
-
// Project Class Headers
#include "slsDetector.h"
#include "multiSlsDetector.h"
@@ -19,6 +18,8 @@
#include
#include
#include
+//#include "qwt_double_interval.h"
+#include "qwt_series_data.h"
// C++ Include Headers
#include
#include
@@ -195,6 +196,20 @@ void qDrawPlot::SetupWidgetWindow(){
binaryFrom = 0;
binaryTo = 0;
+ //histogram
+ histogram = false;
+ histFrom = 0;
+ histTo = 0;
+ histSize = 0;
+ grid = new QwtPlotGrid;
+ grid->enableXMin(true);
+ grid->enableYMin(true);
+ grid->setMajPen(QPen(Qt::black, 0, Qt::DotLine));
+ grid->setMinPen(QPen(Qt::gray, 0 , Qt::DotLine));
+ plotHistogram = new QwtPlotHistogram();
+ plotHistogram->setStyle(QwtPlotHistogram::Columns);
+
+
//widget related initialization
@@ -464,9 +479,10 @@ bool qDrawPlot::StartOrStopThread(bool start){
//refixing all the min and max for all scans
if (scanArgument == qDefs::None);
- else
+ else{
+ plot2D->GetPlot()->UnZoom();
plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel);
-
+ }
cout << "Starting new acquisition thread ...." << endl;
// Start acquiring data from server
@@ -498,11 +514,6 @@ void qDrawPlot::SetScanArgument(int scanArg){
if(plot_in_scope==1) Clear1DPlot();
- maxPixelsY = 0;
- minPixelsY = 0;
- nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X);
- nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y);
-
// Number of Exposures - must be calculated here to get npixelsy for allframes/frameindex scans
int numFrames = (isFrameEnabled)*((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1));
int numTriggers = (isTriggerEnabled)*((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1));
@@ -519,6 +530,12 @@ void qDrawPlot::SetScanArgument(int scanArg){
if(anglePlot) number_of_exposures = numScan0 * numScan1;// * numPos;
cout << "\tNumber of Exposures Per Measurement:" << number_of_exposures << endl;
+
+ maxPixelsY = 0;
+ minPixelsY = 0;
+ nPixelsX = myDet->getTotalNumberOfChannels(slsDetectorDefs::X);
+ nPixelsY = myDet->getTotalNumberOfChannels(slsDetectorDefs::Y);
+
//cannot do this in between measurements , so update instantly
if(scanArgument==qDefs::Level0){
//no need to check if numsteps=0,cuz otherwise this mode wont be set in plot tab
@@ -569,6 +586,30 @@ void qDrawPlot::SetScanArgument(int scanArg){
lastImageArray[py*nPixelsX+px] = 0;
+ //histogram
+ if(histogram){
+ histogramSamples.resize(0);
+ int iloop = 0;
+ int min = iloop*histSize + histFrom;
+ int max = (iloop+1)*histSize + histFrom;
+ while(min < histTo){
+ histogramSamples.resize(iloop+1);
+ histogramSamples[iloop].interval.setInterval(min,max);
+ histogramSamples[iloop].value = 0;
+ iloop++;
+ min = max;
+ max = (iloop+1)*histSize + histFrom;
+ if(max>histTo)
+ max = histTo;
+ }
+ //print values
+ cout << "Histogram Intervals:" << endl;
+ for(int j=0;jvalues[px];
UnlockLastImageArray();
@@ -885,54 +924,80 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
if(plot_in_scope==1){
// Titles
histTitle[0] = temp_title;
- // Persistency
- if(currentPersistency < persistency)currentPersistency++;
- else currentPersistency=persistency;
- nHists = currentPersistency+1;
- histNBins = nPixelsX;
- // copy data
- for(int i=currentPersistency;i>0;i--)
- memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
-
- //recalculating pedestal
- if(startPedestalCal){
- //start adding frames to get to the pedestal value
- if(pedestalCountvalues[px];
- memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
- pedestalCount++;
- }
- //calculate the pedestal value
- if(pedestalCount==NUM_PEDESTAL_FRAMES){
- cout << "Pedestal Calculated" << endl;
- for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double));
+ //histogram
+ if(histogram){
resetAccumulate = false;
+ lastImageNumber= currentFrame+1;
+
+ int numValues = nPixelsX;
+ if(originally2D)
+ numValues = nPixelsX*nPixelsY;
+
+ for(int i=0;ivalues[i] <= histFrom) || (data->values[i] >= histTo))
+ continue;
+ //check for intervals, increment if validates
+ for(int j=0;jvalues[i]))
+ histogramSamples[j].value += 1;
+
+ }
+ }
+
}
- //pedestal or accumulate
+ //not histogram
else{
- for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){
- if(accumulate)
- histYAxis[0][px] += data->values[px];
- else
- histYAxis[0][px] = data->values[px];
- if(pedestal)
- histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]);
- if(binary) {
- if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo))
- histYAxis[0][px] = 1;
+ // Persistency
+ if(currentPersistency < persistency)currentPersistency++;
+ else currentPersistency=persistency;
+ nHists = currentPersistency+1;
+ histNBins = nPixelsX;
+
+ // copy data
+ for(int i=currentPersistency;i>0;i--)
+ memcpy(histYAxis[i],histYAxis[i-1],nPixelsX*sizeof(double));
+
+ //recalculating pedestal
+ if(startPedestalCal){
+ //start adding frames to get to the pedestal value
+ if(pedestalCountvalues[px];
+ memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
+ pedestalCount++;
+ }
+ //calculate the pedestal value
+ if(pedestalCount==NUM_PEDESTAL_FRAMES){
+ cout << "Pedestal Calculated" << endl;
+ for(unsigned int px=0;pxvalues,nPixelsX*sizeof(double));
+ resetAccumulate = false;
+ }
+ //pedestal or accumulate
+ else{
+ for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++){
+ if(accumulate)
+ histYAxis[0][px] += data->values[px];
else
- histYAxis[0][px] = 0;
+ histYAxis[0][px] = data->values[px];
+ if(pedestal)
+ histYAxis[0][px] = histYAxis[0][px] - (pedestalVals[px]);
+ if(binary) {
+ if ((histYAxis[0][px] >= binaryFrom) && (histYAxis[0][px] <= binaryTo))
+ histYAxis[0][px] = 1;
+ else
+ histYAxis[0][px] = 0;
+ }
}
}
}
@@ -955,7 +1020,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
cout << "Pedestal Calculated" << endl;
for(unsigned int px=0;px<(nPixelsX*nPixelsY);px++)
tempPedestalVals[px] = tempPedestalVals[px]/(double)NUM_PEDESTAL_FRAMES;
-
memcpy(pedestalVals,tempPedestalVals,nPixelsX*nPixelsY*sizeof(double));
startPedestalCal = 0;
}
@@ -1012,9 +1076,9 @@ int qDrawPlot::GetAcquisitionFinishedCallBack(double currentProgress,int detecto
int qDrawPlot::AcquisitionFinished(double currentProgress, int detectorStatus){
-//#ifdef VERBOSE
+#ifdef VERBOSE
cout << "\nEntering Acquisition Finished with status " ;
-//#endif
+#endif
QString status = QString(slsDetectorBase::runStatusType(slsDetectorDefs::runStatus(detectorStatus)).c_str());
#ifdef VERBOSE
cout << status.toAscii().constData() << " and progress " << currentProgress << endl;
@@ -1078,9 +1142,9 @@ int qDrawPlot::GetMeasurementFinishedCallBack(int currentMeasurementIndex, int f
int qDrawPlot::MeasurementFinished(int currentMeasurementIndex, int fileIndex){
-//#ifdef VERBOSE
+#ifdef VERBOSE
cout << "Entering Measurement Finished with currentMeasurement " << currentMeasurementIndex << " and fileIndex " << fileIndex << endl;
-//#endif
+#endif
//to make sure it plots the last frame before setting lastimagearray all to 0
//if(plot_in_scope==2)
usleep(500000);
@@ -1130,8 +1194,10 @@ void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
void qDrawPlot::Clear1DPlot(){
- for(QVector::iterator h = plot1D_hists.begin();
- h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot
+ for(QVector::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++)
+ (*h)->Detach(plot1D);
+
+ plotHistogram->detach();
}
@@ -1153,31 +1219,46 @@ void qDrawPlot::UpdatePlot(){
if(plot_in_scope==1){
if(lastImageNumber){
#ifdef VERYVERBOSE
- cout << "*Last Image Number:" << lastImageNumber << endl;
+ cout << "Last Image Number:" << lastImageNumber << endl;
#endif
if(histNBins){
Clear1DPlot();
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
plot1D->SetYTitle(histYAxisTitle.toAscii().constData());
- for(int hist_num=0;hist_num<(int)nHists;hist_num++){
- SlsQtH1D* h;
- if(hist_num+1>plot1D_hists.size()){
- if(anglePlot)
- plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis));
- else
- plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num)));
- h->SetLineColor(hist_num+1);
- }else{
- h=plot1D_hists.at(hist_num);
- if(anglePlot)
- h->SetData(histNBins,histXAngleAxis,histYAngleAxis);
- else
- h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
- }
- SetStyle(h);
+
+ //histogram
+ if(histogram){
+ plotHistogram->setData(new QwtIntervalSeriesData(histogramSamples));
+ plotHistogram->setPen(QPen(Qt::red));
+ plotHistogram->setBrush(QBrush(Qt::red,Qt::Dense4Pattern));//Qt::SolidPattern
histFrameIndexTitle->setText(GetHistTitle(0));
- //h->setTitle(GetHistTitle(hist_num));
- h->Attach(plot1D);
+ plotHistogram->attach(plot1D);
+ plot1D->SetZoomBase(plotHistogram->boundingRect().left(),0,
+ plotHistogram->boundingRect().width(),plotHistogram->boundingRect().height());
+ }
+ //not histogram
+ else{
+ for(int hist_num=0;hist_num<(int)nHists;hist_num++){
+ SlsQtH1D* h;
+ if(hist_num+1>plot1D_hists.size()){
+ if(anglePlot)
+ plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAngleAxis,histYAngleAxis));
+ else
+ plot1D_hists.append(h=new SlsQtH1D("",histNBins,histXAxis,GetHistYAxis(hist_num)));
+ h->SetLineColor(hist_num+1);
+ }else{
+ h=plot1D_hists.at(hist_num);
+ if(anglePlot)
+ h->SetData(histNBins,histXAngleAxis,histYAngleAxis);
+ else
+ h->SetData(histNBins,histXAxis,GetHistYAxis(hist_num));
+ }
+ SetStyle(h);
+ histFrameIndexTitle->setText(GetHistTitle(0));
+ //h->setTitle(GetHistTitle(hist_num));
+ h->Attach(plot1D);
+ }
+ plot1D->Update();
}
// update range if required
if(XYRangeChanged){
@@ -1209,13 +1290,15 @@ void qDrawPlot::UpdatePlot(){
if(lastImageArray){
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
nPixelsX>0&&nPixelsY>0){
- //plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
plot2D->SetZTitle(imageZAxisTitle);
- plot2D->UpdateNKeepSetRangeIfSet(); //this will keep a "set" z range, and call Plot()->Update();
+ plot2D->UpdateNKeepSetRangeIfSet(); //keep a "set" z range, and call Update();
+ //to solve the problems regarding zooming out and zoom in
+
+ //plot2D->GetPlot()->SetZoom(-0.5,startPixel,nPixelsX,endPixel-startPixel);
}
// update range if required
if(XYRangeChanged){
@@ -1227,6 +1310,7 @@ void qDrawPlot::UpdatePlot(){
plot2D->GetPlot()->SetYMinMax(XYRangeValues[qDefs::YMINIMUM],XYRangeValues[qDefs::YMAXIMUM]);
XYRangeChanged = false;
}
+ plot2D->GetPlot()->Update();
//Display Statistics
if(displayStatistics){
double min=0,max=0,sum=0;
@@ -1238,16 +1322,14 @@ void qDrawPlot::UpdatePlot(){
if(saveAll) SavePlotAutomatic();
}
}
- //}
last_plot_number=lastImageNumber;
-
//set plot title
boxPlot->setTitle(plotTitle);
}
UnlockLastImageArray();
}
- //if acqq stopped before this line, it continues from here, shouldnt restart plotting timer
+ //if acq stopped before this line, it continues from here, shouldnt restart plotting timer
if(!stop_signal){
if(!frameFactor)
plot_update_timer->start((int)timerValue);
diff --git a/slsDetectorGui/src/qTabPlot.cpp b/slsDetectorGui/src/qTabPlot.cpp
index baafa370b..e51eee995 100644
--- a/slsDetectorGui/src/qTabPlot.cpp
+++ b/slsDetectorGui/src/qTabPlot.cpp
@@ -44,7 +44,8 @@ qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot
spinNthFrame(0),
spinTimeGap(0),
comboTimeGapUnit(0),
- btnGroupScan(0){
+ btnGroupScan(0),
+ btnGroupPlotType(0){
setupUi(this);
SetupWidgetWindow();
Initialization();
@@ -77,6 +78,12 @@ void qTabPlot::SetupWidgetWindow(){
btnGroupScan->addButton(radioFileIndex,2);
btnGroupScan->addButton(radioAllFrames,3);
+//plot type
+ btnGroupPlotType = new QButtonGroup(this);
+ btnGroupPlotType->addButton(radioNoPlot,0);
+ btnGroupPlotType->addButton(radioDataGraph,1);
+ btnGroupPlotType->addButton(radioHistogram,2);
+
// Plot Axis
dispTitle->setEnabled(false);
dispXAxis->setEnabled(false);
@@ -146,19 +153,15 @@ void qTabPlot::SetupWidgetWindow(){
switch(myDet->getDetectorsType()){
case slsDetectorDefs::MYTHEN:
isOriginallyOneD = true;
- chkPedestal->setEnabled(false);
- btnRecalPedestal->setEnabled(false);
- chkPedestal_2->setEnabled(false);
- btnRecalPedestal_2->setEnabled(false);
+ pagePedestal->setEnabled(false);
+ pagePedestal_2->setEnabled(false);
chkBinary->setEnabled(false);
chkBinary_2->setEnabled(false);
break;
case slsDetectorDefs::EIGER:
isOriginallyOneD = false;
- chkPedestal->setEnabled(false);
- btnRecalPedestal->setEnabled(false);
- chkPedestal_2->setEnabled(false);
- btnRecalPedestal_2->setEnabled(false);
+ pagePedestal->setEnabled(false);
+ pagePedestal_2->setEnabled(false);
chkBinary->setEnabled(false);
chkBinary_2->setEnabled(false);
break;
@@ -231,6 +234,12 @@ void qTabPlot::SetPlotOptionsLeftPage(){
void qTabPlot::Select1DPlot(bool b){
+#ifdef VERBOSE
+ if(b)
+ cout << "Selecting 1D Plot" << endl;
+ else
+ cout << "Selecting 2D Plot" << endl;
+#endif
isOneD = b;
lblFrom->setEnabled(false);
lblTo->setEnabled(false);
@@ -263,11 +272,9 @@ void qTabPlot::Select1DPlot(bool b){
void qTabPlot::Initialization(){
// Plot arguments box
- connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
+ connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
// Scan box
- connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
+ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
// Snapshot box
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
@@ -350,6 +357,12 @@ void qTabPlot::Initialization(){
void qTabPlot::EnablePersistency(bool enable){
+#ifdef VERBOSE
+ if(enable)
+ cout << "Enabling Persistency" << endl;
+ else
+ cout << "Disabling Persistency" << endl;
+#endif
lblPersistency->setEnabled(enable);
spinPersistency->setEnabled(enable);
if(enable) myPlot->SetPersistency(spinPersistency->value());
@@ -362,6 +375,9 @@ void qTabPlot::EnablePersistency(bool enable){
void qTabPlot::SetTitles(){
+#ifdef VERBOSE
+ cout << "Setting Plot Titles" << endl;
+#endif
// Plot Title
if(dispTitle->isEnabled())
myPlot->SetPlotTitlePrefix(dispTitle->text());
@@ -512,12 +528,8 @@ void qTabPlot::SetPlot(){
boxFrequency->setEnabled(false);
boxPlotAxis->setEnabled(false);
boxScan->setEnabled(false);
- }else {
- if(radioDataGraph->isChecked())
- cout << " - DataGraph" << endl;
- else
- cout << " - Histogram" << endl;
-
+ }else if(radioDataGraph->isChecked()){
+ cout << " - DataGraph" << endl;
myPlot->EnablePlot(true);
Select1DPlot(isOriginallyOneD);
boxSnapshot->setEnabled(true);
@@ -527,19 +539,40 @@ void qTabPlot::SetPlot(){
if(!myPlot->isRunning())
EnableScanBox();
}
+ else{
+ //histogram and 2d scans dont work
+ if(boxScan->isChecked()){
+ qDefs::Message(qDefs::WARNING,"Histogram cannot be used together with 2D Scan Plots.
"
+ "Uncheck 2D Scan plots to plot Histograms", "qTabPlot::SetPlot");
+ radioDataGraph->setChecked(true);
+ return;
+ }
+
+ cout << " - Histogram" << endl;
+ myPlot->EnablePlot(true);
+ Select1DPlot(isOriginallyOneD);
+ boxSnapshot->setEnabled(true);
+ boxSave->setEnabled(true);
+ boxFrequency->setEnabled(true);
+ boxPlotAxis->setEnabled(true);
+ if(!myPlot->isRunning())
+ EnableScanBox(true);
+ qDefs::Message(qDefs::INFORMATION,"Please check the Plot Histogram Options below "
+ "before Starting Acquitision","qTabPlot::SetPlot");
+ }
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetFrequency(){
-
+#ifdef VERBOSE
+ cout << "Setting Plot Interval Frequency" << endl;
+#endif
disconnect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
disconnect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-
-
double timeMS,acqPeriodMS;
double minPlotTimer = myPlot->GetMinimumPlotTimer();
char cMin[200];
@@ -665,80 +698,89 @@ void qTabPlot::SetFrequency(){
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-
qDefs::checkErrorMessage(myDet,"qTabPlot::SetFrequency");
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
-void qTabPlot::EnableScanBox(){
+void qTabPlot::EnableScanBox(bool Histo){
#ifdef VERBOSE
- cout << "Entering Enable Scan Box()" << endl;
+ cout << "Entering Enable Scan Box, Histo:" << Histo << endl;
#endif
- disconnect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- disconnect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- disconnect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- disconnect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox()));
+ disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
+ disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
int mode0 = myDet->getScanMode(0);
int mode1 = myDet->getScanMode(1);
int ang;
bool angConvert = myDet->getAngularConversion(ang);
- //enabling it after it was plotted
radioDataGraph->setEnabled(true);
-
+ radioHistogram->setEnabled(true);
+ chkSuperimpose->setEnabled(true);
+ pageAccumulate->setEnabled(true);
+ pageAccumulate_2->setEnabled(true);
+ if((myDet->getDetectorsType() == slsDetectorDefs::GOTTHARD) || (myDet->getDetectorsType() == slsDetectorDefs::MOENCH)){
+ pagePedestal->setEnabled(true);
+ pagePedestal_2->setEnabled(true);
+ chkBinary->setEnabled(true);
+ chkBinary_2->setEnabled(true);
+ }
//if angle plot or originally 2d, uncheck and disable scanbox
if ((angConvert) || (!isOriginallyOneD)){
boxScan->setChecked(false);
boxScan->setEnabled(false);
- //disable histogram
- radioHistogram->setEnabled(false);
- if(radioHistogram->isChecked())
- radioDataGraph->setChecked(true);
- //angle only
- if((angConvert)&&(chkSuperimpose->isChecked()))
- chkSuperimpose->setChecked(false);
- chkSuperimpose->setEnabled(!angConvert);
+
+ //persistency, accumulate, pedestal, binary
+ if(angConvert){
+ if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false);
+ if(chkPedestal->isChecked()) chkPedestal->setChecked(false);
+ if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false);
+ if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false);
+ if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false);
+ if(chkBinary->isChecked()) chkBinary->setChecked(false);
+ if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false);
+ pagePedestal->setEnabled(false);
+ pagePedestal_2->setEnabled(false);
+ chkBinary->setEnabled(false);
+ chkBinary_2->setEnabled(false);
+ pageAccumulate->setEnabled(false);
+ pageAccumulate_2->setEnabled(false);
+ }
+
+
+
myPlot->EnableAnglePlot(angConvert);
- if(angConvert)
+ if(angConvert){
boxScan->setToolTip("Only 1D Plots enabled for Angle Plots");
+ //disable histogram
+ if(radioHistogram->isChecked()){
+ radioDataGraph->setChecked(true);
+ radioHistogram->setEnabled(false);
+ }
+ }
}
//originally1d && not angle plot
else{
boxScan->setToolTip("");
boxScan->setEnabled(true);
- if(mode0 || mode1)
- boxScan->setChecked(true);
-
- //still 1d
- if(!boxScan->isChecked()){
- radioHistogram->setEnabled(true);
- /*if(radioHistogram->isChecked())
- EnablingNthFrameFunction(false);//just this
- else EnablingNthFrameFunction(true); */
- }
+ /*if(mode0 || mode1)
+ boxScan->setChecked(true);*/
//2d enabled with boxscan
- else{
+ if(boxScan->isChecked()){
+ //read every frame
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-
comboFrequency->setCurrentIndex(1);
spinNthFrame->setValue(1);
SetFrequency();
+ connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
+ connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
- //disable histogram for 2d
- radioHistogram->setEnabled(false);
- if(radioHistogram->isChecked())
- radioDataGraph->setChecked(true);
-
- /*//make sure nth frame frequency plot is disabled
- EnablingNthFrameFunction(false);
- */
//enabling options
radioFileIndex->setEnabled(mode0||mode1);
if(mode0 && mode1){
@@ -751,119 +793,57 @@ void qTabPlot::EnableScanBox(){
//default is allframes if checked button is disabled
if(!btnGroupScan->checkedButton()->isEnabled())
radioAllFrames->setChecked(true);
-
- connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
- connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
-
-
}
}
- connect(radioNoPlot, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
- connect(boxScan, SIGNAL(toggled(bool)),this, SLOT(EnableScanBox()));
-/*
- int mode0 = myDet->getScanMode(0);
- int mode1 = myDet->getScanMode(1);
-
- //if it was checked before or disabled before, it remembers to check it again
- bool checkedBefore = boxScan->isChecked();//||(!boxScan->isEnabled()));
-
- int ang;
- //none of these scan plotting options make sense if positions exists
- bool positionsExist = myDet->getAngularConversion(ang);//myDet->getPositions();
-
- qDefs::checkErrorMessage(myDet,"qTabPlot::EnableScanBox");
-
- //only now enable/disable
- boxScan->setEnabled((mode0||mode1)&&(!positionsExist));
-
- //after plotting, enable datagraph if it was disabled while plotting(refresh)
- radioDataGraph->setEnabled(true);
-
-
- //if there are scan
- if(boxScan->isEnabled()){
- //disable histogram
- if(radioHistogram->isChecked())
+ //histogram
+ if(radioHistogram->isChecked()){
+ //switch back to datagraph
+ if(!Histo)
radioDataGraph->setChecked(true);
- radioHistogram->setEnabled(false);
- //make sure nth frame frequency plot is disabled
- EnablingNthFrameFunction(false);
+ pageHistogram->setEnabled(true);
+ pageHistogram_2->setEnabled(true);
+ stackedWidget->setCurrentIndex(stackedWidget->count()-1);
+ stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
+ box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
+ box2D->setTitle(QString("2D Plot Options %1 - Histogram").arg(stackedWidget_2->currentIndex()+1));
- //if 2d is chosen or not for scan
- if(boxScan->isChecked()){
+ if(chkSuperimpose->isChecked()) chkSuperimpose->setChecked(false);
+ if(chkPedestal->isChecked()) chkPedestal->setChecked(false);
+ if(chkPedestal_2->isChecked()) chkPedestal_2->setChecked(false);
+ if(chkAccumulate->isChecked()) chkAccumulate->setChecked(false);
+ if(chkAccumulate_2->isChecked())chkAccumulate_2->setChecked(false);
+ if(chkBinary->isChecked()) chkBinary->setChecked(false);
+ if(chkBinary_2->isChecked()) chkBinary_2->setChecked(false);
+ pagePedestal->setEnabled(false);
+ pagePedestal_2->setEnabled(false);
+ chkBinary->setEnabled(false);
+ chkBinary_2->setEnabled(false);
+ pageAccumulate->setEnabled(false);
+ pageAccumulate_2->setEnabled(false);
- boxScan->setChecked(checkedBefore);
- //make sure nth frame frequency plot is disabled
- EnablingNthFrameFunction(false);
+ //read every frame
+ disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
+ disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
+ comboFrequency->setCurrentIndex(1);
+ spinNthFrame->setValue(1);
+ SetFrequency();
+ connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
+ connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
- //
- if(mode0 && mode1){
- if(!radioFileIndex->isChecked()) radioAllFrames->setChecked(true);
- radioLevel0->setEnabled(false);
- radioLevel1->setEnabled(false);
- }else{
- radioLevel0->setEnabled(mode0);
- radioLevel1->setEnabled(mode1);
- }
- //only if level0 or level1 is checked
- if((radioLevel0->isChecked())||(radioLevel1->isChecked())){
- if(mode0) radioLevel0->setChecked(true);
- if(mode1) radioLevel1->setChecked(true);
- }
- }
- }
- else{
- //histogram for 1d
- if(isOriginallyOneD){
- radioHistogram->setEnabled(true);
- if(radioHistogram->isChecked())
- EnablingNthFrameFunction(false);
- else
- EnablingNthFrameFunction(true);
- }
+ }else{
+ pageHistogram->setEnabled(false);
+ pageHistogram_2->setEnabled(false);
}
-
- //positions
- if((positionsExist)&&(chkSuperimpose->isChecked())) chkSuperimpose->setChecked(false);
- chkSuperimpose->setEnabled(!positionsExist);
- //box frequency should be enabled cuz its a normal 1d plot
- //boxFrequency->setEnabled(positionsExist);
- myPlot->EnableAnglePlot(positionsExist);
-
-*/
+ connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
+ connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
}
-//-------------------------------------------------------------------------------------------------------------------------------------------------
-
-void qTabPlot::EnablingNthFrameFunction(bool enable){
-#ifdef VERYVERBOSE
- cout << "Enabling Nth Frame : " << enable << endl;
-#endif
- QStandardItemModel* model = qobject_cast(comboFrequency->model());
- QStandardItem* item = model->itemFromIndex(model->index(1, comboFrequency->modelColumn(), comboFrequency->rootModelIndex()));
-
- //enabling/disabling is easy if it wasnt selected anyway
- if(comboFrequency->currentIndex()!=1)
- item->setEnabled(enable);
- else{
- //only when it was enabled before and now to disable is a problem
- if(!enable){
- spinTimeGap->setValue(myPlot->GetMinimumPlotTimer());
- comboFrequency->setCurrentIndex(0);
- item->setEnabled(false);
- }
- }
-
-}
-
//-------------------------------------------------------------------------------------------------------------------------------------------------
void qTabPlot::SetScanArgument(){
@@ -891,6 +871,15 @@ void qTabPlot::SetScanArgument(){
}
+ //histogram default - set before setscanargument
+ myPlot->SetHistogram(radioHistogram->isChecked(),spinHistFrom->value(),spinHistTo->value(),spinHistSize->value());
+ if(radioHistogram->isChecked()){
+ dispXAxis->setText("Intensity");
+ dispYAxis->setText("Frequency");
+ myPlot->SetHistXAxisTitle("Intensity");
+ myPlot->SetHistYAxisTitle("Frequency");
+ Select1DPlot(true);
+ }
//angles (1D)
int ang;
@@ -900,12 +889,9 @@ void qTabPlot::SetScanArgument(){
Select1DPlot(true);
}
- /* bool histogram = radioHistogram->isChecked();
- * else if(histogram)*/
//1d with scan
if(boxScan->isChecked()){
-
myPlot->SetScanArgument(btnGroupScan->checkedId()+1);
switch(btnGroupScan->checkedId()){
@@ -931,79 +917,6 @@ void qTabPlot::SetScanArgument(){
}else
myPlot->SetScanArgument(qDefs::None);
- /*
- Select1DPlot(isOriginallyOneD);
-
- int ang;
- //if scans(1D or 2D)
- if((boxScan->isEnabled())||(histogram)){
- //setting the title according to the scans
- Select1DPlot(isOriginallyOneD);
-
-
- }//angles (1D)
- else if(myDet->getAngularConversion(ang)){
- dispXAxis->setText("Angles");
- myPlot->SetHistXAxisTitle("Angles");
- Select1DPlot(true);
-
- }
-
- //histogram
- if(histogram){
- //allFrames
- myPlot->SetScanArgument(qDefs::AllFrames);
-
- //default titles for 2d scan
- dispXAxis->setText("Channel Number");
- myPlot->SetImageXAxisTitle("Channel Number");
- dispZAxis->setText("Counts");
- myPlot->SetImageZAxisTitle("Counts");
- dispYAxis->setText("All Frames");
- myPlot->SetImageYAxisTitle("All Frames");
-
- //set plot to 2d
- Select1DPlot(false);
- }
- //2d
- else if((boxScan->isEnabled())&&(boxScan->isChecked())){
-
- //let qdrawplot know which scan argument
- myPlot->SetScanArgument(btnGroupScan->checkedId()+1);
-
- //default titles for 2d scan
- dispXAxis->setText("Channel Number");
- myPlot->SetImageXAxisTitle("Channel Number");
- dispZAxis->setText("Counts");
- myPlot->SetImageZAxisTitle("Counts");
-
- //titles for y of 2d scan
- switch(btnGroupScan->checkedId()){
- case 0://level0
- dispYAxis->setText("Scan Level 0");
- myPlot->SetImageYAxisTitle("Scan Level 0");
- break;
- case 1://level1
- dispYAxis->setText("Scan Level 1");
- myPlot->SetImageYAxisTitle("Scan Level 1");
- break;
- break;
- case 2://file index
- dispYAxis->setText("Frame Index");
- myPlot->SetImageYAxisTitle("Frame Index");
- break;
- case 3://all frames
- dispYAxis->setText("All Frames");
- myPlot->SetImageYAxisTitle("All Frames");
- break;
- }
-
- //set plot to 2d
- Select1DPlot(false);
-
- }else //done here so that it isnt set by default each time
- myPlot->SetScanArgument(qDefs::None);
-*/
qDefs::checkErrorMessage(myDet,"qTabPlot::SetScanArgument");
}
@@ -1019,18 +932,19 @@ void qTabPlot::Refresh(){
if (!radioNoPlot->isChecked())
boxFrequency->setEnabled(true);
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
- EnableScanBox();
+ EnableScanBox(true);
SetFrequency();
}else{
boxFrequency->setEnabled(false);
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
boxScan->setEnabled(false);
- //to toggle between no plot and the plot mode chosen while pltting
+ pageHistogram->setEnabled(false);
+ pageHistogram_2->setEnabled(false);
if(radioHistogram->isChecked())
radioDataGraph->setEnabled(false);
- radioHistogram->setEnabled(false);
-
+ else
+ radioHistogram->setEnabled(false);
}
#ifdef VERBOSE
cout << "**Updated Plot Tab" << endl << endl;