check if outdir exists,indent Actions,degreeC,cascode,thresholdscan(ev),not saving data secondary title,got rid of 2d sampledata

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorGui@86 af1100a4-978c-4157-bff7-07162d2ba061
This commit is contained in:
l_maliakal_d 2012-10-10 10:25:31 +00:00
parent b703e52563
commit 87410f09de
13 changed files with 156 additions and 57 deletions

View File

@ -367,7 +367,7 @@ Defines scan range for a <b>Constant Step Size</b> with the followin
</item>
<item>
<property name="text">
<string>Energy Scan</string>
<string>Energy Scan (eV)</string>
</property>
</item>
<item>

View File

@ -299,23 +299,48 @@
<number>-1</number>
</property>
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="lblOutputDir">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;nobr&gt;
Directory where one saves the data.
&lt;/nobr&gt;&lt;br&gt;
#outdir#
&lt;br&gt;
</string>
</property>
<property name="text">
<string>Output Directory :</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="dispOutputDir"/>
<widget class="QLineEdit" name="dispOutputDir">
<property name="toolTip">
<string>&lt;nobr&gt;
Directory where one saves the data.
&lt;/nobr&gt;&lt;br&gt;
#outdir#
&lt;br&gt;
</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnOutputBrowse">
<property name="toolTip">
<string>&lt;nobr&gt;
Directory where one saves the data.
&lt;/nobr&gt;&lt;br&gt;
#outdir#
&lt;br&gt;
</string>
</property>
<property name="text">
<string>Browse</string>
</property>

View File

@ -638,7 +638,7 @@
<item row="0" column="0">
<widget class="QCheckBox" name="chkTitle">
<property name="text">
<string>Title:</string>
<string>Title Prefix:</string>
</property>
</widget>
</item>

View File

@ -21,7 +21,7 @@ public:
qDefs(){};
//-------------------------------------------------------------------------------------------------------------------------------------------------
#define GUI_VERSION 0.12
#define GUI_VERSION 0.13
//-------------------------------------------------------------------------------------------------------------------------------------------------

View File

@ -52,6 +52,9 @@ public:
int GetProgress(){return progress;};
/** gets the file index to the measurement tab*/
int GetFileIndex(){return currentFileIndex;};
/** sets file write enable , if not enabled,
* file index wont increase and so you need secondary titles to differentitate between plots*/
void SetEnableFileWrite(bool enable){fileSaveEnable = enable;};
/** sets plot Title prefix*/
void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;}
@ -448,7 +451,8 @@ static const int TRIM_HISTOGRAM_XMAX = 63;
/**if the values increment backwards*/
bool backwardScanPlot;
/**if files will be saved and index increased*/
bool fileSaveEnable;
signals:
void UpdatingPlotFinished();

View File

@ -85,7 +85,17 @@ private:
slsDetectorDefs::detectorType detType;
enum actionIndex{Scan0=1, Scan1, NumPositions=4, NumTotalActions=9};
enum actionIndex{
ActionStart,
Scan0,
Scan1,
ActionBefore,
NumPositions,
HeaderBefore,
HeaderAfter,
ActionAfter,
ActionStop,
NumTotalActions};
QGridLayout *gridLayout;
QButtonGroup *group;

View File

@ -49,6 +49,7 @@ private:
QString flatFieldTip;
QString errFlatFieldTip;
QString outDirTip;
QPalette red;
/** methods */

View File

