mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
WIP
This commit is contained in:
parent
f0872174cf
commit
1bab010d0b
@ -65,7 +65,7 @@ public:
|
|||||||
int GetFrameIndex(){return currentFrameIndex;};
|
int GetFrameIndex(){return currentFrameIndex;};
|
||||||
/** sets file write enable , if not enabled,
|
/** sets file write enable , if not enabled,
|
||||||
* file index wont increase and so you need secondary titles to differentitate between plots*/
|
* file index wont increase and so you need secondary titles to differentitate between plots*/
|
||||||
void SetFileWriteEnable(bool enable){fileSaveEnable = enable;};
|
void SetFileWrite(bool enable){fileSaveEnable = enable;};
|
||||||
|
|
||||||
/** sets plot Title prefix*/
|
/** sets plot Title prefix*/
|
||||||
void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;}
|
void SetPlotTitlePrefix(QString title) {plotTitle_prefix = title;}
|
||||||
|
@ -29,9 +29,8 @@ public:
|
|||||||
void Initialization();
|
void Initialization();
|
||||||
void PopulateDetectors();
|
void PopulateDetectors();
|
||||||
void EnableBrowse();
|
void EnableBrowse();
|
||||||
void GetFileEnable();
|
void GetFileWrite();
|
||||||
void GetFileName();
|
void GetFileName();
|
||||||
|
|
||||||
void GetFileFormat();
|
void GetFileFormat();
|
||||||
void GetFileOverwrite();
|
void GetFileOverwrite();
|
||||||
void GetTenGigaEnable();
|
void GetTenGigaEnable();
|
||||||
|
@ -22,19 +22,19 @@ public:
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void SetCurrentMeasurement(int val);
|
void SetCurrentMeasurement(int val);
|
||||||
void UpdateFinished();
|
|
||||||
void StopAcquisition();
|
void StopAcquisition();
|
||||||
|
void UpdateFinished();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetTimingMode(int mode);
|
void SetTimingMode(int val);
|
||||||
void SetNumMeasurements(int num);
|
void SetNumMeasurements(int val);
|
||||||
void SetNumFrames(int val);
|
void SetNumFrames(int val);
|
||||||
void SetNumTriggers(int val);
|
void SetNumTriggers(int val);
|
||||||
void SetNumSamples(int val);
|
void SetNumSamples(int val);
|
||||||
void SetExposureTime();
|
void SetExposureTime();
|
||||||
void SetAcquisitionPeriod();
|
void SetAcquisitionPeriod();
|
||||||
void SetDelay();
|
void SetDelay();
|
||||||
void SetFileWriteEnable(bool enable);
|
void SetFileWrite(bool val);
|
||||||
void SetFileName();
|
void SetFileName();
|
||||||
void SetRunIndex(int val);
|
void SetRunIndex(int val);
|
||||||
void UpdateProgress();
|
void UpdateProgress();
|
||||||
@ -55,7 +55,7 @@ private:
|
|||||||
void GetAcquisitionPeriod();
|
void GetAcquisitionPeriod();
|
||||||
void CheckAcqPeriodGreaterThanExp();
|
void CheckAcqPeriodGreaterThanExp();
|
||||||
void GetDelay();
|
void GetDelay();
|
||||||
void GetFileWriteEnable();
|
void GetFileWrite();
|
||||||
void GetFileName();
|
void GetFileName();
|
||||||
void GetRunIndex();
|
void GetRunIndex();
|
||||||
|
|
||||||
|
@ -109,18 +109,18 @@ void qTabDataOutput::EnableBrowse() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabDataOutput::GetFileWriteEnable() {
|
void qTabDataOutput::GetFileWrite() {
|
||||||
FILE_LOG(logDEBUG) << "Getting file write enable";
|
FILE_LOG(logDEBUG) << "Getting file write enable";
|
||||||
try {
|
try {
|
||||||
int retval = myDet->getFileWrite();
|
int retval = myDet->getFileWrite();
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWriteEnable");
|
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabDataOutput::GetFileWrite");
|
||||||
boxFileWriteEnabled->setEnabled(true);
|
boxFileWriteEnabled->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
|
boxFileWriteEnabled->setEnabled(retval == 0 ? false : true);
|
||||||
}
|
}
|
||||||
} catch (const sls::RuntimeError &e) {
|
} catch (const sls::RuntimeError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get file enable.", e.what(), "qTabDataOutput::GetFileWriteEnable");
|
qDefs::ExceptionMessage("Could not get file enable.", e.what(), "qTabDataOutput::GetFileWrite");
|
||||||
boxFileWriteEnabled->setEnabled(true);
|
boxFileWriteEnabled->setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ void qTabDataOutput::Refresh() {
|
|||||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||||
|
|
||||||
EnableBrowse();
|
EnableBrowse();
|
||||||
GetFileWriteEnable();
|
GetFileWrite();
|
||||||
GetFileName();
|
GetFileName();
|
||||||
GetOutputDir();
|
GetOutputDir();
|
||||||
GetFileOverwrite();
|
GetFileOverwrite();
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
#include "qDrawPlot.h"
|
#include "qDrawPlot.h"
|
||||||
|
|
||||||
|
#include "string_utils.h"
|
||||||
|
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -73,7 +75,7 @@ void qTabMeasurement::Initialization() {
|
|||||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||||
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
connect(spinNumFrames, SIGNAL(valueChanged(int)), this, SLOT(SetNumFrames(int)));
|
||||||
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
connect(spinNumTriggers, SIGNAL(valueChanged(int)), this, SLOT(SetNumTriggers(int)));
|
||||||
if (spinSamples->isEnabled()) {
|
if (spinNumSamples->isEnabled()) {
|
||||||
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
connect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||||
}
|
}
|
||||||
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
connect(spinExpTime, SIGNAL(valueChanged(double)), this, SLOT(SetExposureTime()));
|
||||||
@ -84,7 +86,7 @@ void qTabMeasurement::Initialization() {
|
|||||||
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
connect(spinDelay, SIGNAL(valueChanged(double)), this, SLOT(SetDelay()));
|
||||||
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
connect(comboDelayUnit, SIGNAL(currentIndexChanged(int)), this, SLOT(SetDelay()));
|
||||||
}
|
}
|
||||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWriteEnable(bool)));
|
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
connect(dispFileName, SIGNAL(editingFinished()), this, SLOT(SetFileName()));
|
||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
||||||
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
connect(progressTimer, SIGNAL(timeout()), this, SLOT(UpdateProgress()));
|
||||||
@ -191,7 +193,7 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
|||||||
CheckAcqPeriodGreaterThanExp();
|
CheckAcqPeriodGreaterThanExp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::GetTimingMode(bool startup) {
|
void qTabMeasurement::GetTimingMode() {
|
||||||
FILE_LOG(logDEBUG) << "Getting timing mode";
|
FILE_LOG(logDEBUG) << "Getting timing mode";
|
||||||
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
connect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||||
|
|
||||||
@ -199,13 +201,13 @@ void qTabMeasurement::GetTimingMode(bool startup) {
|
|||||||
auto oldMode = comboTimingMode->currentIndex();
|
auto oldMode = comboTimingMode->currentIndex();
|
||||||
auto retval = myDet->setExternalCommunicationMode();
|
auto retval = myDet->setExternalCommunicationMode();
|
||||||
switch(retval) {
|
switch(retval) {
|
||||||
case GET_EXTERNAL_COMMUNICATION_MODE:
|
case slsDetectorDefs::GET_EXTERNAL_COMMUNICATION_MODE:
|
||||||
qDefs::Message(qDefs::WARNING, "Timing Mode is inconsistent for all detectors.", "qTabMeasurement::GetTimingMode");
|
qDefs::Message(qDefs::WARNING, "Timing Mode is inconsistent for all detectors.", "qTabMeasurement::GetTimingMode");
|
||||||
break;
|
break;
|
||||||
case AUTO:
|
case slsDetectorDefs::AUTO_TIMING:
|
||||||
case TRIGGER:
|
case slsDetectorDefs::TRIGGER_EXPOSURE:
|
||||||
case GATED:
|
case slsDetectorDefs::GATED:
|
||||||
case BURST_TRIGGER:
|
case slsDetectorDefs::BURST_TRIGGER:
|
||||||
comboTimingMode->setCurrentIndex((int)retval);
|
comboTimingMode->setCurrentIndex((int)retval);
|
||||||
// update widget enable only if different
|
// update widget enable only if different
|
||||||
if (oldMode != comboTimingMode->currentIndex()) {
|
if (oldMode != comboTimingMode->currentIndex()) {
|
||||||
@ -213,7 +215,7 @@ void qTabMeasurement::GetTimingMode(bool startup) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDefs::ExceptionMessage("Could not get timing mode.", e.what(), "qTabMeasurement::GetTimingMode");
|
qDefs::Message(qDefs::WARNING, std::string("Unknown timing mode: ")+ std::to_string(retval), "qTabMeasurement::GetTimingMode");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
@ -223,11 +225,11 @@ void qTabMeasurement::GetTimingMode(bool startup) {
|
|||||||
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
disconnect(comboTimingMode, SIGNAL(currentIndexChanged(int)), this, SLOT(SetTimingMode(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetTimingMode(int mode) {
|
void qTabMeasurement::SetTimingMode(int val) {
|
||||||
FILE_LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data();
|
FILE_LOG(logINFO) << "Setting timing mode:" << comboTimingMode->currentText().toAscii().data();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(value));
|
myDet->setExternalCommunicationMode(static_cast<slsDetectorDefs::externalCommunicationMode>(val));
|
||||||
EnableWidgetsforTimingMode();
|
EnableWidgetsforTimingMode();
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not set timing mode.", e.what(), "qTabMeasurement::SetTimingMode");
|
qDefs::ExceptionMessage("Could not set timing mode.", e.what(), "qTabMeasurement::SetTimingMode");
|
||||||
@ -244,7 +246,7 @@ void qTabMeasurement::GetNumMeasurements() {
|
|||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
|
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
|
||||||
}
|
}
|
||||||
spinNumMeasurements->seValue(retval);
|
spinNumMeasurements->setValue(retval);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get number of measurements.", e.what(), "qTabMeasurement::GetNumMeasurements");
|
qDefs::ExceptionMessage("Could not get number of measurements.", e.what(), "qTabMeasurement::GetNumMeasurements");
|
||||||
}
|
}
|
||||||
@ -272,7 +274,7 @@ void qTabMeasurement::GetNumFrames() {
|
|||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames");
|
qDefs::Message(qDefs::WARNING, "Number of frames is inconsistent for all detectors.", "qTabMeasurement::GetNumFrames");
|
||||||
}
|
}
|
||||||
spinNumFrames->seValue(retval);
|
spinNumFrames->setValue(retval);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumFrames");
|
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumFrames");
|
||||||
}
|
}
|
||||||
@ -300,7 +302,7 @@ void qTabMeasurement::GetNumTriggers() {
|
|||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers");
|
qDefs::Message(qDefs::WARNING, "Number of triggers is inconsistent for all detectors.", "qTabMeasurement::GetNumTriggers");
|
||||||
}
|
}
|
||||||
spinNumTriggers->seValue(retval);
|
spinNumTriggers->setValue(retval);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumTriggers");
|
qDefs::ExceptionMessage("Could not get number of frames.", e.what(), "qTabMeasurement::GetNumTriggers");
|
||||||
}
|
}
|
||||||
@ -324,11 +326,15 @@ void qTabMeasurement::GetNumSamples() {
|
|||||||
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
disconnect(spinNumSamples, SIGNAL(valueChanged(int)), this, SLOT(SetNumSamples(int)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto retval = myDet->setTimer(slsDetectorDefs::SAMPLES);
|
auto retval = myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES);
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "Number of samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
qDefs::Message(qDefs::WARNING, "Number of analog samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
||||||
}
|
}
|
||||||
spinNumSamples->seValue(retval);
|
retval = myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES);
|
||||||
|
if (retval == -1) {
|
||||||
|
qDefs::Message(qDefs::WARNING, "Number of digital samples is inconsistent for all detectors.", "qTabMeasurement::GetNumSamples");
|
||||||
|
}
|
||||||
|
spinNumSamples->setValue(retval);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get number of samples.", e.what(), "qTabMeasurement::GetNumSamples");
|
qDefs::ExceptionMessage("Could not get number of samples.", e.what(), "qTabMeasurement::GetNumSamples");
|
||||||
}
|
}
|
||||||
@ -340,7 +346,8 @@ void qTabMeasurement::SetNumSamples(int val) {
|
|||||||
FILE_LOG(logINFO) << "Setting number of samples to " << val;
|
FILE_LOG(logINFO) << "Setting number of samples to " << val;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
myDet->setTimer(slsDetectorDefs::SAMPLES, val);
|
myDet->setTimer(slsDetectorDefs::ANALOG_SAMPLES, val);
|
||||||
|
myDet->setTimer(slsDetectorDefs::DIGITAL_SAMPLES, val);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not set number of samples.", e.what(), "qTabMeasurement::SetNumSamples");
|
qDefs::ExceptionMessage("Could not set number of samples.", e.what(), "qTabMeasurement::SetNumSamples");
|
||||||
GetNumSamples();
|
GetNumSamples();
|
||||||
@ -359,7 +366,7 @@ void qTabMeasurement::GetExposureTime() {
|
|||||||
spinExpTime->setValue(-1);
|
spinExpTime->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
qDefs::timeUnit unit;
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9));
|
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
||||||
spinExpTime->setValue(time);
|
spinExpTime->setValue(time);
|
||||||
comboExpUnit->setCurrentIndex(static_cast<int>(unit));
|
comboExpUnit->setCurrentIndex(static_cast<int>(unit));
|
||||||
|
|
||||||
@ -400,7 +407,7 @@ void qTabMeasurement::GetAcquisitionPeriod() {
|
|||||||
spinPeriod->setValue(-1);
|
spinPeriod->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
qDefs::timeUnit unit;
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9));
|
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
||||||
spinPeriod->setValue(time);
|
spinPeriod->setValue(time);
|
||||||
comboPeriodUnit->setCurrentIndex(static_cast<int>(unit));
|
comboPeriodUnit->setCurrentIndex(static_cast<int>(unit));
|
||||||
|
|
||||||
@ -466,7 +473,7 @@ void qTabMeasurement::GetDelay() {
|
|||||||
spinDelay->setValue(-1);
|
spinDelay->setValue(-1);
|
||||||
} else {
|
} else {
|
||||||
qDefs::timeUnit unit;
|
qDefs::timeUnit unit;
|
||||||
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9));
|
auto time = qDefs::getCorrectTime(unit, (static_cast<double>(retval) * (1E-9)));
|
||||||
spinDelay->setValue(time);
|
spinDelay->setValue(time);
|
||||||
comboDelayUnit->setCurrentIndex(static_cast<int>(unit));
|
comboDelayUnit->setCurrentIndex(static_cast<int>(unit));
|
||||||
|
|
||||||
@ -495,38 +502,38 @@ void qTabMeasurement::SetDelay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::GetFileWriteEnable() {
|
void qTabMeasurement::GetFileWrite() {
|
||||||
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
FILE_LOG(logDEBUG) << "Getting File Write Enable";
|
||||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWriteEnable(bool)));
|
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int retval = myDet->getFileWrite();
|
int retval = myDet->getFileWrite();
|
||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWriteEnable");
|
qDefs::Message(qDefs::WARNING, "File write is inconsistent for all detectors.", "qTabMeasurement::GetFileWrite");
|
||||||
dispFileName->setEnabled(true);
|
dispFileName->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
chkFile->setChecked(retval == 0 ? false : true);
|
chkFile->setChecked(retval == 0 ? false : true);
|
||||||
dispFileName->setEnabled(chkFile->isChecked());
|
dispFileName->setEnabled(chkFile->isChecked());
|
||||||
}
|
}
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabMeasurement::GetFileWriteEnable");
|
qDefs::ExceptionMessage("Could not get file over write enable.", e.what(), "qTabMeasurement::GetFileWrite");
|
||||||
dispFileName->setEnabled(true);
|
dispFileName->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWriteEnable(bool)));
|
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetFileWriteEnable(bool enable) {
|
void qTabMeasurement::SetFileWrite(bool val) {
|
||||||
FILE_LOG(logINFO) << "Set File Write to " << enable;
|
FILE_LOG(logINFO) << "Set File Write to " << val;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
myDet->setFileWrite(enable);
|
myDet->setFileWrite(val);
|
||||||
// for file save enable
|
// for file save enable
|
||||||
myPlot->SetFileWriteEnable(enable);
|
myPlot->SetFileWrite(val);
|
||||||
dispFileName->setEnabled(chkFile->isChecked());
|
dispFileName->setEnabled(chkFile->isChecked());
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not set file write enable.", e.what(), "qTabMeasurement::SetFileWriteEnable");
|
qDefs::ExceptionMessage("Could not set file write enable.", e.what(), "qTabMeasurement::SetFileWrite");
|
||||||
GetFileWriteEnable();
|
GetFileWrite();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,7 +571,7 @@ void qTabMeasurement::GetRunIndex() {
|
|||||||
if (retval == -1) {
|
if (retval == -1) {
|
||||||
qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex");
|
qDefs::Message(qDefs::WARNING, "Acquisition File Index is inconsistent for all detectors.", "qTabMeasurement::GetRunIndex");
|
||||||
}
|
}
|
||||||
spinIndex->seValue(retval);
|
spinIndex->setValue(retval);
|
||||||
} catch (const sls::NonCriticalError &e) {
|
} catch (const sls::NonCriticalError &e) {
|
||||||
qDefs::ExceptionMessage("Could not get acquisition file index.", e.what(), "qTabMeasurement::GetRunIndex");
|
qDefs::ExceptionMessage("Could not get acquisition file index.", e.what(), "qTabMeasurement::GetRunIndex");
|
||||||
}
|
}
|
||||||
@ -581,7 +588,6 @@ void qTabMeasurement::SetRunIndex(int val) {
|
|||||||
qDefs::ExceptionMessage("Could not set acquisition file index.", e.what(), "qTabMeasurement::SetRunIndex");
|
qDefs::ExceptionMessage("Could not set acquisition file index.", e.what(), "qTabMeasurement::SetRunIndex");
|
||||||
GetRunIndex();
|
GetRunIndex();
|
||||||
}
|
}
|
||||||
myDet->setFileIndex(index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetCurrentMeasurement(int val) {
|
void qTabMeasurement::SetCurrentMeasurement(int val) {
|
||||||
@ -591,7 +597,7 @@ void qTabMeasurement::SetCurrentMeasurement(int val) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetProgress() {
|
void qTabMeasurement::ResetProgress() {
|
||||||
FILE_LOG(logDEBUG) << "Resetting progress";
|
FILE_LOG(logDEBUG) << "Resetting progress";
|
||||||
lblCurrentFrame->setText(QString::number(0));
|
lblCurrentFrame->setText(QString::number(0));
|
||||||
lblCurrentMeasurement->setText(QString::number(0));
|
lblCurrentMeasurement->setText(QString::number(0));
|
||||||
@ -604,16 +610,25 @@ void qTabMeasurement::UpdateProgress() {
|
|||||||
lblCurrentFrame->setText(QString::number(myPlot->GetFrameIndex()));
|
lblCurrentFrame->setText(QString::number(myPlot->GetFrameIndex()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::UpdateFinished() {
|
int qTabMeasurement::VerifyOutputDirectoryError() {
|
||||||
UpdateProgress();
|
try {
|
||||||
disconnect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
auto retval = myDet->getFilePath();
|
||||||
spinIndex->setValue(myDet->getFileIndex());
|
// multi
|
||||||
connect(spinIndex, SIGNAL(valueChanged(int)), this, SLOT(SetRunIndex(int)));
|
if (retval.find('+') == std::string::npos) {
|
||||||
progressTimer->stop();
|
myDet->setFilePath(retval);
|
||||||
|
}
|
||||||
Enable(1);
|
//single
|
||||||
btnStart->setEnabled(true);
|
else {
|
||||||
qDefs::checkErrorMessage(myDet, "qTabMeasurement::UpdateFinished");
|
const auto &paths = sls::split(retval, '+');
|
||||||
|
for (size_t det = 0; det < paths.size(); ++det) {
|
||||||
|
myDet->setFilePath(paths[det], det);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (const sls::NonCriticalError &e) {
|
||||||
|
qDefs::ExceptionMessage("Could not set path.", e.what(), "qTabMeasurement::VerifyOutputDirectoryError");
|
||||||
|
return slsDetectorDefs::FAIL;
|
||||||
|
}
|
||||||
|
return slsDetectorDefs::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::StartAcquisition() {
|
void qTabMeasurement::StartAcquisition() {
|
||||||
@ -626,30 +641,40 @@ void qTabMeasurement::StartAcquisition() {
|
|||||||
btnStart->setEnabled(true);
|
btnStart->setEnabled(true);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//done because for receiver it cant save a file with blank file path and returns without acquiring even to the gui
|
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
disconnect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWriteEnable(bool)));
|
chkFile->setChecked(false);
|
||||||
SetFileWriteEnable(false);
|
// cannot wait for signals from chkFile
|
||||||
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWriteEnable(bool)));
|
SetFileWrite(false);
|
||||||
|
connect(chkFile, SIGNAL(toggled(bool)), this, SLOT(SetFileWrite(bool)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logINFOBLUE) << "Starting Acquisition";
|
FILE_LOG(logINFOBLUE) << "Starting Acquisition";
|
||||||
lblProgressIndex->setText(QString::number(0));
|
lblCurrentFrame->setText(QString::number(0));
|
||||||
|
lblCurrentMeasurement->setText(QString::number(0));
|
||||||
Enable(0);
|
Enable(0);
|
||||||
progressBar->setValue(0);
|
progressBar->setValue(0);
|
||||||
progressTimer->start(100);
|
progressTimer->start(100);
|
||||||
|
|
||||||
emit StartSignal();
|
emit StartSignal();
|
||||||
qDefs::checkErrorMessage(myDet, "qTabMeasurement::StartAcquisition");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void qTabMeasurement::StopAcquisition() {
|
void qTabMeasurement::StopAcquisition() {
|
||||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||||
myDet->stopAcquisition();
|
try{
|
||||||
qDefs::checkErrorMessage(myDet, "qTabMeasurement::StopAcquisition");
|
myDet->stopAcquisition();
|
||||||
|
} catch (const sls::NonCriticalError &e) {
|
||||||
|
qDefs::ExceptionMessage("Could not stop acquisition.", e.what(), "qTabMeasurement::StopAcquisition");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabMeasurement::UpdateFinished() {
|
||||||
|
UpdateProgress();
|
||||||
|
GetRunIndex();
|
||||||
|
progressTimer->stop();
|
||||||
|
Enable(1);
|
||||||
|
btnStart->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
void qTabMeasurement::Enable(bool enable) {
|
void qTabMeasurement::Enable(bool enable) {
|
||||||
frameTimeResolved->setEnabled(enable);
|
frameTimeResolved->setEnabled(enable);
|
||||||
@ -659,24 +684,10 @@ void qTabMeasurement::Enable(bool enable) {
|
|||||||
btnStart->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
btnStart->setShortcut(QApplication::translate("TabMeasurementObject", "Shift+Space", 0, QApplication::UnicodeUTF8));
|
||||||
}
|
}
|
||||||
|
|
||||||
int qTabMeasurement::VerifyOutputDirectoryError() {
|
|
||||||
try {
|
|
||||||
auto retval = myDet->getFilePath();
|
|
||||||
// if path has no +, set multi path, else set all individually
|
|
||||||
// myDet->setFileIndex(val);
|
|
||||||
} catch (const sls::NonCriticalError &e) {
|
|
||||||
qDefs::ExceptionMessage("Could not set path.", e.what(), "qTabMeasurement::VerifyOutputDirectoryError");
|
|
||||||
return slsDetectorDefs::FAIL;
|
|
||||||
}
|
|
||||||
return slsDetectorDefs::OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void qTabMeasurement::Refresh() {
|
void qTabMeasurement::Refresh() {
|
||||||
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
||||||
|
|
||||||
if (!myPlot->isRunning()) {
|
if (!myPlot->isRunning()) {
|
||||||
|
|
||||||
//timing mode - will also check if exptime>acq period
|
|
||||||
GetTimingMode();
|
GetTimingMode();
|
||||||
GetNumMeasurements();
|
GetNumMeasurements();
|
||||||
GetNumFrames();
|
GetNumFrames();
|
||||||
@ -689,10 +700,11 @@ void qTabMeasurement::Refresh() {
|
|||||||
if (sampleImplemented) {
|
if (sampleImplemented) {
|
||||||
GetNumSamples();
|
GetNumSamples();
|
||||||
}
|
}
|
||||||
GetFileWriteEnable();
|
GetFileWrite();
|
||||||
GetFileName();
|
GetFileName();
|
||||||
GetRunIndex();
|
GetRunIndex();
|
||||||
ResetProgress();
|
ResetProgress();
|
||||||
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG) << "**Updated Measurement Tab";
|
FILE_LOG(logDEBUG) << "**Updated Measurement Tab";
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ void qTabSettings::GetDynamicRange() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void qTabSettings::SetDynamicRange(int index) {
|
void qTabSettings::SetDynamicRange(int index) {
|
||||||
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data()
|
FILE_LOG(logINFO) << "Setting dynamic range to " << comboDynamicRange->currentText().toAscii().data();
|
||||||
try {
|
try {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case DYNAMICRANGE_32:
|
case DYNAMICRANGE_32:
|
||||||
|
@ -1772,6 +1772,11 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int setFileIndex(int i, int detPos = -1);
|
int setFileIndex(int i, int detPos = -1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get File index
|
||||||
|
* @param detPos -1 for all detectors in list or specific detector position
|
||||||
|
* @returns file index
|
||||||
|
*/
|
||||||
int getFileIndex(int detPos = -1) const;
|
int getFileIndex(int detPos = -1) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user