for receiver, display frame number since not in filename

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@112 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-11-15 11:18:56 +00:00
parent 7a6bba3c77
commit f201a6a32b
2 changed files with 30 additions and 16 deletions

View File

@ -192,10 +192,10 @@ int ResetDaqForGui();
static void* DataStartAcquireThread(void *this_pointer); static void* DataStartAcquireThread(void *this_pointer);
/** This is called by the detector class to copy the data it jus acquired */ /** This is called by the detector class to copy the data it jus acquired */
static int GetDataCallBack(detectorData *data, void *this_pointer); static int GetDataCallBack(detectorData *data, int fIndex, void *this_pointer);
/** This is called by the GetDataCallBack function to copy the data */ /** This is called by the GetDataCallBack function to copy the data */
int GetData(detectorData *data); int GetData(detectorData *data, int fIndex);
/** This is called by detector class when acquisition is finished /** This is called by detector class when acquisition is finished
* @param currentProgress current progress of measurement * @param currentProgress current progress of measurement
@ -463,6 +463,9 @@ bool backwardScanPlot;
/**if files will be saved and index increased*/ /**if files will be saved and index increased*/
bool fileSaveEnable; bool fileSaveEnable;
/** true if receiver online*/
bool receiver;
signals: signals:
void UpdatingPlotFinished(); void UpdatingPlotFinished();
void InterpolateSignal(bool); void InterpolateSignal(bool);

View File

@ -108,6 +108,8 @@ void qDrawPlot::SetupWidgetWindow(){
currentFileIndex = 0; currentFileIndex = 0;
currentFrameIndex = 0; currentFrameIndex = 0;
receiver=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++)
@ -349,6 +351,9 @@ bool qDrawPlot::StartOrStopThread(bool start){
//sets up the measurement parameters //sets up the measurement parameters
SetupMeasurement(); SetupMeasurement();
if(myDet->setReceiverOnline()==slsDetectorDefs::ONLINE_FLAG)
receiver=true;
cout << "Starting new acquisition threadddd ...." << endl; cout << "Starting new acquisition threadddd ...." << endl;
// Start acquiring data from server // Start acquiring data from server
if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits if(!firstTime) pthread_join(gui_acquisition_thread,NULL);//wait until he's finished, ie. exits
@ -524,8 +529,8 @@ void* qDrawPlot::DataStartAcquireThread(void *this_pointer){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){ int qDrawPlot::GetDataCallBack(detectorData *data, int fIndex, void *this_pointer){
((qDrawPlot*)this_pointer)->GetData(data); ((qDrawPlot*)this_pointer)->GetData(data,fIndex);
return 0; return 0;
} }
@ -533,7 +538,7 @@ int qDrawPlot::GetDataCallBack(detectorData *data, void *this_pointer){
//------------------------------------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------------------------------------
int qDrawPlot::GetData(detectorData *data){ int qDrawPlot::GetData(detectorData *data,int fIndex){
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
cout << "******Entering GetDatafunction********" << endl; cout << "******Entering GetDatafunction********" << endl;
#endif #endif
@ -551,10 +556,16 @@ int qDrawPlot::GetData(detectorData *data){
if(!plotEnable) return 0; if(!plotEnable) return 0;
// secondary title necessary to differentiate between frames when not saving data // secondary title necessary to differentiate between frames when not saving data
/*char temp_title[2000]; char temp_title[2000];
if(receiver){
//findex is used because in the receiver, you cannot know the frame index as many frames are in 1 file.
if(fIndex==-1) fIndex=currentFrame;
sprintf(temp_title,"#%d",fIndex);
}else{
if(fileSaveEnable) strcpy(temp_title,""); if(fileSaveEnable) strcpy(temp_title,"");
else sprintf(temp_title,"#%d",currentFrame); else sprintf(temp_title,"#%d",currentFrame);
*/ }
//angle plotting //angle plotting
if(anglePlot){ if(anglePlot){
@ -563,7 +574,7 @@ int qDrawPlot::GetData(detectorData *data){
//set title //set title
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1); plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
// Title // Title
/*histTitle[0] = temp_title;*/ histTitle[0] = temp_title;
if(data->angles==NULL){ if(data->angles==NULL){
cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl; cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl;
@ -637,7 +648,7 @@ int qDrawPlot::GetData(detectorData *data){
//variables //variables
lastImageNumber= currentFrame+1; lastImageNumber= currentFrame+1;
//title //title
/*imageTitle = temp_title;*/ imageTitle = temp_title;
//copy data //copy data
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double)); memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
pthread_mutex_unlock(&(last_image_complete_mutex)); pthread_mutex_unlock(&(last_image_complete_mutex));
@ -658,7 +669,7 @@ int qDrawPlot::GetData(detectorData *data){
if(currentFrameIndex == 0) currentScanDivLevel = 0; if(currentFrameIndex == 0) currentScanDivLevel = 0;
lastImageNumber= currentFrame+1; lastImageNumber= currentFrame+1;
//title //title
/*imageTitle = temp_title;*/ imageTitle = temp_title;
//copy data //copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px]; for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex)); pthread_mutex_unlock(&(last_image_complete_mutex));
@ -686,7 +697,7 @@ int qDrawPlot::GetData(detectorData *data){
currentScanValue = cs0; currentScanValue = cs0;
lastImageNumber= currentFrame+1; lastImageNumber= currentFrame+1;
//title //title
/*imageTitle = temp_title;*/ imageTitle = temp_title;
//copy data //copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px]; for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex)); pthread_mutex_unlock(&(last_image_complete_mutex));
@ -712,7 +723,7 @@ int qDrawPlot::GetData(detectorData *data){
currentScanValue = cs1; currentScanValue = cs1;
lastImageNumber= currentFrame+1; lastImageNumber= currentFrame+1;
//title //title
/*imageTitle = temp_title;*/ imageTitle = temp_title;
//copy data //copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px]; for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
pthread_mutex_unlock(&(last_image_complete_mutex)); pthread_mutex_unlock(&(last_image_complete_mutex));
@ -734,7 +745,7 @@ int qDrawPlot::GetData(detectorData *data){
//1d //1d
if(plot_in_scope==1){ if(plot_in_scope==1){
// Titles // Titles
/*histTitle[0] = temp_title;*/ histTitle[0] = temp_title;
// Persistency // Persistency
if(currentPersistency < persistency)currentPersistency++; if(currentPersistency < persistency)currentPersistency++;
else currentPersistency=persistency; else currentPersistency=persistency;
@ -748,7 +759,7 @@ int qDrawPlot::GetData(detectorData *data){
//2d //2d
else{cout<<endl<<"****************************IN HERE-2D*******************************************"<<endl<<endl; else{cout<<endl<<"****************************IN HERE-2D*******************************************"<<endl<<endl;
// Titles // Titles
/*imageTitle = temp_title;*/ imageTitle = temp_title;
// manufacture data for now // manufacture data for now
for(unsigned int px=0;px<nPixelsX;px++) for(unsigned int px=0;px<nPixelsX;px++)
for(unsigned int py=0;py<nPixelsY;py++) for(unsigned int py=0;py<nPixelsY;py++)