@ -66,15 +66,17 @@ void qDrawPlot::SetupWidgetWindow(){
//gui_acquisition_thread_running = 0;
// Default Plotting
plot_in_scope = 0;
//2d
lastImageNumber = 0;
last_plot_number = 0;
nPixelsX = myDet->getTotalNumberOfChannels();
nPixelsY = 100;
nAnglePixelsX = 1;
minPixelsY = 0;
maxPixelsY = 0;
startPixel=-0.5;
endPixel=nPixelsY-0.5;
//2d
lastImageArray = 0;
//1d
@ -156,6 +158,7 @@ void qDrawPlot::SetupWidgetWindow(){
plot2D = new SlsQt2DPlotLayout(boxPlot);
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);
plot2D->SetYTitle(imageYAxisTitle);
@ -182,6 +185,8 @@ void qDrawPlot::SetupWidgetWindow(){
fileName = QString(myDet->getFileName().c_str());
fileSaveEnable= myDet->enableWriteToFile();
// Setting the callback function to get data from detector class
myDet->registerDataCallback(&(GetDataCallBack),this);
@ -540,7 +545,10 @@ int qDrawPlot::GetData(detectorData *data){
//Plot Disabled
if(!plotEnable) return 0;
// secondary title necessary to differentiate between frames when not saving data
char temp_title[2000];
if(fileSaveEnable) strcpy(temp_title,"");
else sprintf(temp_title,"#%d",currentFrame);
//angle plotting
@ -549,8 +557,9 @@ int qDrawPlot::GetData(detectorData *data){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//set title
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
// Title
histTitle[0] = temp_title;
cout<<endl<<"angle plot"<<endl<<endl;
if(data->angles==NULL){
cout<<"\n\nWARNING:RETURNED NULL instead of angles."<<endl;
lastImageNumber= currentFrame+1;
@ -623,8 +632,6 @@ int qDrawPlot::GetData(detectorData *data){
//variables
lastImageNumber= currentFrame+1;
//title
char temp_title[2000];
sprintf(temp_title,"Image Index %d",currentFileIndex);
imageTitle = temp_title;
//copy data
memcpy(lastImageArray+(currentScanDivLevel*nPixelsX),data->values,nPixelsX*sizeof(double));
@ -646,8 +653,6 @@ int qDrawPlot::GetData(detectorData *data){
if(currentFileIndex == minPixelsY) currentScanDivLevel = 0;
lastImageNumber= currentFrame+1;
//title
char temp_title[2000];
sprintf(temp_title,"Image Index %d",currentFileIndex);
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
@ -678,8 +683,6 @@ int qDrawPlot::GetData(detectorData *data){
currentScanValue = cs0;
lastImageNumber= currentFrame+1;
//title
char temp_title[2000];
sprintf(temp_title,"Image Index %d",currentFileIndex);
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
@ -706,8 +709,6 @@ int qDrawPlot::GetData(detectorData *data){
currentScanValue = cs1;
lastImageNumber= currentFrame+1;
//title
char temp_title[2000];
sprintf(temp_title,"Image Index %d",currentFileIndex);
imageTitle = temp_title;
//copy data
for(unsigned int px=0;px<nPixelsX;px++) lastImageArray[currentScanDivLevel*nPixelsX+px] += data->values[px];
@ -724,13 +725,13 @@ int qDrawPlot::GetData(detectorData *data){
if(!pthread_mutex_trylock(&(last_image_complete_mutex))){
//set title
plotTitle=QString(plotTitle_prefix)+QString(data->fileName).section('/',-1);
char temp_title[2000];
// only if you got the lock, do u need to remember lastimagenumber to plot
lastImageNumber= currentFrame+1;
//1d
if(plot_in_scope==1){
// Titles changed to "" inside startstopthread
// Titles
histTitle[0] = temp_title;
// Persistency
if(currentPersistency < persistency)currentPersistency++;
else currentPersistency=persistency;
@ -742,9 +743,8 @@ int qDrawPlot::GetData(detectorData *data){
memcpy(histYAxis[0],data->values,nPixelsX*sizeof(double));
}
//2d
else{
else{cout<<endl<<"****************************IN HERE-2D*******************************************"<<endl<<endl;
// Titles
sprintf(temp_title,"Image Index %d",currentFileIndex);
imageTitle = temp_title;
// manufacture data for now
for(unsigned int px=0;px<nPixelsX;px++)
@ -1058,6 +1058,7 @@ void qDrawPlot::ClonePlot(){
else{
plot2D = new SlsQt2DPlotLayout(boxPlot);
plot2D->GetPlot()->SetData(nPixelsX,-0.5,nPixelsX-0.5,nPixelsY,startPixel,endPixel,lastImageArray);
plot2D->setFont(QFont("Sans Serif",9,QFont::Normal));
plot2D->setTitle(GetImageTitle());
plot2D->SetXTitle(imageXAxisTitle);

View File

@ -92,7 +92,7 @@ void qScanWidget::SetupWidgetWindow(){
spinFrom->setMinimum(-1000000);
spinFrom->setKeyboardTracking(false);
spinFrom->setFixedWidth(80);
spinFrom->setDecimals(4);
spinFrom->setDecimals(2);
lblTo->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
lblTo->setToolTip(rangeTip);
lblTo->setFixedWidth(18);
@ -102,7 +102,7 @@ void qScanWidget::SetupWidgetWindow(){
spinTo->setMinimum(-1000000);
spinTo->setKeyboardTracking(false);
spinTo->setFixedWidth(80);
spinTo->setDecimals(4);
spinTo->setDecimals(2);
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
lblSize->setToolTip(rangeTip);
lblSize->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
@ -113,7 +113,7 @@ void qScanWidget::SetupWidgetWindow(){
spinSize->setSingleStep(0.1);
spinSize->setToolTip(rangeTip);
spinSize->setKeyboardTracking(false);
spinSize->setDecimals(4);
spinSize->setDecimals(2);
//spinSize->setMinimum(0.0001);
layoutRange->addItem(new QSpacerItem(40,20,QSizePolicy::Fixed,QSizePolicy::Fixed));

View File

@ -40,7 +40,8 @@ qTabActions::~qTabActions(){
void qTabActions::SetupWidgetWindow(){
// Window Settings
setFixedSize(710,350);
setFixedHeight(350);
//setFixedSize(710,350);
setContentsMargins(0,0,0,0);
// Scroll Area Settings
@ -62,7 +63,7 @@ void qTabActions::SetupWidgetWindow(){
QPalette p;
p.setColor(QPalette::Shadow,QColor(0,0,0,0));
p.setColor(QPalette::Button,QColor(0,0,0,0));
/*get rid of this vector*/
char names[NumTotalActions][200] = {
"Action at Start",
"Scan Level 0",
@ -81,6 +82,10 @@ void qTabActions::SetupWidgetWindow(){
QString tip = "<nobr>Click on the \"+\" to Expand or \"-\" to Collapse.</nobr>";
int hIndent=0, vIndent=0, colspan=6;
QLabel *lblReal;
// For each level of Actions
for(int i=0;i<NumTotalActions;i++){
//common widgets
@ -88,7 +93,6 @@ void qTabActions::SetupWidgetWindow(){
btnExpand[i] = new QPushButton();
lblName[i]->setToolTip(tip);
btnExpand[i]->setCheckable(true);
btnExpand[i]->setChecked(false);
btnExpand[i]->setFixedSize(16,16);
@ -98,32 +102,62 @@ void qTabActions::SetupWidgetWindow(){
btnExpand[i]->setFlat(true);
btnExpand[i]->setIconSize(QSize(16,16));
btnExpand[i]->setPalette(p);
group->addButton(btnExpand[i],i);
//add the widgets to the layout , depending on the type create the widgets
gridLayout->addWidget(btnExpand[i],(i*2),0);
gridLayout->addWidget(lblName[i],(i*2),1);
if(i==NumPositions){
//add label and button to expand or collapse
gridLayout->addWidget(btnExpand[i],vIndent,hIndent,1,1);
gridLayout->addWidget(lblName[i],vIndent,hIndent+1,1,colspan);
//creating the action/scan/position widgets and adding them
switch(i){
case NumPositions:
CreatePositionsWidget();
gridLayout->addWidget(positionWidget,(i*2)+1,1,1,2);
gridLayout->addWidget(positionWidget,vIndent+1,hIndent+1,1,colspan);
positionWidget->hide();
}else if((i==Scan0)||(i==Scan1)){
break;
case Scan0:
case Scan1:
scanWidget[qScanWidget::NUM_SCAN_WIDGETS] = new qScanWidget(this,myDet);
gridLayout->addWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],(i*2)+1,1,1,2);
gridLayout->addWidget(scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1],vIndent+1,hIndent+1,1,colspan);
scanWidget[qScanWidget::NUM_SCAN_WIDGETS-1]->hide();
}else{
break;
default:
actionWidget[qActionsWidget::NUM_ACTION_WIDGETS] = new qActionsWidget(this,myDet);
gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],(i*2)+1,1,1,2);
gridLayout->addWidget(actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1],vIndent+1,hIndent+1,1,colspan);
actionWidget[qActionsWidget::NUM_ACTION_WIDGETS-1]->hide();
break;
}
//incrementing the vertical and horizontal indent
vIndent+=2;
switch(i){
case HeaderBefore:
//real time acquisition
palette->setColor(QPalette::Active,QPalette::WindowText,QColor(0,0,200,255));
lblReal = new QLabel(" <b>Real Time Acquisition</b>");
lblReal->setFixedHeight(25);
//lblReal->setPalette(*palette);
gridLayout->addWidget(lblReal,vIndent,hIndent+1,1,colspan);
vIndent++;
break;
case HeaderAfter:
hIndent-=2;
colspan+=2;
break;
case ActionAfter:
hIndent=0;
colspan=6;
break;
default:
hIndent++;
colspan--;
break;
}
//gridLayout->addWidget(btnExpand[i],(i*2),i);
//gridLayout->addWidget(lblName[i],(i*2),i+1);
//gridLayout->addWidget(actionWidget[i],(i*2)+1,i+1,1,2);
}
//Number of positions is only for mythen or gotthard
detType = myDet->getDetectorsType();
if((detType == slsDetectorDefs::EIGER) || (detType == slsDetectorDefs::AGIPD)) {
@ -174,6 +208,7 @@ void qTabActions::SetupWidgetWindow(){
void qTabActions::CreatePositionsWidget(){
positionWidget = new QWidget;
positionWidget->setFixedHeight(25);
positionWidget->setFixedWidth(680);
QGridLayout *layout = new QGridLayout(positionWidget);
layout->setContentsMargins(0,0,0,0);

View File

@ -64,6 +64,7 @@ void qTabDataOutput::SetupWidgetWindow(){
QString("<nobr><font color=\"red\">"
"Enter a valid file to enable Flat Field.</font></nobr>");
outDirTip = dispOutputDir->toolTip();
Initialization();
@ -146,13 +147,29 @@ void qTabDataOutput::setOutputDir(){
while(path.endsWith('/')) path.chop(1);
dispOutputDir->setText(path);
//if(QFile::exists(path))
if(QFile::exists(path)){
lblOutputDir->setText("Output Directory: ");
lblOutputDir->setPalette(chkRate->palette());
lblOutputDir->setToolTip(outDirTip);
dispOutputDir->setToolTip(outDirTip);
btnOutputBrowse->setToolTip(outDirTip);
myDet->setFilePath(string(path.toAscii().constData()));
#ifdef VERBOSE
cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
#endif
}
else{
lblOutputDir->setText("Output Directory:*");
lblOutputDir->setPalette(red);
QString errTip = outDirTip +
QString("<nobr><font color=\"red\">"
"Enter a valid path to change <b>Output Directory</b>.</font></nobr>");
lblOutputDir->setToolTip(errTip);
dispOutputDir->setToolTip(errTip);
btnOutputBrowse->setToolTip(errTip);
}
myDet->setFilePath(string(path.toAscii().constData()));
#ifdef VERBOSE
cout << "Output Directory changed to :"<<myDet->getFilePath() << endl;
#endif
connect(dispOutputDir, SIGNAL(editingFinished()), this, SLOT(setOutputDir()));
}
@ -454,7 +471,11 @@ void qTabDataOutput::Refresh(){
cout << "Getting output directory" << endl;
#endif
dispOutputDir->setText(QString(myDet->getFilePath().c_str()));
lblOutputDir->setText("Output Directory: ");
lblOutputDir->setPalette(chkRate->palette());
lblOutputDir->setToolTip(outDirTip);
dispOutputDir->setToolTip(outDirTip);
btnOutputBrowse->setToolTip(outDirTip);
//flat field correction from server
#ifdef VERBOSE

View File

@ -71,14 +71,14 @@ void qTabDeveloper::SetupWidgetWindow(){
case slsDetectorDefs::GOTTHARD:
NUM_DAC_WIDGETS = 8;
NUM_ADC_WIDGETS = 2;
dacNames.push_back("Reference Voltage:");
dacNames.push_back("Cascade n Voltage:");
dacNames.push_back("Cascade p Voltage:");
dacNames.push_back("Comp. Output Voltage:");
dacNames.push_back("Cascade out Voltage:");
dacNames.push_back("Comp. Input Voltage:");
dacNames.push_back("Comp. Ref Voltage:");
dacNames.push_back("Base Test Current:");
dacNames.push_back("v Reference:");
dacNames.push_back("v Cascode n:");
dacNames.push_back("v Cascode p:");
dacNames.push_back("v Comp. Output:");
dacNames.push_back("v Cascode out");
dacNames.push_back("v Comp. Input:");
dacNames.push_back("v Comp. Ref:");
dacNames.push_back("i Base Test:");
adcNames.push_back("Temperature ADC:");
adcNames.push_back("Temperature FPGA:");
@ -194,6 +194,7 @@ void qTabDeveloper::CreateADCWidgets(){
lblAdcs[i] = new QLabel(QString(adcNames[i].c_str()),boxAdcs);
spinAdcs[i] = new QDoubleSpinBox(boxAdcs);
spinAdcs[i]->setMaximum(10000);
if(detType==slsDetectorDefs::GOTTHARD) spinAdcs[i]->setSuffix(0x00b0+QString("C"));
adcLayout->addWidget(lblAdcs[i],(int)(i/2),((i%2)==0)?1:4);
adcLayout->addWidget(spinAdcs[i],(int)(i/2),((i%2)==0)?2:5);

View File

@ -364,7 +364,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val){
void qTabMeasurement::UpdateProgress(){
progressBar->setValue((int)myPlot->GetProgress());
lblProgressIndex->setText(QString::number(myPlot->GetFileIndex()+1));
lblProgressIndex->setText(QString::number(myPlot->GetFileIndex()));
}
@ -728,6 +728,7 @@ void qTabMeasurement::EnableFileWrite(bool enable){
myDet->enableWriteToFile(enable);
dispFileName->setEnabled(enable);
if(enable) setFileName(dispFileName->text());
myPlot->SetEnableFileWrite(enable);
};
//-------------------------------------------------------------------------------------------------------------------------------------------------