mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
histogram included, improved ready every frame, and other stuff.. a working version
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@230 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -99,7 +99,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>4</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<widget class="QWidget" name="gridLayoutWidget_5">
|
||||
@ -186,7 +186,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<widget class="QWidget" name="pageAccumulate_2">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -294,7 +294,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_7">
|
||||
<widget class="QWidget" name="pagePedestal_2">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -580,6 +580,167 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageHistogram_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>5</y>
|
||||
<width>311</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layoutThreshold_4">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistFrom_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistFrom_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistTo_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> to </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistTo_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistSize_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> size </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistSize_2">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="box1D">
|
||||
@ -610,7 +771,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<widget class="QWidget" name="gridLayoutWidget_2">
|
||||
@ -782,7 +943,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_5">
|
||||
<widget class="QWidget" name="pageAccumulate">
|
||||
<widget class="QPushButton" name="btnResetAccumulate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -890,7 +1051,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<widget class="QWidget" name="pagePedestal">
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
@ -1186,6 +1347,167 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="pageHistogram">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="horizontalLayoutWidget_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>25</x>
|
||||
<y>5</y>
|
||||
<width>311</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="layoutThreshold_3">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistFrom">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistFrom">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistTo">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> to </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistTo">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>10000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHistSize">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string> size </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinHistSize">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>16777215</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1000</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="boxSave">
|
||||
@ -1336,7 +1658,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>341</width>
|
||||
<width>342</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -1902,7 +2224,7 @@ Displays minimum, maximum and sum of values for each plot.
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="radioHistogram">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
@ -2443,6 +2765,16 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<zorder>box1D</zorder>
|
||||
<zorder>box2D</zorder>
|
||||
<zorder>boxSave</zorder>
|
||||
<zorder>boxScan</zorder>
|
||||
<zorder>boxPlotAxis</zorder>
|
||||
<zorder>groupBox_3</zorder>
|
||||
<zorder>boxFrequency</zorder>
|
||||
<zorder>boxSnapshot</zorder>
|
||||
<zorder>btnRight</zorder>
|
||||
<zorder>btnLeft</zorder>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>radioNoPlot</tabstop>
|
||||
|
@ -25,6 +25,14 @@ class qCloneWidget;
|
||||
#include <QString>
|
||||
#include "qwt_symbol.h"
|
||||
|
||||
|
||||
#include <QVector>
|
||||
#include <qwt_series_data.h>
|
||||
#include <qwt_plot_histogram.h>
|
||||
#include <qwt_plot_grid.h>
|
||||
#include <qwt_column_symbol.h>
|
||||
#include <qpen.h>
|
||||
|
||||
/** 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<QwtIntervalSample> histogramSamples;
|
||||
|
||||
|
||||
|
||||
|
||||
signals:
|
||||
void UpdatingPlotFinished();
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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
|
||||
//
|
||||
|
@ -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 <QImage>
|
||||
#include <QPainter>
|
||||
#include <QFileDialog>
|
||||
//#include "qwt_double_interval.h"
|
||||
#include "qwt_series_data.h"
|
||||
// C++ Include Headers
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -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;j<histogramSamples.size();j++){
|
||||
cout<<j<<":\tmin:"<<histogramSamples[j].interval.minValue()<<""
|
||||
"\tmax:"<<histogramSamples[j].interval.maxValue()<<"\t:"<<histogramSamples[j].value<<endl;
|
||||
}
|
||||
}
|
||||
|
||||
UnlockLastImageArray();
|
||||
|
||||
qDefs::checkErrorMessage(myDet,"qDrawPlot::SetScanArgument");
|
||||
@ -816,8 +857,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
||||
lastImageNumber= currentFrame+1;
|
||||
//title
|
||||
imageTitle = temp_title;
|
||||
cout<<"lastImageNumber:"<<lastImageNumber<<endl;
|
||||
cout<<"currentScanDivLevel:"<<currentScanDivLevel<<endl;
|
||||
//copy data
|
||||
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
|
||||
UnlockLastImageArray();
|
||||
@ -885,6 +924,31 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
||||
if(plot_in_scope==1){
|
||||
// Titles
|
||||
histTitle[0] = temp_title;
|
||||
|
||||
//histogram
|
||||
if(histogram){
|
||||
resetAccumulate = false;
|
||||
lastImageNumber= currentFrame+1;
|
||||
|
||||
int numValues = nPixelsX;
|
||||
if(originally2D)
|
||||
numValues = nPixelsX*nPixelsY;
|
||||
|
||||
for(int i=0;i<numValues;i++){
|
||||
//ignore outside limits
|
||||
if ((data->values[i] <= histFrom) || (data->values[i] >= histTo))
|
||||
continue;
|
||||
//check for intervals, increment if validates
|
||||
for(int j=0;j<histogramSamples.size();j++){
|
||||
if(histogramSamples[j].interval.contains(data->values[i]))
|
||||
histogramSamples[j].value += 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//not histogram
|
||||
else{
|
||||
// Persistency
|
||||
if(currentPersistency < persistency)currentPersistency++;
|
||||
else currentPersistency=persistency;
|
||||
@ -937,6 +1001,7 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//2d
|
||||
else{
|
||||
// Titles
|
||||
@ -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<SlsQtH1D*>::iterator h = plot1D_hists.begin();
|
||||
h!=plot1D_hists.end();h++) (*h)->Detach(plot1D); //clear plot
|
||||
for(QVector<SlsQtH1D*>::iterator h = plot1D_hists.begin(); h!=plot1D_hists.end();h++)
|
||||
(*h)->Detach(plot1D);
|
||||
|
||||
plotHistogram->detach();
|
||||
}
|
||||
|
||||
|
||||
@ -1153,12 +1219,25 @@ 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());
|
||||
|
||||
//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));
|
||||
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()){
|
||||
@ -1179,6 +1258,8 @@ void qDrawPlot::UpdatePlot(){
|
||||
//h->setTitle(GetHistTitle(hist_num));
|
||||
h->Attach(plot1D);
|
||||
}
|
||||
plot1D->Update();
|
||||
}
|
||||
// update range if required
|
||||
if(XYRangeChanged){
|
||||
if(!IsXYRange[qDefs::XMINIMUM]) XYRangeValues[qDefs::XMINIMUM]= plot1D->GetXMinimum();
|
||||
@ -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);
|
||||
|
@ -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,9 +272,7 @@ 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()));
|
||||
// Snapshot box
|
||||
@ -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())
|
||||
}else if(radioDataGraph->isChecked()){
|
||||
cout << " - DataGraph" << endl;
|
||||
else
|
||||
cout << " - Histogram" << 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,"<nobr>Histogram cannot be used together with 2D Scan Plots.</nobr><br>"
|
||||
"<nobr>Uncheck <b>2D Scan</b> plots to plot <b>Histograms</b></nobr>", "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,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
||||
"before <b>Starting Acquitision</b></nobr>","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,20 +698,17 @@ 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(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||
|
||||
int mode0 = myDet->getScanMode(0);
|
||||
@ -686,59 +716,71 @@ void qTabPlot::EnableScanBox(){
|
||||
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("<nobr>Only 1D Plots enabled for Angle Plots</nobr>");
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//histogram
|
||||
if(radioHistogram->isChecked()){
|
||||
//switch back to datagraph
|
||||
if(!Histo)
|
||||
radioDataGraph->setChecked(true);
|
||||
|
||||
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(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);
|
||||
|
||||
//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()));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
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())
|
||||
radioDataGraph->setChecked(true);
|
||||
radioHistogram->setEnabled(false);
|
||||
|
||||
//make sure nth frame frequency plot is disabled
|
||||
EnablingNthFrameFunction(false);
|
||||
|
||||
//if 2d is chosen or not for scan
|
||||
if(boxScan->isChecked()){
|
||||
|
||||
boxScan->setChecked(checkedBefore);
|
||||
//make sure nth frame frequency plot is disabled
|
||||
EnablingNthFrameFunction(false);
|
||||
|
||||
//
|
||||
if(mode0 && mode1){
|
||||
if(!radioFileIndex->isChecked()) radioAllFrames->setChecked(true);
|
||||
radioLevel0->setEnabled(false);
|
||||
radioLevel1->setEnabled(false);
|
||||
}else{
|
||||
radioLevel0->setEnabled(mode0);
|
||||
radioLevel1->setEnabled(mode1);
|
||||
pageHistogram->setEnabled(false);
|
||||
pageHistogram_2->setEnabled(false);
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||
}
|
||||
|
||||
|
||||
//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);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabPlot::EnablingNthFrameFunction(bool enable){
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Enabling Nth Frame : " << enable << endl;
|
||||
#endif
|
||||
QStandardItemModel* model = qobject_cast<QStandardItemModel*>(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);
|
||||
else
|
||||
radioHistogram->setEnabled(false);
|
||||
|
||||
}
|
||||
#ifdef VERBOSE
|
||||
cout << "**Updated Plot Tab" << endl << endl;
|
||||
|
Reference in New Issue
Block a user