mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
fixed advanced tab, optimize settings, threshold and exposure time enabling, histogram plotting crashing
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@68 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -60,7 +60,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="checked">
|
<property name="checked">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
@ -120,7 +120,7 @@
|
|||||||
<item row="3" column="2">
|
<item row="3" column="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -167,7 +167,7 @@
|
|||||||
<item row="3" column="3">
|
<item row="3" column="3">
|
||||||
<widget class="QComboBox" name="comboExpUnit">
|
<widget class="QComboBox" name="comboExpUnit">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -339,7 +339,7 @@ An extension given by the modules serial number will be attached.
|
|||||||
<item row="3" column="7" colspan="2">
|
<item row="3" column="7" colspan="2">
|
||||||
<widget class="QDoubleSpinBox" name="spinThreshold">
|
<widget class="QDoubleSpinBox" name="spinThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
@ -402,7 +402,7 @@ An extension given by the modules serial number will be attached.
|
|||||||
<item row="0" column="5">
|
<item row="0" column="5">
|
||||||
<widget class="QCheckBox" name="chkOptimize">
|
<widget class="QCheckBox" name="chkOptimize">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
qDefs(){};
|
qDefs(){};
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
#define GUI_VERSION 0.1
|
#define GUI_VERSION 0.11
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -369,6 +369,10 @@ double* histYAxis[MAX_1DPLOTS];
|
|||||||
double* histXAngleAxis;
|
double* histXAngleAxis;
|
||||||
/** Y Axis for angles in 1D (no persistency) */
|
/** Y Axis for angles in 1D (no persistency) */
|
||||||
double* histYAngleAxis;
|
double* histYAngleAxis;
|
||||||
|
/** X Axis for trimbits in 1D */
|
||||||
|
double* histTrimbits;
|
||||||
|
|
||||||
|
|
||||||
/** Current Image Values in 2D */
|
/** Current Image Values in 2D */
|
||||||
double* lastImageArray;
|
double* lastImageArray;
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
histNBins = 0;
|
histNBins = 0;
|
||||||
histXAxis = 0;
|
histXAxis = 0;
|
||||||
histXAngleAxis = 0;
|
histXAngleAxis = 0;
|
||||||
histYAngleAxis = 0;
|
histYAngleAxis = 0;histTrimbits=0;
|
||||||
persistency = 0;
|
persistency = 0;
|
||||||
currentPersistency = 0;
|
currentPersistency = 0;
|
||||||
|
|
||||||
@ -1190,90 +1190,98 @@ void qDrawPlot::DisableZoom(bool disable){
|
|||||||
|
|
||||||
int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
||||||
int ret,i,actualPixelsX;
|
int ret,i,actualPixelsX;
|
||||||
double *temp;
|
//double *temp=0,*trimXAxis=0,*trimYAxis=0;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
if(fromDetector) cout << "Geting Trimbits from Detector: ";
|
if(fromDetector) cout << "Geting Trimbits from Detector" << endl;
|
||||||
else cout << "Getting Trimbits from Shared Memory: ";
|
else cout << "Getting Trimbits from Shared Memory" << endl;
|
||||||
if(Histogram) cout << "Histogram" << endl;
|
|
||||||
else cout << "Data Graph" << endl;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
|
||||||
|
if(detType == slsDetectorDefs::MYTHEN){
|
||||||
|
|
||||||
switch(myDet->getDetectorsType()){
|
|
||||||
|
|
||||||
|
|
||||||
case slsDetectorDefs::MYTHEN:
|
|
||||||
//get trimbits
|
//get trimbits
|
||||||
actualPixelsX = myDet->getTotalNumberOfChannels();
|
actualPixelsX = myDet->getTotalNumberOfChannels();
|
||||||
temp = new double[actualPixelsX];
|
if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX];
|
||||||
ret = myDet->getChanRegs(temp,fromDetector);
|
ret = myDet->getChanRegs(histTrimbits,fromDetector);
|
||||||
if(!ret){
|
if(!ret){
|
||||||
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock");
|
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock");
|
||||||
return qDefs::FAIL;
|
return qDefs::FAIL;
|
||||||
}
|
}
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Got Trimbits" << endl;
|
||||||
|
#endif
|
||||||
//defining axes
|
//defining axes
|
||||||
if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX;
|
if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1;
|
||||||
else nPixelsX = actualPixelsX;
|
else nPixelsX = actualPixelsX;
|
||||||
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
|
||||||
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
||||||
|
if(histYAxis[0]) delete [] histYAxis[0]; histYAxis[0]= new double [nPixelsX];
|
||||||
//initializing
|
//initializing
|
||||||
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;
|
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;
|
||||||
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
|
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
|
||||||
|
|
||||||
//clear/select plot and set titles
|
//clear/select plot and set titles
|
||||||
Clear1DPlot();
|
Clear1DPlot();
|
||||||
Select1DPlot();
|
Select1DPlot();
|
||||||
|
|
||||||
|
|
||||||
if(!Histogram){
|
if(!Histogram){
|
||||||
|
cout << "Data Graph:" << nPixelsX << endl;
|
||||||
//data
|
//data
|
||||||
memcpy(histYAxis[0],temp,nPixelsX*sizeof(double));
|
memcpy(histYAxis[0],histTrimbits,nPixelsX*sizeof(double));
|
||||||
//title
|
//title
|
||||||
SetPlotTitle("Trimbits Plot - Data Graph");
|
boxPlot->setTitle("Trimbits Plot - Data Graph");
|
||||||
plot1D->SetXTitle("Channel Number");
|
plot1D->SetXTitle("Channel Number");
|
||||||
plot1D->SetYTitle("Trimbits");
|
plot1D->SetYTitle("Trimbits");
|
||||||
//set plot parameters
|
//set plot parameters
|
||||||
SlsQtH1D* h;
|
SlsQtH1D* h;
|
||||||
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0)));
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0]));
|
||||||
h->SetLineColor(1);
|
h->SetLineColor(1);
|
||||||
h->setTitle(GetHistTitle(0));
|
h->setTitle(GetHistTitle(0));
|
||||||
//attach plot
|
//attach plot
|
||||||
h->Attach(plot1D);
|
h->Attach(plot1D);
|
||||||
}else{
|
}
|
||||||
//data
|
|
||||||
for(i=0;i<actualPixelsX;i++){
|
|
||||||
if((temp[i]<=TRIM_HISTOGRAM_XMAX))/**shouldnt be the case*/
|
|
||||||
histYAxis[0][(int)temp[i]]+=1;
|
|
||||||
else cout<<"OUT OF BOUNDS:"<<i<<"-"<<temp[i]<<endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* for(i=0;i<TRIM_HISTOGRAM_XMAX;i++)
|
else{
|
||||||
|
cout << "Histogram: " << nPixelsX-1 << endl;
|
||||||
|
//data
|
||||||
|
int value =0;
|
||||||
|
for(i=0;i<actualPixelsX;i++){
|
||||||
|
if((histTrimbits[i]<nPixelsX)&&(histTrimbits[i]>=0)){
|
||||||
|
value = (int) histTrimbits[i];
|
||||||
|
histYAxis[0][value]++;
|
||||||
|
}
|
||||||
|
else cout<<"OUT OF BOUNDS:"<<i<<"-"<<histTrimbits[i]<<endl;
|
||||||
|
}
|
||||||
|
/* for(i=0;i<TRIM_HISTOGRAM_XMAX;i++)
|
||||||
if((histYAxis[0][i]<=TRIM_HISTOGRAM_XMAX)&&(histYAxis[0][i]>0))
|
if((histYAxis[0][i]<=TRIM_HISTOGRAM_XMAX)&&(histYAxis[0][i]>0))
|
||||||
cout<<"HIsty["<<i<<"]:"<<histYAxis[0][i]<<endl;*/
|
cout<<"HIsty["<<i<<"]:"<<histYAxis[0][i]<<endl;*/
|
||||||
|
|
||||||
|
//delete [] histTrimbits;
|
||||||
//title
|
//title
|
||||||
SetPlotTitle("Trimbits Plot - Histogram");
|
boxPlot->setTitle("Trimbits Plot - Histogram");
|
||||||
plot1D->SetXTitle("Trimbits");
|
plot1D->SetXTitle("Trimbits");
|
||||||
plot1D->SetYTitle("Frequency");
|
plot1D->SetYTitle("Frequency");
|
||||||
//set plot parameters
|
//set plot parameters
|
||||||
SlsQtH1D* h;
|
SlsQtH1D* h;
|
||||||
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,GetHistYAxis(0)));
|
plot1D_hists.append(h=new SlsQtH1D("1d plot",nPixelsX,histXAxis,histYAxis[0]));
|
||||||
h->SetLineColor(1);
|
h->SetLineColor(1);
|
||||||
h->setTitle(GetHistTitle(0));
|
h->setTitle(GetHistTitle(0));
|
||||||
//attach plot
|
//attach plot
|
||||||
h->Attach(plot1D);
|
h->Attach(plot1D);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Trimbits Plot updated" << endl;
|
cout << "Trimbits Plot updated" << endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
else if(detType == slsDetectorDefs::EIGER){
|
||||||
|
|
||||||
//2d
|
|
||||||
case slsDetectorDefs::EIGER:
|
|
||||||
//defining axes
|
//defining axes
|
||||||
nPixelsX = 100;/**??*/
|
nPixelsX = 100;/**??*/
|
||||||
nPixelsY = 100;
|
nPixelsY = 100;
|
||||||
@ -1299,16 +1307,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Trimbits Plot updated" << endl;
|
cout << "Trimbits Plot updated" << endl;
|
||||||
#endif
|
#endif
|
||||||
break;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//shouldnt be here
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return qDefs::OK;
|
return qDefs::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,17 +353,17 @@ void qTabAdvanced::StartTrimming(){
|
|||||||
|
|
||||||
//execute
|
//execute
|
||||||
int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1);
|
int ret = myDet->executeTrimming(trimmingMode,parameter1,parameter2,-1);
|
||||||
|
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1));
|
||||||
|
else
|
||||||
|
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
|
||||||
|
//save trim file
|
||||||
|
ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1);
|
||||||
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){
|
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1)){
|
||||||
//save trim file
|
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
|
||||||
ret = myDet->saveSettingsFile(string(dispFile->text().toAscii().constData()),-1);
|
|
||||||
if((ret!=slsDetectorDefs::FAIL)&&(ret!=-1))
|
|
||||||
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
|
|
||||||
else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
|
|
||||||
//updates plots
|
//updates plots
|
||||||
myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||||
}
|
}
|
||||||
else
|
else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
|
||||||
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -371,10 +371,12 @@ void qTabAdvanced::StartTrimming(){
|
|||||||
|
|
||||||
|
|
||||||
void qTabAdvanced::UpdateTrimbitPlot(int id){
|
void qTabAdvanced::UpdateTrimbitPlot(int id){
|
||||||
//refresh
|
if(boxPlot->isChecked()){
|
||||||
if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
//refresh
|
||||||
//from detector
|
if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||||
else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked());
|
//from detector
|
||||||
|
else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ void qTabSettings::SetupWidgetWindow(){
|
|||||||
void qTabSettings::SetupDetectorSettings(){
|
void qTabSettings::SetupDetectorSettings(){
|
||||||
// Get detector settings from detector
|
// Get detector settings from detector
|
||||||
slsDetectorDefs::detectorSettings sett = myDet->getSettings();
|
slsDetectorDefs::detectorSettings sett = myDet->getSettings();
|
||||||
|
|
||||||
// To be able to index items on a combo box
|
// To be able to index items on a combo box
|
||||||
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
||||||
if (model) {
|
if (model) {
|
||||||
@ -268,10 +267,9 @@ void qTabSettings::Refresh(){
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Getting settings" << endl;
|
cout << "Getting settings" << endl;
|
||||||
#endif
|
#endif
|
||||||
SetupDetectorSettings();
|
|
||||||
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
|
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
|
||||||
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
disconnect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
comboSettings->setCurrentIndex(myDet->getSettings());
|
SetupDetectorSettings();//comboSettings->setCurrentIndex(myDet->getSettings());
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this, SLOT(setSettings(int)));
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user