mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
fixed the dac problem
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@28 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
parent
63bfdb9cb9
commit
30c11d7589
@ -1051,7 +1051,7 @@
|
||||
<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">
|
||||
|
@ -264,7 +264,10 @@ private:
|
||||
static int GetDataCallBack(detectorData *data, void *this_pointer);
|
||||
/** This is called by the GetDataCallBack function to copy the data */
|
||||
int GetData(detectorData *data);
|
||||
|
||||
/** This is called by the detector class to copy the scan data it jus acquired */
|
||||
static int GetScanDataCallBack(detectorData *data, void *this_pointer);
|
||||
/** This is called by the GetDataCallBack function to copy the scan data */
|
||||
int GetScanData(detectorData *data);
|
||||
|
||||
public slots:
|
||||
/** To select 1D or 2D plot
|
||||
|
@ -145,7 +145,7 @@ void BrowseFileStepsPath();
|
||||
|
||||
|
||||
signals:
|
||||
void EnableScanBox(bool,int);
|
||||
void EnableScanBox(int,int);
|
||||
};
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ void SetPosition();
|
||||
void DeletePosition();
|
||||
|
||||
signals:
|
||||
void EnableScanBox(bool,int);
|
||||
void EnableScanBox(int,int);
|
||||
|
||||
};
|
||||
|
||||
|
@ -98,6 +98,12 @@ void UpdateFinished();
|
||||
*/
|
||||
void SetCurrentMeasurement(int val);
|
||||
|
||||
/** Sets the timing mode
|
||||
* @ param mode cane be None, Auto, Gated, Trigger Exposure Series,
|
||||
* Trigger Frame, Trigger Readout, External Trigger Window
|
||||
*/
|
||||
void SetTimingMode(int mode);
|
||||
|
||||
private slots:
|
||||
/** Set number of measurements
|
||||
* @param num number of measurements to be set */
|
||||
@ -117,12 +123,6 @@ void setRunIndex(int index);
|
||||
*/
|
||||
void startStopAcquisition();
|
||||
|
||||
/** Sets the timing mode
|
||||
* @ param mode cane be None, Auto, Gated, Trigger Exposure Series,
|
||||
* Trigger Frame, Trigger Readout, External Trigger Window
|
||||
*/
|
||||
void setTimingMode(int mode);
|
||||
|
||||
/** Set number of frames
|
||||
* @param val number of frames to be set
|
||||
*/
|
||||
|
@ -49,8 +49,9 @@ private:
|
||||
|
||||
/** 1d/2d plot */
|
||||
bool isOneD;
|
||||
bool isOrginallyOneD;
|
||||
|
||||
bool scanLevel[2];
|
||||
int scanLevel[2];
|
||||
|
||||
QStackedLayout* stackedLayout;
|
||||
QSpinBox *spinNthFrame;
|
||||
@ -84,7 +85,7 @@ 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(bool enable,int id);
|
||||
void EnableScanBox(int mode,int id);
|
||||
|
||||
|
||||
|
||||
@ -118,6 +119,7 @@ signals:
|
||||
void DisableZoomSignal(bool);
|
||||
void SetZRangeSignal(double,double);
|
||||
void EnableZRangeSignal(bool);
|
||||
void ThresholdScanSignal(int);
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@ UI_HEADERS_DIR = forms/include
|
||||
RESOURCES += icons.qrc
|
||||
|
||||
|
||||
DEFINES += VERBOSE
|
||||
DEFINES += VERBOSE DACS_INT
|
||||
|
||||
|
||||
target.path += $(DESTDIR)
|
||||
|
@ -138,7 +138,7 @@ void qDetectorMain::SetUpWidgetWindow(){
|
||||
// increase the width so it uses all the empty space for the tab titles
|
||||
tabs->tabBar()->setFixedWidth(width()+61);
|
||||
|
||||
// mode setup - to set up the tabs initially as disabled, not in form so done here
|
||||
// mode setup - to set up the tabs initially as disabled, not in form so done here
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Debug Mode to 0\nSetting Beamline Mode to 0\n"
|
||||
"Setting Expert Mode to 0\nSetting Dockable Mode to false\n"
|
||||
@ -224,9 +224,9 @@ void qDetectorMain::Initialization(){
|
||||
connect(tab_measurement, SIGNAL(CheckPlotIntervalSignal()), tab_plot,SLOT(SetFrequency()));
|
||||
// Plot tab
|
||||
connect(tab_plot, SIGNAL(DisableZoomSignal(bool)), this,SLOT(SetZoomToolTip(bool)));
|
||||
connect(tab_plot, SIGNAL(ThresholdScanSignal(int)), tab_measurement,SLOT(SetTimingMode(int)));
|
||||
// Actions tab
|
||||
connect(tab_actions, SIGNAL(EnableScanBox(bool,int)), tab_plot,SLOT(EnableScanBox(bool,int)));
|
||||
|
||||
connect(tab_actions, SIGNAL(EnableScanBox(int,int)), tab_plot,SLOT(EnableScanBox(int,int)));
|
||||
// Plotting
|
||||
// When the acquisition is finished, must update the meas tab
|
||||
connect(myPlot, SIGNAL(UpdatingPlotFinished()), this, SLOT(EnableTabs()));
|
||||
@ -453,6 +453,14 @@ void qDetectorMain::resizeEvent(QResizeEvent* event){
|
||||
centralwidget->setMaximumHeight(heightCentralWidget);
|
||||
}
|
||||
}
|
||||
|
||||
//adjusting tab width
|
||||
if(width()>=800){ tabs->tabBar()->setFixedWidth(width()+61);}
|
||||
else { tabs->tabBar()->setMinimumWidth(0);
|
||||
tabs->tabBar()->setExpanding(true);
|
||||
tabs->tabBar()->setUsesScrollButtons(true);
|
||||
}
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,8 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
lastImageNumber = 0;
|
||||
last_plot_number = 0;
|
||||
|
||||
nPixelsX = 1280; nPixelsY = 100;
|
||||
nPixelsX = myDet->getTotalNumberOfChannels();
|
||||
nPixelsY = 100;
|
||||
|
||||
lastImageArray = 0;
|
||||
image_data = 0;
|
||||
@ -426,8 +427,64 @@ int qDrawPlot::GetData(detectorData *data){
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qDrawPlot::GetScanDataCallBack(detectorData *data, void *this_pointer){
|
||||
((qDrawPlot*)this_pointer)->GetScanData(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
int qDrawPlot::GetScanData(detectorData *data){/*
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Entering GetScanDatafunction"<<endl;
|
||||
#endif
|
||||
if(!stop_signal){
|
||||
//if plot disabled, RETURN
|
||||
if(!plotEnable) {
|
||||
progress=(int)data->progressIndex;
|
||||
//lastImageNumber= currentFrame+1;
|
||||
currentThrehold++;
|
||||
return 0;
|
||||
}
|
||||
//what comes here has plot enabled AND (frame factor OR data pause over )
|
||||
progress=(int)data->progressIndex;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Reading in image: "<<currentThrehold<<endl;
|
||||
#endif
|
||||
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
|
||||
char temp_title[2000];
|
||||
// only if you got the lock, do u need to remember lastimagenumber to plot
|
||||
lastImageNumber= currentThrehold+1;
|
||||
|
||||
nPixelsY = currentThrehold+1;
|
||||
// Titles
|
||||
sprintf(temp_title,"Adding Threshold %f",threhold[currentThrehold]);
|
||||
imageTitle = temp_title;
|
||||
// copy data
|
||||
memcpy(lastImageArray[i],data->values,nPixelsX*sizeof(double));
|
||||
|
||||
pthread_mutex_unlock(&(last_image_complete_mutex));
|
||||
}
|
||||
currentThrehold++;
|
||||
|
||||
}
|
||||
#ifdef VERYVERBOSE
|
||||
cout<<"Exiting GetScanData function"<<endl;
|
||||
#endif*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qDrawPlot::SelectPlot(int i){ //1 for 1D otherwise 2D
|
||||
if(i==1){
|
||||
plot1D->SetXTitle(histXAxisTitle.toAscii().constData());
|
||||
|
@ -323,9 +323,6 @@ void qScanWidget::SetMode(int mode){
|
||||
//set the group box widgets
|
||||
EnableSizeWidgets();
|
||||
|
||||
//emit signal to enable scanbox in plot tab
|
||||
emit EnableScanBox(mode,id);
|
||||
|
||||
//set the mode
|
||||
SetScan(mode);
|
||||
}
|
||||
@ -366,16 +363,20 @@ int qScanWidget::SetScan(int mode){
|
||||
break;
|
||||
}
|
||||
|
||||
//custom script
|
||||
int actualMode = myDet->getScanMode(id);
|
||||
if((mode==CustomScript)&&((script=="")||(script=="none"))){
|
||||
return qDefs::OK;
|
||||
}else{
|
||||
if((mode!=myDet->getScanMode(id))&&(actualNumSteps)){
|
||||
}else{//mode NOT set
|
||||
if((mode!=actualMode)&&(actualNumSteps)){
|
||||
qDefs::WarningMessage("The mode could not be changed for an unknown reason.","ScanWidget");
|
||||
comboScript->setCurrentIndex(myDet->getScanMode(id));
|
||||
comboScript->setCurrentIndex(actualMode);
|
||||
return qDefs::FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
emit EnableScanBox(actualMode,id);
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ void qTabActions::Initialization(){
|
||||
connect(group, SIGNAL(buttonClicked(QAbstractButton*)), this,SLOT(Expand(QAbstractButton*)));
|
||||
//enable scan box in plot tab
|
||||
for(int i=0;i<qScanWidget::NUM_SCAN_WIDGETS;i++)
|
||||
connect(scanWidget[i], SIGNAL(EnableScanBox(bool,int)), this,SIGNAL(EnableScanBox(bool,int)));
|
||||
connect(scanWidget[i], SIGNAL(EnableScanBox(int,int)), this,SIGNAL(EnableScanBox(int,int)));
|
||||
//positions
|
||||
connect(comboPos, SIGNAL(currentIndexChanged(int)), this, SLOT(SetPosition()));
|
||||
connect(spinNumPos, SIGNAL(valueChanged(int)), this, SLOT(SetPosition()));
|
||||
|
@ -182,11 +182,11 @@ void qTabDeveloper::CreateADCWidgets(){
|
||||
|
||||
|
||||
void qTabDeveloper::SetDacValues(int id){
|
||||
#ifdef VERYVERBOSE
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting dac:" <<dacNames[id] << " : " << spinDacs[id]->value() << endl;
|
||||
#endif
|
||||
|
||||
spinDacs[id]->setValue(myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id)));
|
||||
spinDacs[id]->setValue((double)myDet->setDAC(spinDacs[id]->value(),getSLSIndex(id)));
|
||||
}
|
||||
|
||||
|
||||
@ -246,7 +246,7 @@ void qTabDeveloper::RefreshAdcs(){
|
||||
#endif
|
||||
adcTimer->stop();
|
||||
for(int i=0;i<NUM_ADC_WIDGETS;i++)
|
||||
spinAdcs[i]->setValue(myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)));
|
||||
spinAdcs[i]->setValue((double)myDet->getADC(getSLSIndex(i+NUM_DAC_WIDGETS)));
|
||||
adcTimer->start(ADC_TIMEOUT);
|
||||
}
|
||||
|
||||
@ -260,8 +260,7 @@ void qTabDeveloper::Refresh(){
|
||||
#endif
|
||||
//dacs
|
||||
for(int i=0;i<NUM_DAC_WIDGETS;i++)
|
||||
spinDacs[i]->setValue(myDet->setDAC(-1,getSLSIndex(i)));
|
||||
|
||||
spinDacs[i]->setValue((double)myDet->setDAC(-1,getSLSIndex(i)));
|
||||
//adcs
|
||||
RefreshAdcs();
|
||||
}
|
||||
|
@ -143,15 +143,15 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
int triggers = (int)myDet->setTimer(slsDetectorDefs::CYCLES_NUMBER,-1);
|
||||
if((frames==1)&&(triggers==1)){
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
setTimingMode((int)None);
|
||||
SetTimingMode((int)None);
|
||||
}else{
|
||||
comboTimingMode->setCurrentIndex((int)Auto);
|
||||
setTimingMode((int)Auto);
|
||||
SetTimingMode((int)Auto);
|
||||
}
|
||||
}else{
|
||||
//mode +1 since the detector class has no timingmode as "None"
|
||||
comboTimingMode->setCurrentIndex((int)mode+1);
|
||||
setTimingMode((int)mode+1);
|
||||
SetTimingMode((int)mode+1);
|
||||
}
|
||||
}
|
||||
// Mode NOT ENABLED.
|
||||
@ -162,7 +162,7 @@ void qTabMeasurement::SetupTimingMode(){
|
||||
"\n\nSetting the following defaults:\nTiming Mode \t: None\n"
|
||||
"Number of Frames \t: 1\nNumber of Triggers \t: 1","Measurement");
|
||||
comboTimingMode->setCurrentIndex((int)None);
|
||||
setTimingMode((int)None);
|
||||
SetTimingMode((int)None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -183,7 +183,7 @@ void qTabMeasurement::Initialization(int timingChange){
|
||||
//Start/Stop Acquisition
|
||||
connect(btnStartStop, SIGNAL(clicked()), this, SLOT(startStopAcquisition()));
|
||||
//Timing Mode
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(setTimingMode(int)));//
|
||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));//
|
||||
//progress bar
|
||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||
//enable write to file
|
||||
@ -467,7 +467,7 @@ void qTabMeasurement::setNumProbes(int val){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabMeasurement::setTimingMode(int mode){
|
||||
void qTabMeasurement::SetTimingMode(int mode){
|
||||
#ifdef VERBOSE
|
||||
cout << "Setting Timing mode to " << comboTimingMode->currentText().toAscii().data() << endl;
|
||||
#endif
|
||||
|
@ -8,11 +8,11 @@
|
||||
#include "qTabPlot.h"
|
||||
#include "qDefs.h"
|
||||
#include "qDrawPlot.h"
|
||||
/** Project Class Headers */
|
||||
// Project Class Headers
|
||||
#include "slsDetector.h"
|
||||
#include "multiSlsDetector.h"
|
||||
/** Qt Include Headers */
|
||||
/** C++ Include Headers */
|
||||
// Qt Include Headers
|
||||
// C++ Include Headers
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <math.h>
|
||||
@ -55,7 +55,7 @@ void qTabPlot::SetupWidgetWindow(){
|
||||
scanLevel[0]=false;
|
||||
scanLevel[1]=false;
|
||||
|
||||
/** Plot Axis*/
|
||||
// Plot Axis
|
||||
myPlot->SetPlotTitle(defaultPlotTitle);
|
||||
dispTitle->setText(defaultPlotTitle);
|
||||
dispTitle->setEnabled(false);
|
||||
@ -75,7 +75,7 @@ void qTabPlot::SetupWidgetWindow(){
|
||||
dispYMax->setValidator(new QDoubleValidator(dispYMax));
|
||||
dispZMax->setValidator(new QDoubleValidator(dispZMax));
|
||||
|
||||
/** Plotting Frequency */
|
||||
// Plotting Frequency
|
||||
|
||||
stackedLayout = new QStackedLayout;
|
||||
stackedLayout->setSpacing(0);
|
||||
@ -106,13 +106,13 @@ void qTabPlot::SetupWidgetWindow(){
|
||||
stackWidget->setLayout(stackedLayout);
|
||||
|
||||
|
||||
/** Depending on whether the detector is 1d or 2d*/
|
||||
// Depending on whether the detector is 1d or 2d
|
||||
switch(myDet->getDetectorsType()){
|
||||
case slsDetectorDefs::MYTHEN: Select1DPlot(true); break;
|
||||
case slsDetectorDefs::EIGER: Select1DPlot(false);break;
|
||||
case slsDetectorDefs::GOTTHARD: Select1DPlot(true);break;
|
||||
case slsDetectorDefs::MYTHEN: isOrginallyOneD = true; Select1DPlot(true); break;
|
||||
case slsDetectorDefs::EIGER: isOrginallyOneD = false; Select1DPlot(false);break;
|
||||
case slsDetectorDefs::GOTTHARD: isOrginallyOneD = true; Select1DPlot(true);break;
|
||||
default:
|
||||
cout<<"ERROR: Detector Type is Generic"<<endl;
|
||||
cout << "ERROR: Detector Type is Generic" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
@ -140,10 +140,20 @@ void qTabPlot::Select1DPlot(bool b){
|
||||
chkZAxis->setEnabled(true);
|
||||
chkZMin->setEnabled(true);
|
||||
chkZMax->setEnabled(true);
|
||||
myPlot->SetImageXAxisTitle(defaultImageXAxisTitle);
|
||||
dispXAxis->setText(defaultImageXAxisTitle);
|
||||
myPlot->SetImageYAxisTitle(defaultImageYAxisTitle);
|
||||
dispYAxis->setText(defaultImageYAxisTitle);
|
||||
|
||||
//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);
|
||||
dispZAxis->setText(defaultImageZAxisTitle);
|
||||
myPlot->Select2DPlot();
|
||||
@ -157,29 +167,29 @@ void qTabPlot::Select1DPlot(bool b){
|
||||
|
||||
|
||||
void qTabPlot::Initialization(){
|
||||
/** Plot arguments box*/
|
||||
connect(radioNoPlot, SIGNAL(clicked()),this, SLOT(SetPlot()));
|
||||
connect(radioHistogram, SIGNAL(clicked()),this, SLOT(SetPlot()));
|
||||
connect(radioDataGraph, SIGNAL(clicked()),this, SLOT(SetPlot()));
|
||||
/** Scan box*/
|
||||
// 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()));
|
||||
// Scan box
|
||||
//connect(scna, SIGNAL(toggled(bool)),this, SLOT(scanstuff(bool)));
|
||||
/** Snapshot box*/
|
||||
// Snapshot box
|
||||
connect(btnClone, SIGNAL(clicked()),myPlot, SLOT(ClonePlot()));
|
||||
connect(btnCloseClones, SIGNAL(clicked()),myPlot, SLOT(CloseClones()));
|
||||
/** 1D Plot box*/
|
||||
// 1D Plot box
|
||||
connect(chkSuperimpose, SIGNAL(toggled(bool)), this, SLOT(EnablePersistency(bool)));
|
||||
connect(spinPersistency,SIGNAL(valueChanged(int)), myPlot,SLOT(SetPersistency(int)));
|
||||
connect(chkPoints, SIGNAL(toggled(bool)), myPlot, SLOT(SetDottedPlot(bool)));
|
||||
/** 2D Plot box*/
|
||||
// 2D Plot box
|
||||
connect(chkInterpolate, SIGNAL(toggled(bool)),myPlot, SIGNAL(InterpolateSignal(bool)));
|
||||
connect(chkContour, SIGNAL(toggled(bool)),myPlot, SIGNAL(ContourSignal(bool)));
|
||||
connect(chkLogz, SIGNAL(toggled(bool)),myPlot, SIGNAL(LogzSignal(bool)));
|
||||
/** Plotting frequency box */
|
||||
// Plotting frequency box
|
||||
connect(comboFrequency, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
||||
connect(comboTimeGapUnit,SIGNAL(currentIndexChanged(int)), this, SLOT(SetFrequency()));
|
||||
connect(spinTimeGap, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
||||
connect(spinNthFrame, SIGNAL(editingFinished()), this, SLOT(SetFrequency()));
|
||||
/** Plot Axis **/
|
||||
// Plot Axis *
|
||||
connect(chkTitle, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
|
||||
connect(chkXAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
|
||||
connect(chkYAxis, SIGNAL(toggled(bool)), this, SLOT(EnableTitles()));
|
||||
@ -205,8 +215,8 @@ void qTabPlot::Initialization(){
|
||||
connect(dispZMax, SIGNAL(returnPressed()), this, SLOT(SetZRange()));
|
||||
connect(this, SIGNAL(SetZRangeSignal(double,double)),myPlot, SIGNAL(SetZRangeSignal(double,double)));
|
||||
|
||||
/** Common Buttons*/
|
||||
/** Save */
|
||||
// Common Buttons
|
||||
// Save
|
||||
connect(btnSave, SIGNAL(clicked()), myPlot, SLOT(SavePlot()));
|
||||
}
|
||||
|
||||
@ -227,20 +237,20 @@ void qTabPlot::EnablePersistency(bool enable){
|
||||
|
||||
|
||||
void qTabPlot::SetTitles(){
|
||||
/** Plot Title*/
|
||||
// Plot Title
|
||||
if(dispTitle->isEnabled())
|
||||
myPlot->SetPlotTitle(dispTitle->text());
|
||||
/** X Axis */
|
||||
// X Axis
|
||||
if(dispXAxis->isEnabled()){
|
||||
if(isOneD) myPlot->SetHistXAxisTitle(dispXAxis->text());
|
||||
else myPlot->SetImageXAxisTitle(dispXAxis->text());
|
||||
}
|
||||
/** Y Axis */
|
||||
// Y Axis
|
||||
if(dispYAxis->isEnabled()){
|
||||
if(isOneD) myPlot->SetHistYAxisTitle(dispYAxis->text());
|
||||
else myPlot->SetImageYAxisTitle(dispYAxis->text());
|
||||
}
|
||||
/** Z Axis */
|
||||
// Z Axis
|
||||
if(dispZAxis->isEnabled())
|
||||
myPlot->SetImageZAxisTitle(dispZAxis->text());
|
||||
}
|
||||
@ -250,13 +260,13 @@ void qTabPlot::SetTitles(){
|
||||
|
||||
|
||||
void qTabPlot::EnableTitles(){
|
||||
/** Plot Title*/
|
||||
// Plot Title
|
||||
dispTitle->setEnabled(chkTitle->isChecked());
|
||||
if(!chkTitle->isChecked()){
|
||||
myPlot->SetPlotTitle(defaultPlotTitle);
|
||||
dispTitle->setText(defaultPlotTitle);
|
||||
}
|
||||
/** X Axis */
|
||||
// X Axis
|
||||
dispXAxis->setEnabled(chkXAxis->isChecked());
|
||||
if(!chkXAxis->isChecked()){
|
||||
if(isOneD){
|
||||
@ -268,7 +278,7 @@ void qTabPlot::EnableTitles(){
|
||||
dispXAxis->setText(defaultImageXAxisTitle);
|
||||
}
|
||||
}
|
||||
/** Y Axis */
|
||||
// Y Axis
|
||||
dispYAxis->setEnabled(chkYAxis->isChecked());
|
||||
if(!chkYAxis->isChecked()){
|
||||
if(isOneD){
|
||||
@ -279,7 +289,7 @@ void qTabPlot::EnableTitles(){
|
||||
dispYAxis->setText(defaultImageYAxisTitle);
|
||||
}
|
||||
}
|
||||
/** Z Axis */
|
||||
// Z Axis
|
||||
dispZAxis->setEnabled(chkZAxis->isChecked());
|
||||
if(!chkZAxis->isChecked()){
|
||||
myPlot->SetImageZAxisTitle(defaultImageZAxisTitle);
|
||||
@ -313,27 +323,27 @@ void qTabPlot::EnableRange(){
|
||||
|
||||
void qTabPlot::SetAxesRange(){
|
||||
bool changed = false;
|
||||
/** x min */
|
||||
// x min
|
||||
changed = (dispXMin->isEnabled())&&(!dispXMin->text().isEmpty());
|
||||
if(changed) myPlot->SetXYRangeValues(dispXMin->text().toDouble(),qDefs::XMINIMUM);
|
||||
myPlot->IsXYRangeValues(changed,qDefs::XMINIMUM);
|
||||
|
||||
/** x max */
|
||||
// x max
|
||||
changed = (dispXMax->isEnabled())&&(!dispXMax->text().isEmpty());
|
||||
if(changed) myPlot->SetXYRangeValues(dispXMax->text().toDouble(),qDefs::XMAXIMUM);
|
||||
myPlot->IsXYRangeValues(changed,qDefs::XMAXIMUM);
|
||||
|
||||
/** y min */
|
||||
// y min
|
||||
changed = (dispYMin->isEnabled())&&(!dispYMin->text().isEmpty());
|
||||
if(changed) myPlot->SetXYRangeValues(dispYMin->text().toDouble(),qDefs::YMINIMUM);
|
||||
myPlot->IsXYRangeValues(changed,qDefs::YMINIMUM);
|
||||
|
||||
/** y max */
|
||||
// y max
|
||||
changed = (dispYMax->isEnabled())&&(!dispYMax->text().isEmpty());
|
||||
if(changed) myPlot->SetXYRangeValues(dispYMax->text().toDouble(),qDefs::YMAXIMUM);
|
||||
myPlot->IsXYRangeValues(changed,qDefs::YMAXIMUM);
|
||||
|
||||
/** To remind the updateplot in qdrawplot to set range after updating plot*/
|
||||
// To remind the updateplot in qdrawplot to set range after updating plot
|
||||
myPlot->SetXYRange(true);
|
||||
}
|
||||
|
||||
@ -360,31 +370,46 @@ void qTabPlot::EnableZRange(){
|
||||
|
||||
|
||||
void qTabPlot::SetPlot(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering Set Plot()" ;
|
||||
#endif
|
||||
if(radioNoPlot->isChecked()){
|
||||
cout << " - No Plot" << endl;
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
myPlot->EnablePlot(false);
|
||||
/**if enable is true, disable everything */
|
||||
if(isOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();}
|
||||
if(!isOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();}
|
||||
//if enable is true, disable everything
|
||||
if(isOrginallyOneD) {box1D->show(); box1D->setEnabled(false); box2D->hide();}
|
||||
if(!isOrginallyOneD){box2D->show(); box2D->setEnabled(false); box1D->hide();}
|
||||
boxSnapshot->setEnabled(false);
|
||||
boxSave->setEnabled(false);
|
||||
boxFrequency->setEnabled(false);
|
||||
boxPlotAxis->setEnabled(false);
|
||||
boxScan->setEnabled(false);
|
||||
}else {
|
||||
}else if(radioDataGraph->isChecked()){
|
||||
cout << " - DataGraph" << endl;
|
||||
myPlot->EnablePlot(true);
|
||||
/**if enable is true, disable everything */
|
||||
if(isOneD) {box1D->show();box1D->setEnabled(true);} else box1D->hide();
|
||||
if(!isOneD){box2D->show();box2D->setEnabled(true);} else box2D->hide();
|
||||
//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();
|
||||
Select1DPlot(isOrginallyOneD);
|
||||
boxSnapshot->setEnabled(true);
|
||||
boxSave->setEnabled(true);
|
||||
boxFrequency->setEnabled(true);
|
||||
boxPlotAxis->setEnabled(true);
|
||||
|
||||
if(radioHistogram->isChecked())
|
||||
boxScan->setEnabled(false);
|
||||
else
|
||||
//check first if there is a scan from actions tab
|
||||
boxScan->setEnabled(false);
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +430,7 @@ void qTabPlot::SetFrequency(){
|
||||
stackedLayout->setCurrentIndex(comboFrequency->currentIndex());
|
||||
switch(comboFrequency->currentIndex()){
|
||||
case 0:
|
||||
/* Get the time interval from gui in ms*/
|
||||
// Get the time interval from gui in ms
|
||||
timeMS = (qDefs::getNSTime((qDefs::timeUnit)comboTimeGapUnit->currentIndex(),spinTimeGap->value()))/(1e6);
|
||||
if(timeMS<minPlotTimer){
|
||||
qDefs::WarningMessage("Interval between Plots - The Time Interval between plots "
|
||||
@ -413,19 +438,19 @@ void qTabPlot::SetFrequency(){
|
||||
spinTimeGap->setValue(minPlotTimer);
|
||||
comboTimeGapUnit->setCurrentIndex(qDefs::MILLISECONDS);
|
||||
}
|
||||
/**This is done so that its known which one was selected */
|
||||
//This is done so that its known which one was selected
|
||||
myPlot->SetFrameFactor(0);
|
||||
/** Setting the timer value(ms) between plots */
|
||||
// Setting the timer value(ms) between plots
|
||||
myPlot->SetPlotTimer(timeMS);
|
||||
#ifdef VERBOSE
|
||||
cout<<"Plotting Frequency: Time Gap - "<<spinTimeGap->value()<<qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex())<<endl;
|
||||
cout << "Plotting Frequency: Time Gap - " << spinTimeGap->value() << qDefs::getUnitString((qDefs::timeUnit)comboTimeGapUnit->currentIndex()) << endl;
|
||||
#endif
|
||||
break;
|
||||
case 1:
|
||||
acqPeriodMS = (myDet->setTimer(slsDetectorDefs::FRAME_PERIOD,-1)*(1E-6));
|
||||
/** gets the acq period * number of nth frames*/
|
||||
// gets the acq period * number of nth frames
|
||||
timeMS = (spinNthFrame->value())*acqPeriodMS;
|
||||
/** To make sure the period between plotting is not less than minimum plot timer in ms*/
|
||||
// To make sure the period between plotting is not less than minimum plot timer in ms
|
||||
if(timeMS<minPlotTimer){
|
||||
int minFrame = (ceil)(minPlotTimer/acqPeriodMS);
|
||||
qDefs::WarningMessage("<b>Plot Tab:</b> Interval between Plots - The nth Image must be larger.<br><br>"
|
||||
@ -434,10 +459,10 @@ void qTabPlot::SetFrequency(){
|
||||
"for the chosen Acquisition Period.","Plot");
|
||||
spinNthFrame->setValue(minFrame);
|
||||
}
|
||||
/** Setting the timer value (nth frames) between plots */
|
||||
// Setting the timer value (nth frames) between plots
|
||||
myPlot->SetFrameFactor(spinNthFrame->value());
|
||||
#ifdef VERBOSE
|
||||
cout<<"Plotting Frequency: Nth Frame - "<<spinNthFrame->value()<<endl;
|
||||
cout << "Plotting Frequency: Nth Frame - " << spinNthFrame->value() << endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -451,10 +476,13 @@ void qTabPlot::SetFrequency(){
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void qTabPlot::EnableScanBox(bool enable,int id){
|
||||
/**find out when this is enabled*/
|
||||
void qTabPlot::EnableScanBox(int mode,int id){
|
||||
#ifdef VERBOSE
|
||||
cout << "Entering Enable Scan Box()" << endl;
|
||||
#endif
|
||||
|
||||
scanLevel[id]=enable;
|
||||
|
||||
scanLevel[id]=mode;
|
||||
//both are disabled
|
||||
if((!scanLevel[0])&&(!scanLevel[1])){
|
||||
boxScan->setEnabled(false);
|
||||
@ -467,22 +495,30 @@ void qTabPlot::EnableScanBox(bool enable,int id){
|
||||
else{
|
||||
if(!boxScan->isEnabled()) {
|
||||
boxScan->setEnabled(true);
|
||||
radioFileIndex->setEnabled(false);
|
||||
radioFileIndex->setEnabled(false);/**???*/
|
||||
}
|
||||
//disable one and check the other
|
||||
if(id) {
|
||||
radioLevel0->setEnabled(!enable);
|
||||
radioLevel0->setChecked(!enable);
|
||||
radioLevel1->setEnabled(enable);
|
||||
radioLevel1->setChecked(enable);
|
||||
radioLevel0->setEnabled(!mode);
|
||||
radioLevel0->setChecked(!mode);
|
||||
radioLevel1->setEnabled(mode);
|
||||
radioLevel1->setChecked(mode);
|
||||
}else{
|
||||
radioLevel0->setEnabled(enable);
|
||||
radioLevel0->setChecked(enable);
|
||||
radioLevel1->setEnabled(!enable);
|
||||
radioLevel1->setChecked(!enable);
|
||||
radioLevel0->setEnabled(mode);
|
||||
radioLevel0->setChecked(mode);
|
||||
radioLevel1->setEnabled(!mode);
|
||||
radioLevel1->setChecked(!mode);
|
||||
}
|
||||
}
|
||||
/**if(boxScan->isEnabled()){
|
||||
|
||||
//check for threshold
|
||||
if((scanLevel[0]==2)||(scanLevel[1]==2))
|
||||
radioHistogram->setChecked(true);
|
||||
else
|
||||
radioDataGraph->setChecked(true);
|
||||
|
||||
/*
|
||||
if(boxScan->isEnabled()){
|
||||
myDet->setPlotType(i);
|
||||
}*/
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user