This commit is contained in:
maliakal_d 2019-07-02 09:13:47 +02:00
parent a373609b08
commit e22d03a744
20 changed files with 431 additions and 1015 deletions

View File

@ -1,15 +1,5 @@
set(CMAKE_AUTOMOC ON)
set(ENV{QMAKESPEC} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/mkspecs/linux-g++")
set(ENV{PATH} "/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/bin:$PATH")
link_directories(
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/Qt-4.8.2/lib
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwt-6.0.1/lib
/afs/psi.ch/intranet/Controls/Software/Trolltech/RHEL7-x86_64/qwtplot3d/lib
/afs/psi.ch/project/sls_det_software/dhanya_softwareDevelopment/mySoft/slsDetectorPackage/build/bin
)
set(SOURCES
slsDetectorPlotting/src/SlsQt1DPlot.cxx
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
@ -27,7 +17,6 @@ set(SOURCES
src/qTabDebugging.cpp
src/qTabDeveloper.cpp
src/qTabMessages.cpp
src/qServer.cpp
)
set(FORMS
@ -62,7 +51,6 @@ set(HEADERS
include/qTabDebugging.h
include/qTabDeveloper.h
include/qTabMessages.h
include/qServer.h
../slsDetectorSoftware/include
../slsSupportLib/include/versionAPI.h
../slsSupportLib/include/ServerSocket.h
@ -116,22 +104,3 @@ set_target_properties(slsDetectorGui PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
add_executable(gui_client
client/qClient.h
client/qClient.cpp
)
target_link_libraries(gui_client PUBLIC
slsProjectOptions
slsProjectWarnings
slsSupportLib
slsDetectorShared
pthread
rt
)
set_target_properties(gui_client PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
install(TARGETS slsDetectorGui gui_client DESTINATION bin)

View File

@ -1,124 +0,0 @@
#include "qClient.h"
#include "qDefs.h"
#include "ClientSocket.h"
#include "logger.h"
#include "sls_detector_exceptions.h"
#include <iostream>
#include <sstream>
int main(int argc, char *argv[]) {
qClient *cl = 0;
cl = new qClient(argv[1]);
cl->executeLine(argc - 2, argv + 2);
delete cl;
return 0;
}
qClient::qClient(char *h)
: controlPort(DEFAULT_GUI_PORTNO), stopPort(DEFAULT_GUI_PORTNO + 1) {
hostname.assign(h);
}
qClient::~qClient() {}
void qClient::executeLine(int narg, char *args[]) {
std::string retval = "";
std::string cmd = args[0];
// validate command structure
if (narg < 1) {
throw sls::RuntimeError("No command parsed. " + printCommands());
}
// help
if (cmd == "help") {
retval = printCommands();
}
// file name
else if (cmd == "status") {
if (narg > 1) {
std::string argument = args[1];
// start acquisition
if (argument == "start")
startAcquisition();
else if (argument == "stop")
stopAcquisition();
else {
throw sls::RuntimeError("Could not parse arguments. " + printCommands());
}
}
retval = getStatus();
}
else if (cmd == "acquire") {
startAcquisition(true);
retval = getStatus();
}
else if (cmd == "exit") {
exitServer();
retval.assign("Server exited successfully");
}
// unrecognized command
else {
throw sls::RuntimeError("Unrecognized command. " + printCommands());
}
// print result
FILE_LOG(logINFO) << cmd << ": " << retval;
}
std::string qClient::printCommands() {
std::ostringstream os;
os << "\nexit \t exits servers in gui" << std::endl;
os << "status \t gets status of acquisition in gui. - can be running or "
"idle"
<< std::endl;
os << "status i starts/stops acquistion in gui-non blocking. i is start "
"or stop"
<< std::endl;
os << "acquire starts acquistion in gui-blocking" << std::endl;
return os.str();
}
std::string qClient::getStatus() {
int fnum = qDefs::QF_GET_DETECTOR_STATUS;
int retvals[2] = {static_cast<int>(slsDetectorDefs::ERROR), 0};
auto client = sls::GuiSocket(hostname, controlPort);
client.sendCommandThenRead(fnum, nullptr, 0, retvals, sizeof(retvals));
slsDetectorDefs::runStatus status = static_cast<slsDetectorDefs::runStatus>(retvals[0]);
int progress = retvals[1];
return std::to_string(progress) + std::string("% ") +
slsDetectorDefs::runStatusType(status);
}
void qClient::startAcquisition(bool blocking) {
int fnum = qDefs::QF_START_ACQUISITION;
if (blocking)
fnum = qDefs::QF_START_AND_READ_ALL;
auto client = sls::GuiSocket(hostname.c_str(), controlPort);
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
}
void qClient::stopAcquisition() {
int fnum = qDefs::QF_STOP_ACQUISITION;
auto client = sls::GuiSocket(hostname, stopPort);
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
}
void qClient::exitServer() {
int fnum = qDefs::QF_EXIT_SERVER;
// closes both control and stop server
auto client = sls::GuiSocket(hostname, controlPort);
client.sendCommandThenRead(fnum, nullptr, 0, nullptr, 0);
}

View File

@ -1,23 +0,0 @@
#pragma once
#include <stdlib.h>
#include <string>
class qClient {
public:
qClient(char *h);
virtual ~qClient();
void executeLine(int narg, char *args[]);
private:
std::string printCommands();
std::string getStatus();
void startAcquisition(bool blocking = false);
void stopAcquisition();
void exitServer();
std::string hostname;
int controlPort;
int stopPort;
};

View File

@ -20,44 +20,14 @@ class qCloneWidget : public QMainWindow {
public:
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
QString filePath, QString fileName, int fileIndex,
QString filePath, QString fileName, int imageIndex,
bool displayStats, QString min, QString max, QString sum);
~qCloneWidget();
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
/**
* Get the 1D hist values to plot
* @param nHists Number of graphs in 1D
* @param histNBins Total Number of X axis values/channels in 1D
* @param histXAxis X Axis value in 1D
* @param histYAxis Y Axis value in 1D
* @param histTitle Title for all the graphs in 1D
* @param lines style of plot if lines or dots
* @param markers style of plot markers or not
*/
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
/**
* Get the 1D hist values to plot for angle plotting
* @param nbinsx number of bins in x axis
* @param xmin minimum in x axis
* @param xmax maximum in x axis
* @param nbinsy number of bins in y axis
* @param ymin minimum in y axis
* @param ymax maximum in y axis
* @param d data
*/
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d);
/**
* Set the range of the 1d plot
* @param IsXYRange array of x,y,min,max if these values are set
* @param XYRange array of set values of x,y,
* min, max
*/
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle);
void SetRange(bool IsXYRange[], double XYRange[]);
SlsQt1DPlot *Get1dPlot();
public slots:

View File

@ -7,9 +7,13 @@ class SlsQtH1D;
class SlsQt2DPlotLayout;
class qCloneWidget;
class QGridLayout;
class QGroupBox;
class QwtSymbol;
/*
#include "qwt_symbol.h"
#include <QGridLayout>
#include <QGroupBox>
#include <QString>
#include <QTimer>
@ -32,11 +36,13 @@ class qDrawPlot : public QWidget {
/** Destructor */
~qDrawPlot();
bool isRunning();
bool GetIsRunning();
// from measurement tabs
int GetProgress();
int64_t GetCurrentFrameIndex();
int64_t GetCurrentMeasurementIndex();
int GetNumMeasurements();
void SetNumMeasurements(int val);
// from plot tab
void Select1dPlot(bool enable);
void SetPlotTitlePrefix(QString title);
@ -74,6 +80,7 @@ class qDrawPlot : public QWidget {
void CloseClones();
void SaveClones();
void SavePlot();
void SetStopSignal();
private slots:
@ -93,19 +100,19 @@ class qDrawPlot : public QWidget {
int LockLastImageArray();
int UnlockLastImageArray();
void SetStyle(SlsQtH1D *h);
void GetStatistics(double &min, double &max, double &sum, double *array, int size);
void GetStatistics(double &min, double &max, double &sum);
void DetachHists();
void UpdateXYRange();
static void GetProgressCallBack(double currentProgress, void *this_pointer);
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, void *this_pointer);
static void GetMeasurementFinishedCallBack(int currentMeasurementIndex, void *this_pointer);
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
void AcquisitionFinished(double currentProgress, int detectorStatus);
void MeasurementFinished(int currentMeasurementIndex);
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
void toDoublePixelData(double *dest, char *source, int size, int databytes, int dr, double *gaindest = NULL);
void UpdatePlot();
void Update1dPlot(double* rawData);
void Update2dPlot(double* rawData, double* gainData);
void Update1dXYRange();
void Update2dXYRange();
static const int NUM_PEDESTAL_FRAMES = 20;
multiSlsDetector *myDet;
slsDetectorDefs::detectorType detType;
@ -123,7 +130,7 @@ class qDrawPlot : public QWidget {
bool isRunning{false};
// titles
QString plotTitle_prefix{""};
QString plotTitlePrefix{""};
QLabel *lblFrameIndexTitle1d{nullptr};
QString xTitle1d{"Channel Number"};
QString yTitle1d{"Counts"};
@ -138,11 +145,11 @@ class qDrawPlot : public QWidget {
unsigned int nHists{1};
double *datax1d{nullptr};
std::vector<double *> datay1d;
double *data2d{nullptr};
double *data2d;
//options
bool plotEnable{true};
bool binary{false};
bool isPlot{true};
bool isBinary{false};
int binaryFrom{0};
int binaryTo{0};
int persistency{0};
@ -151,12 +158,12 @@ class qDrawPlot : public QWidget {
bool isMarkers{false};
QwtSymbol *marker{nullptr};
QwtSymbol *noMarker{nullptr};
bool pedestal{false};
bool isPedestal{false};
double *pedestalVals{nullptr};
double *tempPedestalVals{nullptr};
int pedestalCount{0};
bool startPedestalCal{false};
bool accumulate{false};
bool resetPedestal{false};
bool isAccumulate{false};
bool resetAccumulate{false};
QWidget *widgetStatistics{nullptr};
QLabel *lblMinDisp{nullptr};
@ -166,23 +173,18 @@ class qDrawPlot : public QWidget {
std::vector<qCloneWidget *> cloneWidgets;
QString fileSavePath{"/tmp"};
QString fileSaveName{"Image"};
double *gainImage{nullptr};
bool gainDataExtracted{false};
bool gainDataEnable{false};
unsigned int nPixelsX{0};
unsigned int nPixelsY{0};
double minPixelsY{0};
double maxPixelsY{0};
double startPixel{0};
double endPixel{0};
double pixelWidth{0};
bool isGainDataExtracted{false};
bool hasGainData{false};
int progress{0};
int64_t currentMeasurement{0};
int64_t currentFrame{0};
pthread_mutex_t lastImageCompleteMutex;
bool hasStopped{false};
int numMeasurements{0};
unsigned int nPixelsX{0};
unsigned int nPixelsY{0};
const static int npixelsx_jctb = 400;
int npixelsy_jctb{0};
};

View File

@ -1,7 +1,7 @@
#pragma once
#include <qwidget.h>
#include <qgroupbox.h>
#include <qwidget.h>
#include "SlsQt2DPlot.h"
@ -9,45 +9,38 @@ class QGridLayout;
class QString;
class QToolButton;
class SlsQt2DPlotLayout : public QGroupBox {
Q_OBJECT
class SlsQt2DPlotLayout: public QGroupBox{
Q_OBJECT
public:
public:
SlsQt2DPlotLayout(QWidget * = NULL);
~SlsQt2DPlotLayout();
SlsQt2DPlot* GetPlot(){return the_plot;}
void SetXTitle(QString st);
void SetYTitle(QString st);
void SetZTitle(QString st);
void KeepZRangeIfSet();
// recalculate zmin and zmax from plot and update z range
void SetZRange(bool isMin, bool isMax, double min, double max);
void SetInterpolate(bool enable);
void SetContour(bool enable);
void SetLogz(bool enable);
private:
QGridLayout* the_layout;
QToolButton* btnInterpolate;
QToolButton* btnContour;
QToolButton* btnLogz;
SlsQt2DPlot* the_plot;
SlsQt2DPlot *GetPlot();
void SetXTitle(QString st);
void SetYTitle(QString st);
void SetZTitle(QString st);
void SetInterpolate(bool enable);
void SetContour(bool enable);
void SetLogz(bool enable);
void KeepZRangeIfSet();
// recalculate zmin and zmax from plot and update z range
void SetZRange(bool isMin, bool isMax, double min, double max);
public slots:
void UpdateZRange(double min, double max);
private:
void Layout();
QGridLayout *the_layout;
QToolButton *btnInterpolate;
QToolButton *btnContour;
QToolButton *btnLogz;
SlsQt2DPlot *the_plot;
bool isLog;
double zmin;
double zmax;
bool isZmin;
bool isZmax;
public slots:
void SetZScaleToLog(bool enable);
void ResetRange();
// update z range
void UpdateZRange(double min, double max) ;
};

View File

@ -25,14 +25,48 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
delete the_plot;
}
SlsQt2DPlot* SlsQt2DPlotLayout::GetPlot(){
return the_plot;
}
void SlsQt2DPlotLayout::SetXTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
}
void SlsQt2DPlotLayout::SetYTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
}
void SlsQt2DPlotLayout::SetZTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
}
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
the_plot->InterpolatedPlot(enable);
}
void SlsQt2DPlotLayout::SetContour(bool enable) {
the_plot->showContour(enable);
}
void SlsQt2DPlotLayout::SetLogz(bool enable) {
isLog = enable;
the_plot->LogZ(enable);
SetZRange(isZmin, isZmax, zmin, zmax);
}
void SlsQt2DPlotLayout::Layout(){
if(the_layout) delete the_layout;
the_layout = new QGridLayout(this);
the_layout->addWidget(the_plot,2,0,3,3);
}
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
UpdateZRange(zmin, zmax);
}
@ -47,7 +81,6 @@ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max
UpdateZRange(min, max);
}
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
if(isLog) {
the_plot->SetZMinimumToFirstGreaterThanZero();
@ -68,35 +101,3 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
the_plot->Update();
}
void SlsQt2DPlotLayout::SetInterpolate(bool enable) {
the_plot->InterpolatedPlot(enable);
}
void SlsQt2DPlotLayout::SetContour(bool enable) {
the_plot->showContour(enable);
}
void SlsQt2DPlotLayout::SetLogz(bool enable) {
isLog = enable;
the_plot->LogZ(enable);
SetZRange(isZmin, isZmax, zmin, zmax);
}
void SlsQt2DPlotLayout::SetXTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::xBottom)->setTitle(title);
}
void SlsQt2DPlotLayout::SetYTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yLeft)->setTitle(title);
}
void SlsQt2DPlotLayout::SetZTitle(QString st){
QwtText title(st);
title.setFont(QFont("Sans Serif",11,QFont::Normal));
GetPlot()->axisWidget(QwtPlot::yRight)->setTitle(title);
}

