mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 00:50:42 +02:00
updated plot to show index instead of frame number
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@35 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
40af9384b5
commit
1ce04ef785
@ -519,6 +519,9 @@
|
||||
<property name="text">
|
||||
<string>Level 0</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -607,7 +610,7 @@
|
||||
<string>All Frames</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1051,7 +1054,7 @@
|
||||
<item row="0" column="2">
|
||||
<widget class="QRadioButton" name="radioHistogram">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -137,6 +137,8 @@ private:
|
||||
int currentMeasurement;
|
||||
/** currentFrame */
|
||||
int currentFrame;
|
||||
/** current Index */
|
||||
int currentIndex;
|
||||
/** Number of Exposures */
|
||||
int number_of_exposures;
|
||||
/** Duration between Exposures */
|
||||
|
@ -167,6 +167,7 @@ signals:
|
||||
void StartSignal();
|
||||
void StopSignal();
|
||||
void CheckPlotIntervalSignal();
|
||||
void EnableNthFrameSignal(bool);
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,6 +16,8 @@ class multiSlsDetector;
|
||||
class qDrawPlot;
|
||||
/** Qt Include Headers */
|
||||
#include <QStackedLayout>
|
||||
#include <QButtonGroup>
|
||||
#include <QAbstractButton>
|
||||
|
||||
/**
|
||||
*@short sets up the Plot parameters
|
||||
@ -51,12 +53,14 @@ private:
|
||||
bool isOneD;
|
||||
bool isOrginallyOneD;
|
||||
|
||||
int scanLevel[2];
|
||||
/**whether to enable nth frame according to timing mode*/
|
||||
bool enableNFrame;
|
||||
|
||||
QStackedLayout* stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
QDoubleSpinBox *spinTimeGap;
|
||||
QComboBox *comboTimeGapUnit;
|
||||
QStackedLayout *stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
QDoubleSpinBox *spinTimeGap;
|
||||
QComboBox *comboTimeGapUnit;
|
||||
QButtonGroup *btnGroupScan;
|
||||
|
||||
/** some Default Values */
|
||||
static QString defaultPlotTitle;
|
||||
@ -75,6 +79,11 @@ private:
|
||||
*/
|
||||
void Initialization();
|
||||
|
||||
/** This enabled/disables the nth frame from frequency plot
|
||||
* @param enable enable/disable
|
||||
*/
|
||||
void EnablingNthFrameFunction(bool enable);
|
||||
|
||||
|
||||
|
||||
|
||||
@ -85,9 +94,18 @@ void SetFrequency();
|
||||
* @param enable to enable the scan group box
|
||||
* @param id is 0 if its scan level 0 or scan level 1
|
||||
*/
|
||||
void EnableScanBox(int mode,int id);
|
||||
void EnableScanBox(int mode=-1,int id=-1);
|
||||
|
||||
/** a variable is set when timing mode has been changed.
|
||||
* This variable is also disabled if exptime>acq period to be on safe side
|
||||
* Its to check whether to enabled nth frame for frequency plot
|
||||
* @param enable enable/disable
|
||||
*/
|
||||
void EnableNthFrame(bool enable){enableNFrame = enable;};
|
||||
|
||||
/** Sets the scan argument of the plot
|
||||
*/
|
||||
void SetScanArgument();
|
||||
|
||||
|
||||
private slots:
|
||||
@ -119,7 +137,6 @@ signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
void ThresholdScanSignal(int);
|
||||
};
|
||||
|
||||
|
||||
|
@ -222,6 +222,7 @@ void qDetectorMain::Initialization(){
|
||||
connect(tab_measurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tab_measurement, SIGNAL(StopSignal()), this,SLOT(EnableTabs()));
|
||||
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
|
||||
connect(tab_measurement, SIGNAL(EnableNthFrameSignal(bool)), tab_plot,SLOT(EnableNthFrame(bool)));
|
||||
// Plot tab
|
||||
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||
// Actions tab
|
||||
|
@ -51,7 +51,7 @@ qDrawPlot::~qDrawPlot(){
|
||||
|
||||
void qDrawPlot::SetupWidgetWindow(){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Setting up plot variables"<<endl;
|
||||
cout << "Setting up plot variables" << endl;
|
||||
#endif
|
||||
number_of_measurements=1;
|
||||
currentMeasurement = 0;
|
||||
@ -184,13 +184,16 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
||||
numTriggers = ((numTriggers==0)?1:numTriggers);
|
||||
|
||||
number_of_exposures= numFrames * numTriggers;
|
||||
cout<<"\tNumber of Exposures:"<<number_of_exposures<<endl;
|
||||
cout << "\tNumber of Exposures:" << number_of_exposures << endl;
|
||||
// ExposureTime
|
||||
exposureTime= ((double)(myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1))*1E-9);
|
||||
cout<<"\tExposure Time:"<<setprecision (10)<<exposureTime<<endl;
|
||||
cout << "\tExposure Time:" << setprecision (10) << exposureTime << endl;
|
||||
// Acquisition Period
|
||||
acquisitionPeriod= ((double)(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1))*1E-9);
|
||||
cout<<"\tAcquisition Period:"<<setprecision (10)<<acquisitionPeriod<<endl;
|
||||
cout << "\tAcquisition Period:" << setprecision (10) << acquisitionPeriod << endl;
|
||||
// Current Index
|
||||
currentIndex = myDet->getFileIndex();
|
||||
cout << "\tCurrent Index:" << currentIndex << endl;
|
||||
|
||||
StartDaq(true);
|
||||
running=!running;
|
||||
@ -202,14 +205,14 @@ void qDrawPlot::StartStopDaqToggle(bool stop_if_running){
|
||||
void qDrawPlot::StartDaq(bool start){
|
||||
if(start){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Start Daq(true) function"<<endl;
|
||||
cout << "Start Daq(true) function" << endl;
|
||||
#endif
|
||||
ResetDaqForGui();
|
||||
StartDaqForGui();
|
||||
UpdatePlot();
|
||||
}else{
|
||||
#ifdef VERBOSE
|
||||
cout<<"Start Daq(false) function"<<endl;
|
||||
cout << "Start Daq(false) function" << endl;
|
||||
#endif
|
||||
StopDaqForGui();
|
||||
StopUpdatePlot();
|
||||
@ -220,7 +223,7 @@ void qDrawPlot::StartDaq(bool start){
|
||||
|
||||
int qDrawPlot::ResetDaqForGui(){
|
||||
if(!StopDaqForGui()) return 0;
|
||||
cout<<"Resetting image number"<<endl;
|
||||
cout << "Resetting image number" << endl;
|
||||
lastImageNumber = 0;
|
||||
return 1;
|
||||
}
|
||||
@ -236,7 +239,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
pthread_mutex_lock(&gui_acquisition_start_stop_mutex);
|
||||
//stop part, before start or restart
|
||||
if(gui_acquisition_thread_running){
|
||||
cout<<"Stopping current acquisition thread ...."<<endl;
|
||||
cout << "Stopping current acquisition thread ...." << endl;
|
||||
stop_signal = 1;//sorta useless right now
|
||||
gui_acquisition_thread_running = 0;
|
||||
}
|
||||
@ -259,7 +262,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
|
||||
|
||||
if(plot_in_scope==1) Clear1DPlot();
|
||||
cout<<"Starting new acquisition threadddd ...."<<endl;
|
||||
cout << "Starting new acquisition threadddd ...." << endl;
|
||||
// Setting the callback function to get data from software client
|
||||
myDet->registerDataCallback(&(GetDataCallBack),this);
|
||||
// Start acquiring data from server
|
||||
@ -270,7 +273,7 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
// This is manually done instead of keeping track of thread because
|
||||
// this thread returns immediately after executing the acquire command
|
||||
gui_acquisition_thread_running=1;
|
||||
cout<<"Started acquiring threaddd:"<<endl;
|
||||
cout << "Started acquiring threaddd:" << endl;
|
||||
}
|
||||
pthread_mutex_unlock(&gui_acquisition_start_stop_mutex);
|
||||
return gui_acquisition_thread_running;
|
||||
@ -279,9 +282,9 @@ bool qDrawPlot::StartOrStopThread(bool start){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
|
||||
cout<<"before acquire ...."<<endl;
|
||||
cout << "before acquire ...." << endl;
|
||||
((qDrawPlot*)this_pointer)->myDet->acquire(1);
|
||||
cout<<"after acquire ...."<<endl;
|
||||
cout << "after acquire ...." << endl;
|
||||
return this_pointer;
|
||||
}
|
||||
|
||||
@ -296,7 +299,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){
|
||||
|
||||
int qDrawPlot::GetData(detectorData *data){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Entering GetDatafunction"<<endl;
|
||||
cout << "Entering GetDatafunction" << endl;
|
||||
#endif
|
||||
if(!stop_signal){
|
||||
//not frame factor
|
||||
@ -305,6 +308,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
if(!data_pause_over){
|
||||
//lastImageNumber= currentFrame+1;
|
||||
currentFrame++;
|
||||
currentIndex++;
|
||||
return 0;
|
||||
}
|
||||
data_pause_over=false;
|
||||
@ -317,11 +321,12 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
else{
|
||||
//lastImageNumber= currentFrame+1;
|
||||
currentFrame++;
|
||||
currentIndex++;
|
||||
progress=(int)data->progressIndex;
|
||||
//if theres an old copy, try to get lock again
|
||||
if(oldCopy){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Copying old data: "<<oldFrameNumber<<endl;
|
||||
cout << "Copying old data: " << oldFrameNumber << endl;
|
||||
#endif
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
char temp_title[2000];
|
||||
@ -330,7 +335,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//1d
|
||||
if(plot_in_scope==1){
|
||||
// Titles
|
||||
sprintf(temp_title,"Frame %d",oldFrameNumber); histTitle[0] = temp_title;
|
||||
sprintf(temp_title,"Frame Index%d",oldFrameNumber); histTitle[0] = temp_title;
|
||||
// copy data//memcpy(histXAxis, xvalues,nPixelsX*sizeof(double));
|
||||
for(int i=currentPersistency;i>0;i--)
|
||||
memcpy(histYAxis[i],yvalues[i-1],nPixelsX*sizeof(double));
|
||||
@ -338,7 +343,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
}//2d
|
||||
else{
|
||||
// Titles
|
||||
sprintf(temp_title,"Image Number %d",oldFrameNumber);
|
||||
sprintf(temp_title,"Image Index %d",oldFrameNumber);
|
||||
imageTitle = temp_title;
|
||||
// copy data
|
||||
//memcpy(lastImageArray,image_data,nPixelsX*nPixelsY*sizeof(double));
|
||||
@ -354,6 +359,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
progress=(int)data->progressIndex;
|
||||
//lastImageNumber= currentFrame+1;
|
||||
currentFrame++;
|
||||
currentIndex++;
|
||||
return 0;
|
||||
}
|
||||
//what comes here has plot enabled AND (frame factor OR data pause over )
|
||||
@ -361,7 +367,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
|
||||
if((currentFrame)<(number_of_exposures)){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Reading in image: "<<currentFrame<<endl;
|
||||
cout << "Reading in image: " << currentIndex << endl;
|
||||
#endif
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
char temp_title[2000];
|
||||
@ -371,7 +377,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//1d
|
||||
if(plot_in_scope==1){
|
||||
// Titles
|
||||
sprintf(temp_title,"Frame %d",currentFrame); histTitle[0] = temp_title;
|
||||
sprintf(temp_title,"Frame Index %d",currentIndex); histTitle[0] = temp_title;
|
||||
// Persistency
|
||||
if(currentPersistency < persistency)currentPersistency++;
|
||||
else currentPersistency=persistency;
|
||||
@ -386,7 +392,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
//2d
|
||||
else{
|
||||
// Titles
|
||||
sprintf(temp_title,"Image Number %d",currentFrame);
|
||||
sprintf(temp_title,"Image Index %d",currentIndex);
|
||||
imageTitle = temp_title;
|
||||
// manufacture data for now
|
||||
for(unsigned int px=0;px<nPixelsX;px++)
|
||||
@ -400,7 +406,7 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
}//copies old data only if its frame factor
|
||||
else if(frameFactor){
|
||||
oldCopy = true;
|
||||
oldFrameNumber = currentFrame;
|
||||
oldFrameNumber = currentIndex;
|
||||
//1D
|
||||
if(plot_in_scope==1){
|
||||
// Persistency
|
||||
@ -419,10 +425,11 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
}
|
||||
}
|
||||
currentFrame++;
|
||||
currentIndex++;
|
||||
}
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Exiting GetData function"<<endl;
|
||||
cout << "Exiting GetData function" << endl;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@ -442,7 +449,7 @@ int qDrawPlot::GetScanDataCallBack(detectorData *data, void *this_pointer){
|
||||
|
||||
int qDrawPlot::GetScanData(detectorData *data){/*
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Entering GetScanDatafunction"<<endl;
|
||||
cout << "Entering GetScanDatafunction"<<endl;
|
||||
#endif
|
||||
if(!stop_signal){
|
||||
//if plot disabled, RETURN
|
||||
@ -516,7 +523,7 @@ void qDrawPlot::Clear1DPlot(){
|
||||
|
||||
void qDrawPlot::UpdatePlot(){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Entering UpdatePlot function"<<endl;
|
||||
cout << "Entering UpdatePlot function" << endl;
|
||||
#endif
|
||||
|
||||
plot_update_timer->stop();
|
||||
@ -528,7 +535,7 @@ void qDrawPlot::UpdatePlot(){
|
||||
if(lastImageNumber){
|
||||
if(histNBins){
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Last Image Number: "<<lastImageNumber<<endl;
|
||||
cout << "Last Image Number: " << lastImageNumber << endl;
|
||||
#endif
|
||||
Clear1DPlot();
|
||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||
@ -602,6 +609,7 @@ void qDrawPlot::UpdatePlot(){
|
||||
}// To start the next measurement
|
||||
else{
|
||||
emit SetCurrentMeasurementSignal(currentMeasurement);
|
||||
currentIndex++;
|
||||
StopDaqForGui();
|
||||
StartDaq(true);
|
||||
}
|
||||
@ -626,7 +634,7 @@ void qDrawPlot::ClonePlot(){
|
||||
}
|
||||
// no space for more clone widget references
|
||||
if(!found){
|
||||
cout<<"Too many clones"<<endl;
|
||||
cout << "Too many clones" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
// save height to keep maintain same height of plot
|
||||
@ -679,7 +687,7 @@ void qDrawPlot::CloseClones(){
|
||||
void qDrawPlot::CloneCloseEvent(int id){
|
||||
winClone[id]=0;
|
||||
#ifdef VERBOSE
|
||||
cout<<"Closing Clone Window id:"<<id<<endl;
|
||||
cout << "Closing Clone Window id:" << id << endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -718,7 +726,7 @@ void qDrawPlot::SetPersistency(int val){
|
||||
|
||||
void qDrawPlot::EnablePlot(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout<<"Plotting set to:"<<enable<<endl;
|
||||
cout << "Plotting set to:" << enable << endl;
|
||||
#endif
|
||||
plotEnable = enable;
|
||||
//if no plot, cant do setting range.
|
||||
|
@ -404,14 +404,17 @@ void qTabMeasurement::setAcquisitionPeriod(){
|
||||
lblPeriod->setToolTip(errPeriodTip);
|
||||
lblPeriod->setPalette(red);
|
||||
lblPeriod->setText("Acquisition Period:*");
|
||||
emit EnableNthFrameSignal(false);
|
||||
}
|
||||
else {
|
||||
spinPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setToolTip(acqPeriodTip);
|
||||
lblPeriod->setPalette(lblTimingMode->palette());
|
||||
lblPeriod->setText("Acquisition Period:");
|
||||
emit EnableNthFrameSignal(true);
|
||||
}
|
||||
|
||||
|
||||
//Check if the interval between plots is ok
|
||||
emit CheckPlotIntervalSignal();
|
||||
}
|
||||
@ -558,6 +561,7 @@ void qTabMeasurement::SetTimingMode(int mode){
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mode!=None){//Number of Probes
|
||||
if(myDet->getDetectorsType()==slsDetectorDefs::MYTHEN){
|
||||
lblNumProbes->setEnabled(true); spinNumProbes->setEnabled(true);
|
||||
@ -668,9 +672,19 @@ void qTabMeasurement::SetTimingMode(int mode){
|
||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
||||
|
||||
|
||||
//check if period is enabled and alright, only then the nth frame frequency is enabled
|
||||
if((lblPeriod->isEnabled())&&(lblPeriod->text()=="Acquisition Period:"))
|
||||
emit EnableNthFrameSignal(true);
|
||||
else emit EnableNthFrameSignal(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::EnableFileWrite(bool enable){
|
||||
#ifdef VERBOSE
|
||||
cout << "Enable File Write:" << enable << endl;
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
// Qt Include Headers
|
||||
#include <QStandardItemModel>
|
||||
// C++ Include Headers
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -52,8 +53,27 @@ qTabPlot::~qTabPlot(){
|
||||
|
||||
|
||||
void qTabPlot::SetupWidgetWindow(){
|
||||
scanLevel[0]=false;
|
||||
scanLevel[1]=false;
|
||||
//check if nth frame should be enabled
|
||||
enableNFrame = true;
|
||||
//according to timing mode
|
||||
slsDetectorDefs::externalCommunicationMode mode = myDet->setExternalCommunicationMode();
|
||||
if( (mode==slsDetectorDefs::GATE_FIX_NUMBER)||
|
||||
(mode==slsDetectorDefs::TRIGGER_FRAME) ||
|
||||
(mode==slsDetectorDefs::TRIGGER_WINDOW) ||
|
||||
((mode==slsDetectorDefs::AUTO_TIMING)&&((int)myDet->setTimer(slsDetectorDefs::FRAME_NUMBER,-1)==1)&&((int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1)==1)) )
|
||||
enableNFrame = false;
|
||||
//according to if exptime > acq period
|
||||
if((myDet->setTimer(slsDetectorDefs::ACQUISITION_TIME,-1)*(1E-9))>(myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-9)))
|
||||
enableNFrame = false;
|
||||
|
||||
|
||||
|
||||
//scan arguments
|
||||
btnGroupScan = new QButtonGroup(this);
|
||||
btnGroupScan->addButton(radioLevel0,0);
|
||||
btnGroupScan->addButton(radioLevel1,1);
|
||||
btnGroupScan->addButton(radioFileIndex,2);
|
||||
btnGroupScan->addButton(radioAllFrames,3);
|
||||
|
||||
// Plot Axis
|
||||
myPlot->SetPlotTitle(defaultPlotTitle);
|
||||
@ -129,10 +149,10 @@ void qTabPlot::Select1DPlot(bool b){
|
||||
chkZAxis->setEnabled(false);
|
||||
chkZMin->setEnabled(false);
|
||||
chkZMax->setEnabled(false);
|
||||
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
||||
dispXAxis->setText(defaultHistXAxisTitle);
|
||||
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
||||
dispYAxis->setText(defaultHistYAxisTitle);
|
||||
myPlot->SetHistXAxisTitle(defaultHistXAxisTitle);
|
||||
myPlot->SetHistYAxisTitle(defaultHistYAxisTitle);
|
||||
myPlot->Select1DPlot();
|
||||
}else{
|
||||
box1D->hide();
|
||||
@ -140,22 +160,12 @@ void qTabPlot::Select1DPlot(bool b){
|
||||
chkZAxis->setEnabled(true);
|
||||
chkZMin->setEnabled(true);
|
||||
chkZMax->setEnabled(true);
|
||||
|
||||
//threshold scan
|
||||
if((scanLevel[0]==2)||(scanLevel[1]==2)){
|
||||
myPlot->SetImageXAxisTitle("Channel Number");
|
||||
dispXAxis->setText("Channel Number");
|
||||
dispYAxis->setText("Threshold");
|
||||
myPlot->SetImageYAxisTitle("Threshold");
|
||||
}
|
||||
else{
|
||||
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
|
||||
dispXAxis->setText(defaultImageXAxisTitle);
|
||||
dispYAxis->setText(defaultImageYAxisTitle);
|
||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
||||
}
|
||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||
dispXAxis->setText(defaultImageXAxisTitle);
|
||||
dispYAxis->setText(defaultImageYAxisTitle);
|
||||
dispZAxis->setText(defaultImageZAxisTitle);
|
||||
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
|
||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||
myPlot->Select2DPlot();
|
||||
}
|
||||
|
||||
@ -172,7 +182,7 @@ void qTabPlot::Initialization(){
|
||||
connect(radioHistogram, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
|
||||
connect(radioDataGraph, SIGNAL(toggled(bool)),this, SLOT(SetPlot()));
|
||||
// Scan box
|
||||
//connect(scna, SIGNAL(toggled(bool)),this, SLOT(scanstuff(bool)));
|
||||
connect(btnGroupScan, SIGNAL(buttonClicked(QAbstractButton *)),this, SLOT(SetScanArgument()));
|
||||
// Snapshot box
|
||||
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
|
||||
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
|
||||
@ -213,7 +223,8 @@ void qTabPlot::Initialization(){
|
||||
connect(dispYMax, SIGNAL(returnPressed()), this, SLOT(SetAxesRange()));
|
||||
connect(dispZMin, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
|
||||
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
|
||||
connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
|
||||
|
||||
connect(this,SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
|
||||
|
||||
// Common Buttons
|
||||
// Save
|
||||
@ -390,26 +401,16 @@ void qTabPlot::SetPlot(){
|
||||
myPlot->EnablePlot(true);
|
||||
//if enable is true, disable everything
|
||||
if(isOrginallyOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide();
|
||||
if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide();
|
||||
if(!isOrginallyOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide();
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
boxSnapshot->setEnabled(true);
|
||||
boxSave->setEnabled(true);
|
||||
boxFrequency->setEnabled(true);
|
||||
boxPlotAxis->setEnabled(true);
|
||||
EnableScanBox();
|
||||
}else{
|
||||
cout << " - Histogram" << endl;
|
||||
myPlot->EnablePlot(true);
|
||||
Select1DPlot(false);
|
||||
box1D->hide();
|
||||
box2D->show();
|
||||
box2D->setEnabled(true);
|
||||
boxSnapshot->setEnabled(true);
|
||||
boxSave->setEnabled(true);
|
||||
boxFrequency->setEnabled(false);
|
||||
boxPlotAxis->setEnabled(true);
|
||||
boxScan->setEnabled(false);
|
||||
myPlot->SetPlotTimer(250);
|
||||
emit ThresholdScanSignal(0);
|
||||
//select(2d) will set oneD to false, but originallyoneD will remember
|
||||
}
|
||||
}
|
||||
|
||||
@ -452,7 +453,7 @@ void qTabPlot::SetFrequency(){
|
||||
timeMS = (spinNthFrame->value())*acqPeriodMS;
|
||||
// To make sure the period between plotting is not less than minimum plot timer in ms
|
||||
if(timeMS<minPlotTimer){
|
||||
int minFrame = (ceil)(minPlotTimer/acqPeriodMS);
|
||||
int minFrame = (int)(ceil)(minPlotTimer/acqPeriodMS);
|
||||
qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>"
|
||||
"Condition to be satisfied:\n(Acquisition Period)*(nth Image) >= 250ms."
|
||||
"<br><br>Nth image adjusted to minimum, "
|
||||
@ -477,57 +478,87 @@ void qTabPlot::SetFrequency(){
|
||||
|
||||
|
||||
void qTabPlot::EnableScanBox(int mode,int id){
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering Enable Scan Box()" << endl;
|
||||
#ifdef VERYVERBOSE
|
||||
cout << "Entering Enable Scan Box() \t mode:" << mode << " \t id:" << id << endl;
|
||||
#endif
|
||||
|
||||
int mode0 = myDet->getScanMode(0);
|
||||
int mode1 = myDet->getScanMode(1);
|
||||
|
||||
scanLevel[id]=mode;
|
||||
//both are disabled
|
||||
if((!scanLevel[0])&&(!scanLevel[1])){
|
||||
boxScan->setEnabled(false);
|
||||
}//both are enabled
|
||||
else if((scanLevel[0])&&(scanLevel[1])){
|
||||
//disable none and check the other
|
||||
if(id) {radioLevel1->setEnabled(true);radioLevel1->setChecked(true);}
|
||||
else {radioLevel0->setEnabled(true);radioLevel0->setChecked(true);}
|
||||
}//either 1 is enabled/disabled
|
||||
else{
|
||||
if(!boxScan->isEnabled()) {
|
||||
boxScan->setEnabled(true);
|
||||
radioFileIndex->setEnabled(false);/**???*/
|
||||
boxScan->setEnabled(mode0||mode1);
|
||||
|
||||
if(boxScan->isEnabled()){
|
||||
//make sure nth frame frequency plot is disabled
|
||||
EnablingNthFrameFunction(false);
|
||||
|
||||
//if level0 or 1, check argument to find which scan enabled last from actions tab
|
||||
if((btnGroupScan->checkedId()!=2)&&(btnGroupScan->checkedId()!=3)){
|
||||
cout<<"mode:"<<mode<<" id:"<<id<<endl;
|
||||
//if mode is not none(doesnt check them if called form refresh)
|
||||
if(mode>0){
|
||||
if(!id) radioLevel0->setChecked(true);
|
||||
else radioLevel1->setChecked(true);
|
||||
}
|
||||
}
|
||||
//disable one and check the other
|
||||
if(id) {
|
||||
radioLevel0->setEnabled(!mode);
|
||||
radioLevel0->setChecked(!mode);
|
||||
radioLevel1->setEnabled(mode);
|
||||
radioLevel1->setChecked(mode);
|
||||
}else{
|
||||
radioLevel0->setEnabled(mode);
|
||||
radioLevel0->setChecked(mode);
|
||||
radioLevel1->setEnabled(!mode);
|
||||
radioLevel1->setChecked(!mode);
|
||||
|
||||
radioLevel0->setEnabled(mode0);
|
||||
radioLevel1->setEnabled(mode1);
|
||||
}else EnablingNthFrameFunction(enableNFrame);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
//check for threshold
|
||||
if((scanLevel[0]==2)||(scanLevel[1]==2))
|
||||
radioHistogram->setChecked(true);
|
||||
else
|
||||
radioDataGraph->setChecked(true);
|
||||
|
||||
/*
|
||||
if(boxScan->isEnabled()){
|
||||
myDet->setPlotType(i);
|
||||
}*/
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
void qTabPlot::SetScanArgument(){
|
||||
switch(btnGroupScan->checkedId()){
|
||||
//level0
|
||||
case 0:
|
||||
break;
|
||||
|
||||
//level1
|
||||
case 1:
|
||||
break;
|
||||
|
||||
//file index
|
||||
case 2:
|
||||
break;
|
||||
|
||||
//all frames
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabPlot::Refresh(){
|
||||
SetFrequency();
|
||||
EnableScanBox();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user