mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
histogram for 2d and s curves
This commit is contained in:
parent
8a26eef0bf
commit
c33657f04d
@ -2765,6 +2765,123 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QGroupBox" name="boxHistogram">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>410</x>
|
||||||
|
<y>5</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>51</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string>Histogram - X Axis Values</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget_15">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>20</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>26</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioHistIntensity">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><nobr>Enabled only when there is a Scan Level 0</nobr></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Intensity</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>7</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioHistLevel0">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><nobr>Enabled only when there is a Scan Level 1</nobr></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Level 0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_11">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>7</width>
|
||||||
|
<height>10</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QRadioButton" name="radioHistLevel1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><nobr>Enabled only when there is a Scan Level 0 or a Scan Level 1, not both</nobr></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Level 1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
<zorder>box1D</zorder>
|
<zorder>box1D</zorder>
|
||||||
<zorder>box2D</zorder>
|
<zorder>box2D</zorder>
|
||||||
<zorder>boxSave</zorder>
|
<zorder>boxSave</zorder>
|
||||||
@ -2775,6 +2892,7 @@ Interval between plots has 2 modes. A condition to be satisfied, in order to avo
|
|||||||
<zorder>boxSnapshot</zorder>
|
<zorder>boxSnapshot</zorder>
|
||||||
<zorder>btnRight</zorder>
|
<zorder>btnRight</zorder>
|
||||||
<zorder>btnLeft</zorder>
|
<zorder>btnLeft</zorder>
|
||||||
|
<zorder>boxHistogram</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>radioNoPlot</tabstop>
|
<tabstop>radioNoPlot</tabstop>
|
||||||
|
@ -281,6 +281,17 @@ static const int64_t GUI_VERSION=0x20121213;
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
/** histogram arguments*/
|
||||||
|
enum histogramArgumentList{
|
||||||
|
Intensity,
|
||||||
|
histLevel0,
|
||||||
|
histLevel1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public:
|
|||||||
void SetBinary(bool enable, int from=0, int to=0);
|
void SetBinary(bool enable, int from=0, int to=0);
|
||||||
|
|
||||||
/** Enable/Disable Histogram */
|
/** Enable/Disable Histogram */
|
||||||
void SetHistogram(bool enable,int min=0, int max=0, int size=0){histogram = enable;histFrom=min;histTo=max;histSize=size;};
|
void SetHistogram(bool enable,int histArg, int min=0, int max=0, int size=0){histogram = enable;histogramArgument = histArg; histFrom=min;histTo=max;histSize=size;};
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
/** To select 1D or 2D plot
|
/** To select 1D or 2D plot
|
||||||
@ -494,6 +494,9 @@ bool isTriggerEnabled;
|
|||||||
/** scan arguments*/
|
/** scan arguments*/
|
||||||
int scanArgument;
|
int scanArgument;
|
||||||
|
|
||||||
|
/** histogram arguments*/
|
||||||
|
int histogramArgument;
|
||||||
|
|
||||||
/** enable angle plot */
|
/** enable angle plot */
|
||||||
bool anglePlot;
|
bool anglePlot;
|
||||||
/** prevents err msg displaying twice when detector stopped, "transmitting" */
|
/** prevents err msg displaying twice when detector stopped, "transmitting" */
|
||||||
|
@ -71,6 +71,7 @@ private:
|
|||||||
QComboBox *comboTimeGapUnit;
|
QComboBox *comboTimeGapUnit;
|
||||||
QButtonGroup *btnGroupScan;
|
QButtonGroup *btnGroupScan;
|
||||||
QButtonGroup *btnGroupPlotType;
|
QButtonGroup *btnGroupPlotType;
|
||||||
|
QButtonGroup *btnGroupHistogram;
|
||||||
|
|
||||||
/** some Default Values */
|
/** some Default Values */
|
||||||
static QString defaultPlotTitle;
|
static QString defaultPlotTitle;
|
||||||
@ -105,7 +106,7 @@ public slots:
|
|||||||
|
|
||||||
/** Enable Scan box
|
/** Enable Scan box
|
||||||
*/
|
*/
|
||||||
void EnableScanBox(bool Histo=false);
|
void EnableScanBox();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -147,6 +148,9 @@ private slots:
|
|||||||
/** Plot binary plot */
|
/** Plot binary plot */
|
||||||
void SetBinary();
|
void SetBinary();
|
||||||
|
|
||||||
|
/** Set histogram options */
|
||||||
|
void SetHistogramOptions();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void DisableZoomSignal(bool);
|
void DisableZoomSignal(bool);
|
||||||
void SetZRangeSignal(double,double);
|
void SetZRangeSignal(double,double);
|
||||||
|
@ -168,6 +168,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
isTriggerEnabled = false;
|
isTriggerEnabled = false;
|
||||||
|
|
||||||
scanArgument = qDefs::None;
|
scanArgument = qDefs::None;
|
||||||
|
histogramArgument = qDefs::Intensity;
|
||||||
anglePlot = false;
|
anglePlot = false;
|
||||||
alreadyDisplayed = false;
|
alreadyDisplayed = false;
|
||||||
|
|
||||||
@ -600,7 +601,7 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
|||||||
int max = (iloop+1)*histSize + histFrom;
|
int max = (iloop+1)*histSize + histFrom;
|
||||||
while(min < histTo){
|
while(min < histTo){
|
||||||
histogramSamples.resize(iloop+1);
|
histogramSamples.resize(iloop+1);
|
||||||
histogramSamples[iloop].interval.setInterval(min,max);
|
histogramSamples[iloop].interval.setInterval(min,max-1);
|
||||||
histogramSamples[iloop].value = 0;
|
histogramSamples[iloop].value = 0;
|
||||||
iloop++;
|
iloop++;
|
||||||
min = max;
|
min = max;
|
||||||
@ -974,15 +975,56 @@ int qDrawPlot::GetData(detectorData *data,int fIndex){
|
|||||||
if(originally2D)
|
if(originally2D)
|
||||||
numValues = nPixelsX*nPixelsY;
|
numValues = nPixelsX*nPixelsY;
|
||||||
|
|
||||||
|
//clean up graph
|
||||||
|
if(histogramArgument == qDefs::Intensity){
|
||||||
|
for(int j=0;j<histogramSamples.size();j++){
|
||||||
|
histogramSamples[j].value = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int val = 0 ;
|
||||||
for(int i=0;i<numValues;i++){
|
for(int i=0;i<numValues;i++){
|
||||||
|
//frequency of intensity
|
||||||
|
if(histogramArgument == qDefs::Intensity){
|
||||||
|
//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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//get sum of data pixels
|
||||||
|
else
|
||||||
|
val += data->values[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(histogramArgument != qDefs::Intensity){
|
||||||
|
val /= numValues;
|
||||||
|
|
||||||
|
//find scan value
|
||||||
|
int ci = 0, fi = 0; double cs0 = 0 , cs1 = 0;
|
||||||
|
fileIOStatic::getVariablesFromFileName(string(data->fileName), ci, fi, cs0, cs1);
|
||||||
|
|
||||||
|
int scanval=-1;
|
||||||
|
if(cs0 != -1)
|
||||||
|
scanval = cs0;
|
||||||
|
else scanval = cs1;
|
||||||
|
|
||||||
//ignore outside limits
|
//ignore outside limits
|
||||||
if ((data->values[i] <= histFrom) || (data->values[i] >= histTo))
|
if ((scanval <= histFrom) || (scanval >= histTo) || (scanval == -1))
|
||||||
continue;
|
scanval = -1;
|
||||||
//check for intervals, increment if validates
|
//check for intervals, increment if validates
|
||||||
for(int j=0;j<histogramSamples.size();j++){
|
for(int j=0;j<histogramSamples.size();j++){
|
||||||
if(histogramSamples[j].interval.contains(data->values[i]))
|
if(histogramSamples[j].interval.contains(scanval)){
|
||||||
histogramSamples[j].value += 1;
|
histogramSamples[j].value = val;
|
||||||
|
cout << "j:"<<j<<" scanval:"<<scanval<<" val:"<<val<<endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,8 @@ qTabPlot::qTabPlot(QWidget *parent,multiSlsDetector*& detector, qDrawPlot*& plot
|
|||||||
spinTimeGap(0),
|
spinTimeGap(0),
|
||||||
comboTimeGapUnit(0),
|
comboTimeGapUnit(0),
|
||||||
btnGroupScan(0),
|
btnGroupScan(0),
|
||||||
btnGroupPlotType(0){
|
btnGroupPlotType(0),
|
||||||
|
btnGroupHistogram(0){
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
SetupWidgetWindow();
|
SetupWidgetWindow();
|
||||||
Initialization();
|
Initialization();
|
||||||
@ -84,6 +85,12 @@ void qTabPlot::SetupWidgetWindow(){
|
|||||||
btnGroupPlotType->addButton(radioDataGraph,1);
|
btnGroupPlotType->addButton(radioDataGraph,1);
|
||||||
btnGroupPlotType->addButton(radioHistogram,2);
|
btnGroupPlotType->addButton(radioHistogram,2);
|
||||||
|
|
||||||
|
//histogram arguments
|
||||||
|
btnGroupHistogram = new QButtonGroup(this);
|
||||||
|
btnGroupHistogram->addButton(radioHistIntensity,0);
|
||||||
|
btnGroupHistogram->addButton(radioHistLevel0,1);
|
||||||
|
btnGroupHistogram->addButton(radioHistLevel1,2);
|
||||||
|
|
||||||
// Plot Axis
|
// Plot Axis
|
||||||
dispTitle->setEnabled(false);
|
dispTitle->setEnabled(false);
|
||||||
dispXAxis->setEnabled(false);
|
dispXAxis->setEnabled(false);
|
||||||
@ -181,6 +188,9 @@ void qTabPlot::SetupWidgetWindow(){
|
|||||||
//to check if this should be enabled
|
//to check if this should be enabled
|
||||||
EnableScanBox();
|
EnableScanBox();
|
||||||
|
|
||||||
|
//disable histogram initially
|
||||||
|
boxHistogram->hide();
|
||||||
|
|
||||||
qDefs::checkErrorMessage(myDet,"qTabPlot::SetupWidgetWindow");
|
qDefs::checkErrorMessage(myDet,"qTabPlot::SetupWidgetWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,6 +283,8 @@ void qTabPlot::Select1DPlot(bool b){
|
|||||||
void qTabPlot::Initialization(){
|
void qTabPlot::Initialization(){
|
||||||
// Plot arguments box
|
// Plot arguments box
|
||||||
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||||
|
// Histogram arguments box
|
||||||
|
connect(btnGroupHistogram,SIGNAL(buttonClicked(int)),this, SLOT(SetHistogramOptions()));
|
||||||
// Scan box
|
// Scan box
|
||||||
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
// Snapshot box
|
// Snapshot box
|
||||||
@ -522,14 +534,20 @@ void qTabPlot::SetPlot(){
|
|||||||
if(radioNoPlot->isChecked()){
|
if(radioNoPlot->isChecked()){
|
||||||
cout << " - No Plot" << endl;
|
cout << " - No Plot" << endl;
|
||||||
|
|
||||||
|
boxScan->show();
|
||||||
|
boxHistogram->hide();
|
||||||
myPlot->EnablePlot(false);
|
myPlot->EnablePlot(false);
|
||||||
boxSnapshot->setEnabled(false);
|
boxSnapshot->setEnabled(false);
|
||||||
boxSave->setEnabled(false);
|
boxSave->setEnabled(false);
|
||||||
boxFrequency->setEnabled(false);
|
boxFrequency->setEnabled(false);
|
||||||
boxPlotAxis->setEnabled(false);
|
boxPlotAxis->setEnabled(false);
|
||||||
boxScan->setEnabled(false);
|
boxScan->setEnabled(false);
|
||||||
|
|
||||||
}else if(radioDataGraph->isChecked()){
|
}else if(radioDataGraph->isChecked()){
|
||||||
cout << " - DataGraph" << endl;
|
cout << " - DataGraph" << endl;
|
||||||
|
|
||||||
|
boxScan->show();
|
||||||
|
boxHistogram->hide();
|
||||||
myPlot->EnablePlot(true);
|
myPlot->EnablePlot(true);
|
||||||
Select1DPlot(isOriginallyOneD);
|
Select1DPlot(isOriginallyOneD);
|
||||||
boxSnapshot->setEnabled(true);
|
boxSnapshot->setEnabled(true);
|
||||||
@ -538,6 +556,8 @@ void qTabPlot::SetPlot(){
|
|||||||
boxPlotAxis->setEnabled(true);
|
boxPlotAxis->setEnabled(true);
|
||||||
if(!myPlot->isRunning())
|
if(!myPlot->isRunning())
|
||||||
EnableScanBox();
|
EnableScanBox();
|
||||||
|
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||||
|
myPlot->SetXYRange(true);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//histogram and 2d scans dont work
|
//histogram and 2d scans dont work
|
||||||
@ -545,10 +565,20 @@ void qTabPlot::SetPlot(){
|
|||||||
qDefs::Message(qDefs::WARNING,"<nobr>Histogram cannot be used together with 2D Scan Plots.</nobr><br>"
|
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");
|
"<nobr>Uncheck <b>2D Scan</b> plots to plot <b>Histograms</b></nobr>", "qTabPlot::SetPlot");
|
||||||
radioDataGraph->setChecked(true);
|
radioDataGraph->setChecked(true);
|
||||||
|
boxScan->show();
|
||||||
|
boxHistogram->hide();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << " - Histogram" << endl;
|
cout << " - Histogram" << endl;
|
||||||
|
|
||||||
|
if(radioHistIntensity->isChecked())
|
||||||
|
pageHistogram->setEnabled(true);
|
||||||
|
else
|
||||||
|
pageHistogram->setEnabled(false);
|
||||||
|
|
||||||
|
boxScan->hide();
|
||||||
|
boxHistogram->show();
|
||||||
myPlot->EnablePlot(true);
|
myPlot->EnablePlot(true);
|
||||||
Select1DPlot(isOriginallyOneD);
|
Select1DPlot(isOriginallyOneD);
|
||||||
boxSnapshot->setEnabled(true);
|
boxSnapshot->setEnabled(true);
|
||||||
@ -556,7 +586,7 @@ void qTabPlot::SetPlot(){
|
|||||||
boxFrequency->setEnabled(true);
|
boxFrequency->setEnabled(true);
|
||||||
boxPlotAxis->setEnabled(true);
|
boxPlotAxis->setEnabled(true);
|
||||||
if(!myPlot->isRunning())
|
if(!myPlot->isRunning())
|
||||||
EnableScanBox(true);
|
EnableScanBox();
|
||||||
qDefs::Message(qDefs::INFORMATION,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
qDefs::Message(qDefs::INFORMATION,"<nobr>Please check the <b>Plot Histogram Options</b> below "
|
||||||
"before <b>Starting Acquitision</b></nobr>","qTabPlot::SetPlot");
|
"before <b>Starting Acquitision</b></nobr>","qTabPlot::SetPlot");
|
||||||
}
|
}
|
||||||
@ -707,15 +737,18 @@ void qTabPlot::SetFrequency(){
|
|||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
void qTabPlot::EnableScanBox(bool Histo){
|
void qTabPlot::EnableScanBox(){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Entering Enable Scan Box, Histo:" << Histo << endl;
|
cout << "Entering Enable Scan Box"<< endl;
|
||||||
#endif
|
#endif
|
||||||
disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
disconnect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
|
|
||||||
int mode0 = myDet->getScanMode(0);
|
int mode0 = myDet->getScanMode(0);
|
||||||
int mode1 = myDet->getScanMode(1);
|
int mode1 = myDet->getScanMode(1);
|
||||||
|
|
||||||
|
radioHistLevel0->setEnabled(mode0);
|
||||||
|
radioHistLevel1->setEnabled(mode1);
|
||||||
int ang;
|
int ang;
|
||||||
bool angConvert = myDet->getAngularConversion(ang);
|
bool angConvert = myDet->getAngularConversion(ang);
|
||||||
myPlot->EnableAnglePlot(angConvert);
|
myPlot->EnableAnglePlot(angConvert);
|
||||||
@ -732,6 +765,9 @@ void qTabPlot::EnableScanBox(bool Histo){
|
|||||||
chkBinary_2->setEnabled(true);
|
chkBinary_2->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if angle plot or originally 2d, uncheck and disable scanbox
|
//if angle plot or originally 2d, uncheck and disable scanbox
|
||||||
if ((angConvert) || (!isOriginallyOneD)){
|
if ((angConvert) || (!isOriginallyOneD)){
|
||||||
boxScan->setChecked(false);
|
boxScan->setChecked(false);
|
||||||
@ -766,18 +802,23 @@ void qTabPlot::EnableScanBox(bool Histo){
|
|||||||
pageAccumulate_2->setEnabled(false);
|
pageAccumulate_2->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(angConvert){
|
if(angConvert){
|
||||||
boxScan->setToolTip("<nobr>Only 1D Plots enabled for Angle Plots</nobr>");
|
boxScan->setToolTip("<nobr>Only 1D Plots enabled for Angle Plots</nobr>");
|
||||||
//disable histogram
|
//disable histogram
|
||||||
if(radioHistogram->isChecked()){
|
if(radioHistogram->isChecked()){
|
||||||
radioDataGraph->setChecked(true);
|
radioDataGraph->setChecked(true);
|
||||||
radioHistogram->setEnabled(false);
|
radioHistogram->setEnabled(false);
|
||||||
|
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||||
|
myPlot->SetXYRange(true);
|
||||||
|
boxScan->show();
|
||||||
|
boxHistogram->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//originally1d && not angle plot
|
//originally1d && not angle plot
|
||||||
else{
|
else{
|
||||||
boxScan->setToolTip("");
|
boxScan->setToolTip("");
|
||||||
@ -787,6 +828,16 @@ void qTabPlot::EnableScanBox(bool Histo){
|
|||||||
|
|
||||||
//2d enabled with boxscan
|
//2d enabled with boxscan
|
||||||
if(boxScan->isChecked()){
|
if(boxScan->isChecked()){
|
||||||
|
|
||||||
|
//2d for 1d detctors and histogram dont go
|
||||||
|
if(radioHistogram->isChecked()){
|
||||||
|
radioDataGraph->setChecked(true);
|
||||||
|
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||||
|
myPlot->SetXYRange(true);
|
||||||
|
boxScan->show();
|
||||||
|
boxHistogram->hide();
|
||||||
|
}
|
||||||
|
|
||||||
//read every frame
|
//read every frame
|
||||||
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
disconnect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
||||||
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
disconnect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
||||||
@ -814,12 +865,10 @@ void qTabPlot::EnableScanBox(bool Histo){
|
|||||||
|
|
||||||
//histogram
|
//histogram
|
||||||
if(radioHistogram->isChecked()){
|
if(radioHistogram->isChecked()){
|
||||||
//switch back to datagraph
|
if(radioHistIntensity->isChecked())
|
||||||
if(!Histo)
|
pageHistogram->setEnabled(true);
|
||||||
radioDataGraph->setChecked(true);
|
else
|
||||||
|
pageHistogram->setEnabled(false);
|
||||||
pageHistogram->setEnabled(true);
|
|
||||||
pageHistogram_2->setEnabled(true);
|
|
||||||
stackedWidget->setCurrentIndex(stackedWidget->count()-1);
|
stackedWidget->setCurrentIndex(stackedWidget->count()-1);
|
||||||
stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
|
stackedWidget_2->setCurrentIndex(stackedWidget_2->count()-1);
|
||||||
box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
|
box1D->setTitle(QString("1D Plot Options %1 - Histogram").arg(stackedWidget->currentIndex()+1));
|
||||||
@ -851,7 +900,7 @@ void qTabPlot::EnableScanBox(bool Histo){
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
pageHistogram->setEnabled(false);
|
pageHistogram->setEnabled(false);
|
||||||
pageHistogram_2->setEnabled(false);
|
/*pageHistogram_2->setEnabled(false);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
connect(btnGroupPlotType,SIGNAL(buttonClicked(int)),this, SLOT(SetPlot()));
|
||||||
@ -888,9 +937,49 @@ void qTabPlot::SetScanArgument(){
|
|||||||
|
|
||||||
|
|
||||||
//histogram default - set before setscanargument
|
//histogram default - set before setscanargument
|
||||||
myPlot->SetHistogram(radioHistogram->isChecked(),spinHistFrom->value(),spinHistTo->value(),spinHistSize->value());
|
int min = spinHistFrom->value();
|
||||||
|
int max = spinHistTo->value();
|
||||||
|
int size = spinHistSize->value();
|
||||||
|
int histArg = qDefs::Intensity;
|
||||||
if(radioHistogram->isChecked()){
|
if(radioHistogram->isChecked()){
|
||||||
dispXAxis->setText("Intensity");
|
if(!radioHistIntensity->isChecked()){
|
||||||
|
|
||||||
|
int mode = 0;
|
||||||
|
histArg = qDefs::histLevel0;
|
||||||
|
if(radioHistLevel1->isChecked()){
|
||||||
|
mode = 1;
|
||||||
|
histArg = qDefs::histLevel1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int numSteps = myDet->getScanSteps(mode);
|
||||||
|
double *values = NULL;
|
||||||
|
min = 0;max = 1;size = 1;
|
||||||
|
|
||||||
|
if(numSteps > 0){
|
||||||
|
values = new double[numSteps];
|
||||||
|
myDet->getScanSteps(mode,values);
|
||||||
|
min = values[0];
|
||||||
|
max = values[numSteps - 1];
|
||||||
|
size = (max - min)/(numSteps - 1);
|
||||||
|
min -= (size/2);
|
||||||
|
max += (size/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
cout <<"min:"<<min<<" max:"<<max<<" size:"<<size<<endl;
|
||||||
|
myPlot->SetHistogram(radioHistogram->isChecked(),histArg,min,max,size);
|
||||||
|
|
||||||
|
|
||||||
|
if(radioHistogram->isChecked()){
|
||||||
|
if(radioHistIntensity->isChecked())
|
||||||
|
dispXAxis->setText("Intensity");
|
||||||
|
else if (radioHistLevel0->isChecked())
|
||||||
|
dispXAxis->setText("Level 0");
|
||||||
|
else
|
||||||
|
dispXAxis->setText("Level 1");
|
||||||
dispYAxis->setText("Frequency");
|
dispYAxis->setText("Frequency");
|
||||||
myPlot->SetHistXAxisTitle("Intensity");
|
myPlot->SetHistXAxisTitle("Intensity");
|
||||||
myPlot->SetHistYAxisTitle("Frequency");
|
myPlot->SetHistYAxisTitle("Frequency");
|
||||||
@ -941,36 +1030,6 @@ void qTabPlot::SetScanArgument(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
void qTabPlot::Refresh(){
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << endl << "**Updating Plot Tab" << endl;
|
|
||||||
#endif
|
|
||||||
if(!myPlot->isRunning()){
|
|
||||||
if (!radioNoPlot->isChecked())
|
|
||||||
boxFrequency->setEnabled(true);
|
|
||||||
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
|
||||||
EnableScanBox(true);
|
|
||||||
SetFrequency();
|
|
||||||
|
|
||||||
}else{
|
|
||||||
boxFrequency->setEnabled(false);
|
|
||||||
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
|
||||||
boxScan->setEnabled(false);
|
|
||||||
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;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
@ -1025,3 +1084,47 @@ void qTabPlot::SetBinary(){
|
|||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::SetHistogramOptions(){
|
||||||
|
if(radioHistIntensity->isChecked()){
|
||||||
|
pageHistogram->setEnabled(true);
|
||||||
|
}else {
|
||||||
|
pageHistogram->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
void qTabPlot::Refresh(){
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << endl << "**Updating Plot Tab" << endl;
|
||||||
|
#endif
|
||||||
|
if(!myPlot->isRunning()){
|
||||||
|
if (!radioNoPlot->isChecked())
|
||||||
|
boxFrequency->setEnabled(true);
|
||||||
|
connect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
|
EnableScanBox();
|
||||||
|
SetFrequency();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
boxFrequency->setEnabled(false);
|
||||||
|
disconnect(boxScan, SIGNAL(toggled(bool)), this, SLOT(EnableScanBox()));
|
||||||
|
boxScan->setEnabled(false);
|
||||||
|
pageHistogram->setEnabled(false);
|
||||||
|
if(radioHistogram->isChecked())
|
||||||
|
radioDataGraph->setEnabled(false);
|
||||||
|
else
|
||||||
|
radioHistogram->setEnabled(false);
|
||||||
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "**Updated Plot Tab" << endl << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user