mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +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:
parent
197de5c995
commit
a79c5c6183
@ -60,7 +60,7 @@
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="gridLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
@ -120,7 +120,7 @@
|
||||
<item row="3" column="2">
|
||||
<widget class="QDoubleSpinBox" name="spinExpTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -167,7 +167,7 @@
|
||||
<item row="3" column="3">
|
||||
<widget class="QComboBox" name="comboExpUnit">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<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">
|
||||
<widget class="QDoubleSpinBox" name="spinThreshold">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<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">
|
||||
<widget class="QCheckBox" name="chkOptimize">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
qDefs(){};
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
#define GUI_VERSION 0.1
|
||||
#define GUI_VERSION 0.11
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -369,6 +369,10 @@ double* histYAxis[MAX_1DPLOTS];
|
||||
double* histXAngleAxis;
|
||||
/** Y Axis for angles in 1D (no persistency) */
|
||||
double* histYAngleAxis;
|
||||
/** X Axis for trimbits in 1D */
|
||||
double* histTrimbits;
|
||||
|
||||
|
||||
/** Current Image Values in 2D */
|
||||
double* lastImageArray;
|
||||
|
||||
|
@ -82,7 +82,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
histNBins = 0;
|
||||
histXAxis = 0;
|
||||
histXAngleAxis = 0;
|
||||
histYAngleAxis = 0;
|
||||
histYAngleAxis = 0;histTrimbits=0;
|
||||
persistency = 0;
|
||||
currentPersistency = 0;
|
||||
|
||||
@ -1190,90 +1190,98 @@ void qDrawPlot::DisableZoom(bool disable){
|
||||
|
||||
int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
||||
int ret,i,actualPixelsX;
|
||||
double *temp;
|
||||
//double *temp=0,*trimXAxis=0,*trimYAxis=0;
|
||||
#ifdef VERBOSE
|
||||
if(fromDetector) cout << "Geting Trimbits from Detector: ";
|
||||
else cout << "Getting Trimbits from Shared Memory: ";
|
||||
if(Histogram) cout << "Histogram" << endl;
|
||||
else cout << "Data Graph" << endl;
|
||||
if(fromDetector) cout << "Geting Trimbits from Detector" << endl;
|
||||
else cout << "Getting Trimbits from Shared Memory" << endl;
|
||||
#endif
|
||||
|
||||
slsDetectorDefs::detectorType detType = myDet->getDetectorsType();
|
||||
if(detType == slsDetectorDefs::MYTHEN){
|
||||
|
||||
switch(myDet->getDetectorsType()){
|
||||
|
||||
|
||||
case slsDetectorDefs::MYTHEN:
|
||||
//get trimbits
|
||||
actualPixelsX = myDet->getTotalNumberOfChannels();
|
||||
temp = new double[actualPixelsX];
|
||||
ret = myDet->getChanRegs(temp,fromDetector);
|
||||
if(histTrimbits) delete [] histTrimbits; histTrimbits = new double[actualPixelsX];
|
||||
ret = myDet->getChanRegs(histTrimbits,fromDetector);
|
||||
if(!ret){
|
||||
qDefs::Message(qDefs::WARNING,"No Trimbit data found in shared memory.","Dock");
|
||||
return qDefs::FAIL;
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Got Trimbits" << endl;
|
||||
#endif
|
||||
//defining axes
|
||||
if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX;
|
||||
if(Histogram) nPixelsX = TRIM_HISTOGRAM_XMAX+1;
|
||||
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
|
||||
for(unsigned int px=0;px<nPixelsX;px++) histXAxis[px] = px;
|
||||
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
|
||||
for(unsigned int px=0;px<(int)nPixelsX;px++) histXAxis[px] = px;
|
||||
for(i=0;i<nPixelsX;i++) histYAxis[0][i] = 0;
|
||||
|
||||
//clear/select plot and set titles
|
||||
Clear1DPlot();
|
||||
Select1DPlot();
|
||||
|
||||
|
||||
if(!Histogram){
|
||||
cout << "Data Graph:" << nPixelsX << endl;
|
||||
//data
|
||||
memcpy(histYAxis[0],temp,nPixelsX*sizeof(double));
|
||||
memcpy(histYAxis[0],histTrimbits,nPixelsX*sizeof(double));
|
||||
//title
|
||||
SetPlotTitle("Trimbits Plot - Data Graph");
|
||||
boxPlot->setTitle("Trimbits Plot - Data Graph");
|
||||
plot1D->SetXTitle("Channel Number");
|
||||
plot1D->SetYTitle("Trimbits");
|
||||
//set plot parameters
|
||||
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->setTitle(GetHistTitle(0));
|
||||
//attach plot
|
||||
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))
|
||||
cout<<"HIsty["<<i<<"]:"<<histYAxis[0][i]<<endl;*/
|
||||
|
||||
//delete [] histTrimbits;
|
||||
//title
|
||||
SetPlotTitle("Trimbits Plot - Histogram");
|
||||
boxPlot->setTitle("Trimbits Plot - Histogram");
|
||||
plot1D->SetXTitle("Trimbits");
|
||||
plot1D->SetYTitle("Frequency");
|
||||
//set plot parameters
|
||||
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->setTitle(GetHistTitle(0));
|
||||
//attach plot
|
||||
h->Attach(plot1D);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef VERBOSE
|
||||
cout << "Trimbits Plot updated" << endl;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
else if(detType == slsDetectorDefs::EIGER){
|
||||
|
||||
//2d
|
||||
case slsDetectorDefs::EIGER:
|
||||
//defining axes
|
||||
nPixelsX = 100;/**??*/
|
||||
nPixelsY = 100;
|
||||
@ -1299,16 +1307,10 @@ int qDrawPlot::UpdateTrimbitPlot(bool fromDetector,bool Histogram){
|
||||
#ifdef VERBOSE
|
||||
cout << "Trimbits Plot updated" << endl;
|
||||
#endif
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//shouldnt be here
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return qDefs::OK;
|
||||
}
|
||||
|
||||
|
@ -353,17 +353,17 @@ void qTabAdvanced::StartTrimming(){
|
||||
|
||||
//execute
|
||||
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)){
|
||||
//save trim file
|
||||
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");
|
||||
qDefs::Message(qDefs::INFORMATION,"The Trimbits have been saved successfully.","Advanced");
|
||||
//updates plots
|
||||
myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||
}
|
||||
else
|
||||
qDefs::Message(qDefs::WARNING,"Atleast 1 channel could not be trimmed.","Advanced");
|
||||
else qDefs::Message(qDefs::WARNING,string("Could not Save the Trimbits to file:\n")+dispFile->text().toAscii().constData(),"Advanced");
|
||||
}
|
||||
|
||||
|
||||
@ -371,10 +371,12 @@ void qTabAdvanced::StartTrimming(){
|
||||
|
||||
|
||||
void qTabAdvanced::UpdateTrimbitPlot(int id){
|
||||
//refresh
|
||||
if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||
//from detector
|
||||
else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked());
|
||||
if(boxPlot->isChecked()){
|
||||
//refresh
|
||||
if(!id) myPlot->UpdateTrimbitPlot(false,radioHistogram->isChecked());
|
||||
//from detector
|
||||
else myPlot->UpdateTrimbitPlot(true,radioHistogram->isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,7 +70,6 @@ void qTabSettings::SetupWidgetWindow(){
|
||||
void qTabSettings::SetupDetectorSettings(){
|
||||
// Get detector settings from detector
|
||||
slsDetectorDefs::detectorSettings sett = myDet->getSettings();
|
||||
|
||||
// To be able to index items on a combo box
|
||||
model = qobject_cast<QStandardItemModel*>(comboSettings->model());
|
||||
if (model) {
|
||||
@ -268,10 +267,9 @@ void qTabSettings::Refresh(){
|
||||
#ifdef VERBOSE
|
||||
cout << "Getting settings" << endl;
|
||||
#endif
|
||||
SetupDetectorSettings();
|
||||
//changin the combo settings also plots the trimbits for mythen and eiger, so disconnect
|
||||
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)));
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user