mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-14 13:57:13 +02:00
bug fix:scans: backward scan plotting works now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@76 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
@ -439,6 +439,9 @@ QString fileName;
|
|||||||
/** Max Number of Clone Windows */
|
/** Max Number of Clone Windows */
|
||||||
static const int TRIM_HISTOGRAM_XMAX = 63;
|
static const int TRIM_HISTOGRAM_XMAX = 63;
|
||||||
|
|
||||||
|
/**if the values increment backwards*/
|
||||||
|
bool backwardScanPlot;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -101,6 +101,8 @@ void qDrawPlot::SetupWidgetWindow(){
|
|||||||
scanArgument = None;
|
scanArgument = None;
|
||||||
|
|
||||||
alreadyDisplayed = false;
|
alreadyDisplayed = false;
|
||||||
|
|
||||||
|
backwardScanPlot = false;
|
||||||
// This is so that it initially stop and plots
|
// This is so that it initially stop and plots
|
||||||
running = 1;
|
running = 1;
|
||||||
for(int i=0;i<MAX_1DPLOTS;i++)
|
for(int i=0;i<MAX_1DPLOTS;i++)
|
||||||
@ -387,6 +389,15 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
|||||||
nPixelsY = numSteps;
|
nPixelsY = numSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(minPixelsY>maxPixelsY){
|
||||||
|
double temp = minPixelsY;
|
||||||
|
minPixelsY = maxPixelsY;
|
||||||
|
maxPixelsY = temp;
|
||||||
|
backwardScanPlot = true;
|
||||||
|
}else backwardScanPlot = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//1d
|
//1d
|
||||||
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
if(histXAxis) delete [] histXAxis; histXAxis = new double [nPixelsX];
|
||||||
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
if(histYAxis[0]) delete [] histYAxis[0];histYAxis[0] = new double [nPixelsX];
|
||||||
@ -455,7 +466,13 @@ void qDrawPlot::SetupMeasurement(int currentIndex){
|
|||||||
minPixelsY = currentIndex;
|
minPixelsY = currentIndex;
|
||||||
if(!running) nPixelsY = number_of_frames;
|
if(!running) nPixelsY = number_of_frames;
|
||||||
}//level0 or level1
|
}//level0 or level1
|
||||||
else currentScanValue = minPixelsY;
|
else {
|
||||||
|
currentScanValue = minPixelsY;
|
||||||
|
if(backwardScanPlot){
|
||||||
|
currentScanValue = maxPixelsY;
|
||||||
|
currentScanDivLevel = nPixelsY-1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//cannot divide by 0
|
//cannot divide by 0
|
||||||
if(nPixelsY==1){
|
if(nPixelsY==1){
|
||||||
@ -468,14 +485,14 @@ void qDrawPlot::SetupMeasurement(int currentIndex){
|
|||||||
endPixel = maxPixelsY + (pixelWidth/2);
|
endPixel = maxPixelsY + (pixelWidth/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
cout<<"nPixelsX:"<<nPixelsX<<endl;
|
cout<<"nPixelsX:"<<nPixelsX<<endl;
|
||||||
cout<<"nPixelsY:"<<nPixelsY<<endl;
|
cout<<"nPixelsY:"<<nPixelsY<<endl;
|
||||||
cout<<"minPixelsY:"<<minPixelsY<<endl;
|
cout<<"minPixelsY:"<<minPixelsY<<endl;
|
||||||
cout<<"maxPixelsY:"<<maxPixelsY<<endl;
|
cout<<"maxPixelsY:"<<maxPixelsY<<endl;
|
||||||
cout<<"startPixel:"<<startPixel<<endl;
|
cout<<"startPixel:"<<startPixel<<endl;
|
||||||
cout<<"endPixel:"<<endPixel<<endl<<endl;
|
cout<<"endPixel:"<<endPixel<<endl<<endl;
|
||||||
*/
|
|
||||||
UnlockLastImageArray();
|
UnlockLastImageArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -637,12 +654,14 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
//get scanvariable0
|
//get scanvariable0
|
||||||
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
||||||
int currentScanVariable0 = (int)cs0;
|
|
||||||
cout<<"currentScanValue:"<<currentScanValue<<endl;
|
cout<<"currentScanValue:"<<currentScanValue<<endl;
|
||||||
cout<<"currentScanVariable0:"<<currentScanVariable0<<endl;
|
cout<<"cs0:"<<cs0<<endl;
|
||||||
//variables
|
//variables
|
||||||
if(currentScanVariable0!=currentScanValue) currentScanDivLevel++;
|
if(cs0!=currentScanValue) {
|
||||||
currentScanValue = currentScanVariable0;
|
if(backwardScanPlot) currentScanDivLevel--;
|
||||||
|
else currentScanDivLevel++;
|
||||||
|
}
|
||||||
|
currentScanValue = cs0;
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
//title
|
//title
|
||||||
char temp_title[2000];
|
char temp_title[2000];
|
||||||
@ -663,10 +682,12 @@ int qDrawPlot::GetData(detectorData *data){
|
|||||||
//get scanvariable1
|
//get scanvariable1
|
||||||
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
int currentIndex = 0, p = 0; double cs0 = 0 , cs1 = 0;
|
||||||
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
fileIOStatic::getVariablesFromFileName(string(data->fileName), currentIndex, p, cs0, cs1);
|
||||||
int currentScanVariable1 = (int)cs1;
|
|
||||||
//variables
|
//variables
|
||||||
if(currentScanVariable1!=currentScanValue) currentScanDivLevel++;
|
if(cs1!=currentScanValue){
|
||||||
currentScanValue = currentScanVariable1;
|
if(backwardScanPlot) currentScanDivLevel--;
|
||||||
|
else currentScanDivLevel++;
|
||||||
|
}
|
||||||
|
currentScanValue = cs1;
|
||||||
lastImageNumber= currentFrame+1;
|
lastImageNumber= currentFrame+1;
|
||||||
//title
|
//title
|
||||||
char temp_title[2000];
|
char temp_title[2000];
|
||||||
@ -906,6 +927,8 @@ void qDrawPlot::UpdatePlot(){
|
|||||||
if(lastImageArray){
|
if(lastImageArray){
|
||||||
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
|
if(lastImageNumber&&last_plot_number!=(int)lastImageNumber && //there is a new plot
|
||||||
nPixelsX>0&&nPixelsY>0){
|
nPixelsX>0&&nPixelsY>0){
|
||||||
|
cout<<"startpixel:"<<startPixel<<endl;
|
||||||
|
cout<<"endpixel:"<<endPixel<<endl;
|
||||||
//plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
|
//plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,-0.5,nPixelsY-0.5,lastImageArray);
|
||||||
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
|
||||||
plot2D->setTitle(GetImageTitle());
|
plot2D->setTitle(GetImageTitle());
|
||||||
|
Reference in New Issue
Block a user