View File

@ -23,8 +23,8 @@
#include <QPainter>
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
int numDim, QString fPath, QString fName, int fIndex, bool displayStats, QString min, QString max, QString sum) :
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), fileIndex(fIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
int numDim, QString fPath, QString fName, int iIndex, bool displayStats, QString min, QString max, QString sum) :
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), imageIndex(iIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) {
// Window title
char winTitle[300], currTime[50];
@ -142,29 +142,29 @@ void qCloneWidget::SetCloneHists(unsigned int nHists, int histNBins, double *his
}
}
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QwtText frameIndexTitle) {
void qCloneWidget::SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle) {
cloneplot2D->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
cloneplot2D->KeepZRangeIfSet();
cloneplot2D->setTitle(frameIndexTitle);
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
}
void qCloneWidget::SetRange(bool IsXYRange[], double XYRange[]) {
double XYRange[4] {0, 0, 0, 0};
void* plot = cloneplot1D;
if (cloneplot2D) {
plot = cloneplot2D->GetPlot();
if (cloneplot1D) {
cloneplot1D->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
cloneplot1D->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
cloneplot1D->Update();
} else {
cloneplot2D->GetPlot()->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
cloneplot2D->GetPlot()->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
cloneplot2D->GetPlot()->Update();
}
plot->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
plot->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
plot->Update();
}
void qCloneWidget::SavePlot() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
//save
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
@ -187,7 +187,7 @@ int qCloneWidget::SavePlotAutomatic() {
char cID[10];
sprintf(cID, "%d", id);
//title
QString fName = filePath + Qstring('/') + fileName + Qstring('_') + imageIndex + Qstring('_') + QString(NowTime().c_str()) + QString(".png");
QString fName = filePath + QString('/') + fileName + QString('_') + imageIndex + QString('_') + QString(NowTime().c_str()) + QString(".png");
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
//save
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);

View File

@ -283,7 +283,7 @@ void qDetectorMain::Initialization() {
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
// Measurement tab
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tablPlot, SLOT(SetSaveFileName(QString)));
connect(tabMeasurement, SIGNAL(FileNameChangedSignal(QString)), tabPlot, SLOT(SetSaveFileName(QString)));
// Plot tab
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,7 @@
#include "string_utils.h"
#include <QStandardItemModel>
#include <QTimer>
#include <iostream>
@ -177,10 +178,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
break;
}
// to let qdrawplot know that triggers or frames are used
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
CheckAcqPeriodGreaterThanExp();
}
@ -226,24 +223,13 @@ void qTabMeasurement::SetTimingMode(int val) {
void qTabMeasurement::GetNumMeasurements() {
FILE_LOG(logDEBUG) << "Getting number of measurements";
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
try {
auto retval = myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER);
if (retval == -1) {
qDefs::Message(qDefs::WARNING, "Number of measurements is inconsistent for all detectors.", "qTabMeasurement::GetNumMeasurements");
}
spinNumMeasurements->setValue(retval);
} CATCH_DISPLAY ("Could not get number of measurements.", "qTabMeasurement::GetNumMeasurements")
spinNumFrames->setValue(myPlot->GetNumMeasurements());
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
}
void qTabMeasurement::SetNumMeasurements(int val) {
FILE_LOG(logINFO) << "Setting Number of Measurements to " << val;
try {
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val);
} CATCH_HANDLE("Could not set number of measurements.", "qTabMeasurement::SetNumMeasurements", this, &qTabMeasurement::GetNumMeasurements)
myPlot->SetNumMeasurements(val);
}
void qTabMeasurement::GetNumFrames() {
@ -588,6 +574,7 @@ void qTabMeasurement::StartAcquisition() {
void qTabMeasurement::StopAcquisition() {
FILE_LOG(logINFORED) << "Stopping Acquisition";
try{
myPlot->SetStopSignal();
myDet->stopAcquisition();
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
}
@ -611,7 +598,7 @@ void qTabMeasurement::Enable(bool enable) {
void qTabMeasurement::Refresh() {
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
if (!myPlot->isRunning()) {
if (!myPlot->GetIsRunning()) {
GetTimingMode();
GetNumMeasurements();
GetNumFrames();

View File

@ -211,7 +211,7 @@ void qTabPlot::Select1DPlot(bool enable) {
chkZMax->setEnabled(!enable);
dispZMin->setEnabled(!enable);
dispZMax->setEnabled(!enable);
myplot->Select1dPlot(enable);
myPlot->Select1dPlot(enable);
SetTitles();
SetXYRange();
if (!is1d) {
@ -485,7 +485,7 @@ void qTabPlot::SetXYRange() {
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
// to update plot with range
myplot->SetXYRangeChanged();
myPlot->SetXYRangeChanged();
myPlot->DisableZoom(disablezoom);
emit DisableZoomSignal(disablezoom);
}
@ -589,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
myPlot->IsXYRangeValues(true, qDefs::YMAX);
// to update plot with range
myplot->SetXYRangeChanged();
myPlot->SetXYRangeChanged();
myPlot->DisableZoom(true);
emit DisableZoomSignal(true);
}
@ -671,7 +671,7 @@ void qTabPlot::SetStreamingFrequency() {
void qTabPlot::Refresh() {
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
if (!myPlot->isRunning()) {
if (!myPlot->GetIsRunning()) {
boxPlotType->setEnabled(true);
// streaming frequency

View File

@ -18,14 +18,13 @@ class detectorData {
* @param fIndex file index
*/
detectorData(double progress, std::string fname, int x, int y, char *d, int dbytes, int dr, uint64_t fIndex) :
progressIndex(progress), fileName(fname), nx(x), ny(y), data(d), databytes(dbytes), dynamicRange(dr), gain(nullptr), fileIndex(fIndex) {};
progressIndex(progress), fileName(fname), fileIndex(fIndex), nx(x), ny(y), data(d), databytes(dbytes), dynamicRange(dr) {};
/**
* Destructor
* Also deletes gain
* data has to be deleted by caller
*/
~detectorData() {if(gain) delete [] gain;};
~detectorData() {};
int64_t getChannel(int i) {
int off=dynamicRange/8;
@ -54,7 +53,6 @@ class detectorData {
int nx;
int ny;
char* data;
double* gain;
int databytes;
int dynamicRange;
};

View File

@ -2093,16 +2093,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
*/
void registerAcquisitionFinishedCallback(void (*func)(double, int, void *),
void *pArg);
/**
* register callback for accessing measurement final data
* @param func function to be called at the end of the acquisition.
* gets measurement index
* @param pArg argument
*/
void registerMeasurementFinishedCallback(void (*func)(int, void *),
void *pArg);
/**
* register callback for accessing detector progress
* @param func function to be called at the end of the acquisition.
@ -2302,9 +2292,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
void (*acquisition_finished)(double, int, void *){nullptr};
void *acqFinished_p{nullptr};
void (*measurement_finished)(int, void *){nullptr};
void *measFinished_p{nullptr};
void (*progress_call)(double, void *){nullptr};
void *pProgressCallArg{nullptr};

View File

@ -823,14 +823,6 @@ public:
*/
void registerAcquisitionFinishedCallback(void( *func)(double,int, void*), void *pArg);
/**
* register callback for accessing measurement final data in client,
* @param func function to be called at the end of the acquisition.
* gets measurement index
* @param pArg argument
*/
void registerMeasurementFinishedCallback(void( *func)(int, void*), void *pArg);
/**
* register callback for accessing detector progress in client,
* @param func function to be called at the end of the acquisition.

View File

@ -1109,9 +1109,7 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
case FRAME_NUMBER:
case CYCLES_NUMBER:
case STORAGE_CELL_NUMBER:
case MEASUREMENTS_NUMBER:
throw RuntimeError("Cannot set number of frames, cycles,storage cells or "
"measurements individually.");
throw RuntimeError("Cannot set number of frames, cycles or storage cells individually.");
default:
break;
}
@ -1129,7 +1127,6 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
case FRAME_NUMBER:
case CYCLES_NUMBER:
case STORAGE_CELL_NUMBER:
case MEASUREMENTS_NUMBER:
setTotalProgress();
break;
default:
@ -3969,7 +3966,6 @@ int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) {
names.emplace_back("period");
names.emplace_back("frames");
names.emplace_back("cycles");
names.emplace_back("measurements");
names.emplace_back("timing");
switch (type) {
@ -4075,12 +4071,6 @@ void multiSlsDetector::registerAcquisitionFinishedCallback(void (*func)(double,
acqFinished_p = pArg;
}
void multiSlsDetector::registerMeasurementFinishedCallback(void (*func)(int, void *),
void *pArg) {
measurement_finished = func;
measFinished_p = pArg;
}
void multiSlsDetector::registerProgressCallback(void (*func)(double, void *), void *pArg) {
progress_call = func;
pProgressCallArg = pArg;
@ -4102,7 +4092,7 @@ void multiSlsDetector::registerDataCallback(void (*userCallback)(detectorData *,
}
int multiSlsDetector::setTotalProgress() {
int nf = 1, nc = 1, ns = 1, nm = 1;
int nf = 1, nc = 1, ns = 1;
if (multi_shm()->timerValue[FRAME_NUMBER] != 0) {
nf = multi_shm()->timerValue[FRAME_NUMBER];
@ -4116,13 +4106,9 @@ int multiSlsDetector::setTotalProgress() {
ns = multi_shm()->timerValue[STORAGE_CELL_NUMBER] + 1;
}
if (multi_shm()->timerValue[MEASUREMENTS_NUMBER] > 0) {
nm = multi_shm()->timerValue[MEASUREMENTS_NUMBER];
}
totalProgress = nf * nc * ns;
totalProgress = nm * nf * nc * ns;
FILE_LOG(logDEBUG1) << "nm " << nm << " nf " << nf << " nc " << nc << " ns " << ns;
FILE_LOG(logDEBUG1) << "nf " << nf << " nc " << nc << " ns " << ns;
FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
return totalProgress;
}
@ -4170,11 +4156,6 @@ int multiSlsDetector::acquire() {
multi_shm()->stoppedFlag = 0;
setJoinThreadFlag(false);
int nm = multi_shm()->timerValue[MEASUREMENTS_NUMBER];
if (nm < 1) {
nm = 1;
}
// verify receiver is idle
if (receiver) {
std::lock_guard<std::mutex> lock(mg);
@ -4188,58 +4169,44 @@ int multiSlsDetector::acquire() {
startProcessingThread();
// resets frames caught in receiver
if (receiver) {
if (receiver && multi_shm()->stoppedFlag == 0) {
std::lock_guard<std::mutex> lock(mg);
if (resetFramesCaught() == FAIL) {
multi_shm()->stoppedFlag = 1;
}
}
// loop through measurements
for (int im = 0; im < nm; ++im) {
if (multi_shm()->stoppedFlag != 0) {
break;
}
// start receiver
if (receiver) {
std::lock_guard<std::mutex> lock(mg);
if (startReceiver() == FAIL) {
FILE_LOG(logERROR) << "Start receiver failed ";
stopReceiver();
multi_shm()->stoppedFlag = 1;
break;
}
// let processing thread listen to these packets
sem_post(&sem_newRTAcquisition);
// start receiver
if (receiver && multi_shm()->stoppedFlag == 0) {
std::lock_guard<std::mutex> lock(mg);
if (startReceiver() == FAIL) {
FILE_LOG(logERROR) << "Start receiver failed ";
stopReceiver();
multi_shm()->stoppedFlag = 1;
}
// let processing thread listen to these packets
sem_post(&sem_newRTAcquisition);
}
if (multi_shm()->stoppedFlag == 0)
startAndReadAll();
// stop receiver
std::lock_guard<std::mutex> lock(mg);
if (receiver) {
if (stopReceiver() == FAIL) {
multi_shm()->stoppedFlag = 1;
} else {
if (dataReady != nullptr) {
sem_wait(&sem_endRTAcquisition); // waits for receiver's
}
// external process to be
// done sending data to gui
// stop receiver
std::lock_guard<std::mutex> lock(mg);
if (receiver) {
if (stopReceiver() == FAIL) {
multi_shm()->stoppedFlag = 1;
} else {
if (dataReady != nullptr) {
sem_wait(&sem_endRTAcquisition); // waits for receiver's
}
// external process to be
// done sending data to gui
}
int findex = 0;
findex = incrementFileIndex();
}
incrementFileIndex();
if (measurement_finished != nullptr) {
measurement_finished(im, measFinished_p);
}
if (multi_shm()->stoppedFlag != 0) {
break;
}
} // end measurements loop im
// waiting for the data processing thread to finish!
setJoinThreadFlag(true);

View File

@ -312,7 +312,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->timerValue[ACTUAL_TIME] = 0;
shm()->timerValue[MEASUREMENT_TIME] = 0;
shm()->timerValue[PROGRESS] = 0;
shm()->timerValue[MEASUREMENTS_NUMBER] = 1;
shm()->timerValue[FRAMES_FROM_START] = 0;
shm()->timerValue[FRAMES_FROM_START_PG] = 0;
shm()->timerValue[ANALOG_SAMPLES] = 1;
@ -1522,15 +1521,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
FILE_LOG(logDEBUG1) << "Setting " << getTimerType(index) << " to " << t
<< " ns/value";
// meausurement is only shm level
if (index == MEASUREMENTS_NUMBER) {
if (t >= 0) {
shm()->timerValue[index] = t;
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << t;
}
return shm()->timerValue[index];
}
// send to detector
int64_t oldtimer = shm()->timerValue[index];
if (shm()->onlineFlag == ONLINE_FLAG) {

View File

@ -610,13 +610,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
++i;
/*! \page timing
- <b>measurements [i]</b> sets/gets number of measurements. \c Returns \c (long long int)
*/
descrToFuncMap[i].m_pFuncName = "measurements";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
++i;
/*! \page timing
- <b>samples [i]</b> sets/gets number of samples (both analog and digital) expected from the ctb. Used in CHIP TEST BOARD and MOENCH only. \c Returns \c (long long int)
*/
@ -4484,8 +4477,6 @@ std::string slsDetectorCommand::cmdTimer(int narg, const char * const args[], in
index = FRAME_NUMBER;
else if (cmd == "cycles")
index = CYCLES_NUMBER;
else if (cmd == "measurements")
index = MEASUREMENTS_NUMBER;
// also does digital sample
else if (cmd == "samples")
index = ANALOG_SAMPLES;

View File

@ -406,10 +406,6 @@ void slsDetectorUsers::registerAcquisitionFinishedCallback(void( *func)(double,i
detector.registerAcquisitionFinishedCallback(func,pArg);
}
void slsDetectorUsers::registerMeasurementFinishedCallback(void( *func)(int,void*), void *pArg) {
detector.registerMeasurementFinishedCallback(func,pArg);
}
void slsDetectorUsers::registerProgressCallback(void( *func)(double,void*), void *pArg) {
detector.registerProgressCallback(func,pArg);
}

View File

@ -29,7 +29,6 @@
/** default ports */
#define DEFAULT_PORTNO 1952
#define DEFAULT_UDP_PORTNO 50001
#define DEFAULT_GUI_PORTNO 65001
#define DEFAULT_ZMQ_CL_PORTNO 30001
#define DEFAULT_ZMQ_RX_PORTNO 30001
@ -115,7 +114,6 @@ class slsDetectorDefs {
*/
PROGRESS, /**< fraction of measurement elapsed - only get! */
MEASUREMENTS_NUMBER,
FRAMES_FROM_START,
FRAMES_FROM_START_PG,
ANALOG_SAMPLES,
@ -927,12 +925,12 @@ format
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD,
DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER,
ACTUAL_TIME,MEASUREMENT_TIME,
PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,ANALOG_SAMPLES,DIGITAL_SAMPLES,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER,
PROGRESS,FRAMES_FROM_START,FRAMES_FROM_START_PG,ANALOG_SAMPLES,DIGITAL_SAMPLES,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER,
SUBFRAME_DEADTIME \returns std::string
frame_number,acquisition_time,frame_period,
delay_after_trigger,gates_number, cycles_number,
actual_time,measurement_time,
progress,measurements_number,frames_from_start,frames_from_start_pg,analog_samples, digital_samples,subframe_acquisition_time,storage_cell_number,
progress,frames_from_start,frames_from_start_pg,analog_samples, digital_samples,subframe_acquisition_time,storage_cell_number,
SUBFRAME_DEADTIME
*/
static std::string getTimerType(timerIndex t) {
@ -955,8 +953,6 @@ format
return std::string("measurement_time");
case PROGRESS:
return std::string("progress");
case MEASUREMENTS_NUMBER:
return std::string("measurements_number");
case FRAMES_FROM_START:
return std::string("frames_from_start");
case FRAMES_FROM_START_PG: