mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 17:10:03 +02:00
WIP
This commit is contained in:
parent
a373609b08
commit
e22d03a744
@ -1,15 +1,5 @@
|
|||||||
set(CMAKE_AUTOMOC ON)
|
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
|
set(SOURCES
|
||||||
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
slsDetectorPlotting/src/SlsQt1DPlot.cxx
|
||||||
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
slsDetectorPlotting/src/SlsQt1DZoomer.cxx
|
||||||
@ -27,7 +17,6 @@ set(SOURCES
|
|||||||
src/qTabDebugging.cpp
|
src/qTabDebugging.cpp
|
||||||
src/qTabDeveloper.cpp
|
src/qTabDeveloper.cpp
|
||||||
src/qTabMessages.cpp
|
src/qTabMessages.cpp
|
||||||
src/qServer.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(FORMS
|
set(FORMS
|
||||||
@ -62,7 +51,6 @@ set(HEADERS
|
|||||||
include/qTabDebugging.h
|
include/qTabDebugging.h
|
||||||
include/qTabDeveloper.h
|
include/qTabDeveloper.h
|
||||||
include/qTabMessages.h
|
include/qTabMessages.h
|
||||||
include/qServer.h
|
|
||||||
../slsDetectorSoftware/include
|
../slsDetectorSoftware/include
|
||||||
../slsSupportLib/include/versionAPI.h
|
../slsSupportLib/include/versionAPI.h
|
||||||
../slsSupportLib/include/ServerSocket.h
|
../slsSupportLib/include/ServerSocket.h
|
||||||
@ -116,22 +104,3 @@ set_target_properties(slsDetectorGui PROPERTIES
|
|||||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
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)
|
|
||||||
|
@ -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);
|
|
||||||
}
|
|
@ -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;
|
|
||||||
};
|
|
@ -20,44 +20,14 @@ class qCloneWidget : public QMainWindow {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle, int numDim,
|
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);
|
bool displayStats, QString min, QString max, QString sum);
|
||||||
~qCloneWidget();
|
~qCloneWidget();
|
||||||
|
|
||||||
void SetupWidgetWindow(QString title, QString xTitle, QString yTitle, QString zTitle, int numDim);
|
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);
|
void SetCloneHists(unsigned int nHists, int histNBins, double *histXAxis, std::vector<double*> histYAxis, QString histTitle, bool lines, bool markers);
|
||||||
|
void SetCloneHists2D(int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, double *d, QString frameIndexTitle);
|
||||||
/**
|
|
||||||
* 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 SetRange(bool IsXYRange[], double XYRange[]);
|
void SetRange(bool IsXYRange[], double XYRange[]);
|
||||||
|
|
||||||
SlsQt1DPlot *Get1dPlot();
|
SlsQt1DPlot *Get1dPlot();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -7,9 +7,13 @@ class SlsQtH1D;
|
|||||||
class SlsQt2DPlotLayout;
|
class SlsQt2DPlotLayout;
|
||||||
class qCloneWidget;
|
class qCloneWidget;
|
||||||
|
|
||||||
|
class QGridLayout;
|
||||||
|
class QGroupBox;
|
||||||
|
class QwtSymbol;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include "qwt_symbol.h"
|
#include "qwt_symbol.h"
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@ -32,11 +36,13 @@ class qDrawPlot : public QWidget {
|
|||||||
/** Destructor */
|
/** Destructor */
|
||||||
~qDrawPlot();
|
~qDrawPlot();
|
||||||
|
|
||||||
bool isRunning();
|
bool GetIsRunning();
|
||||||
// from measurement tabs
|
// from measurement tabs
|
||||||
int GetProgress();
|
int GetProgress();
|
||||||
int64_t GetCurrentFrameIndex();
|
int64_t GetCurrentFrameIndex();
|
||||||
int64_t GetCurrentMeasurementIndex();
|
int64_t GetCurrentMeasurementIndex();
|
||||||
|
int GetNumMeasurements();
|
||||||
|
void SetNumMeasurements(int val);
|
||||||
// from plot tab
|
// from plot tab
|
||||||
void Select1dPlot(bool enable);
|
void Select1dPlot(bool enable);
|
||||||
void SetPlotTitlePrefix(QString title);
|
void SetPlotTitlePrefix(QString title);
|
||||||
@ -74,6 +80,7 @@ class qDrawPlot : public QWidget {
|
|||||||
void CloseClones();
|
void CloseClones();
|
||||||
void SaveClones();
|
void SaveClones();
|
||||||
void SavePlot();
|
void SavePlot();
|
||||||
|
void SetStopSignal();
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
@ -93,18 +100,18 @@ class qDrawPlot : public QWidget {
|
|||||||
int LockLastImageArray();
|
int LockLastImageArray();
|
||||||
int UnlockLastImageArray();
|
int UnlockLastImageArray();
|
||||||
void SetStyle(SlsQtH1D *h);
|
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 DetachHists();
|
||||||
void UpdateXYRange();
|
|
||||||
static void GetProgressCallBack(double currentProgress, void *this_pointer);
|
static void GetProgressCallBack(double currentProgress, void *this_pointer);
|
||||||
static void GetAcquisitionFinishedCallBack(double currentProgress, int detectorStatus, 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);
|
static void GetDataCallBack(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex, void *this_pointer);
|
||||||
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
void AcquisitionFinished(double currentProgress, int detectorStatus);
|
||||||
void MeasurementFinished(int currentMeasurementIndex);
|
|
||||||
void GetData(detectorData *data, uint64_t frameIndex, uint32_t subFrameIndex);
|
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 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;
|
static const int NUM_PEDESTAL_FRAMES = 20;
|
||||||
multiSlsDetector *myDet;
|
multiSlsDetector *myDet;
|
||||||
@ -123,7 +130,7 @@ class qDrawPlot : public QWidget {
|
|||||||
bool isRunning{false};
|
bool isRunning{false};
|
||||||
|
|
||||||
// titles
|
// titles
|
||||||
QString plotTitle_prefix{""};
|
QString plotTitlePrefix{""};
|
||||||
QLabel *lblFrameIndexTitle1d{nullptr};
|
QLabel *lblFrameIndexTitle1d{nullptr};
|
||||||
QString xTitle1d{"Channel Number"};
|
QString xTitle1d{"Channel Number"};
|
||||||
QString yTitle1d{"Counts"};
|
QString yTitle1d{"Counts"};
|
||||||
@ -138,11 +145,11 @@ class qDrawPlot : public QWidget {
|
|||||||
unsigned int nHists{1};
|
unsigned int nHists{1};
|
||||||
double *datax1d{nullptr};
|
double *datax1d{nullptr};
|
||||||
std::vector<double *> datay1d;
|
std::vector<double *> datay1d;
|
||||||
double *data2d{nullptr};
|
double *data2d;
|
||||||
|
|
||||||
//options
|
//options
|
||||||
bool plotEnable{true};
|
bool isPlot{true};
|
||||||
bool binary{false};
|
bool isBinary{false};
|
||||||
int binaryFrom{0};
|
int binaryFrom{0};
|
||||||
int binaryTo{0};
|
int binaryTo{0};
|
||||||
int persistency{0};
|
int persistency{0};
|
||||||
@ -151,12 +158,12 @@ class qDrawPlot : public QWidget {
|
|||||||
bool isMarkers{false};
|
bool isMarkers{false};
|
||||||
QwtSymbol *marker{nullptr};
|
QwtSymbol *marker{nullptr};
|
||||||
QwtSymbol *noMarker{nullptr};
|
QwtSymbol *noMarker{nullptr};
|
||||||
bool pedestal{false};
|
bool isPedestal{false};
|
||||||
double *pedestalVals{nullptr};
|
double *pedestalVals{nullptr};
|
||||||
double *tempPedestalVals{nullptr};
|
double *tempPedestalVals{nullptr};
|
||||||
int pedestalCount{0};
|
int pedestalCount{0};
|
||||||
bool startPedestalCal{false};
|
bool resetPedestal{false};
|
||||||
bool accumulate{false};
|
bool isAccumulate{false};
|
||||||
bool resetAccumulate{false};
|
bool resetAccumulate{false};
|
||||||
QWidget *widgetStatistics{nullptr};
|
QWidget *widgetStatistics{nullptr};
|
||||||
QLabel *lblMinDisp{nullptr};
|
QLabel *lblMinDisp{nullptr};
|
||||||
@ -166,23 +173,18 @@ class qDrawPlot : public QWidget {
|
|||||||
std::vector<qCloneWidget *> cloneWidgets;
|
std::vector<qCloneWidget *> cloneWidgets;
|
||||||
QString fileSavePath{"/tmp"};
|
QString fileSavePath{"/tmp"};
|
||||||
QString fileSaveName{"Image"};
|
QString fileSaveName{"Image"};
|
||||||
double *gainImage{nullptr};
|
bool isGainDataExtracted{false};
|
||||||
bool gainDataExtracted{false};
|
bool hasGainData{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};
|
|
||||||
|
|
||||||
int progress{0};
|
int progress{0};
|
||||||
int64_t currentMeasurement{0};
|
int64_t currentMeasurement{0};
|
||||||
int64_t currentFrame{0};
|
int64_t currentFrame{0};
|
||||||
pthread_mutex_t lastImageCompleteMutex;
|
pthread_mutex_t lastImageCompleteMutex;
|
||||||
|
bool hasStopped{false};
|
||||||
|
int numMeasurements{0};
|
||||||
|
|
||||||
|
unsigned int nPixelsX{0};
|
||||||
|
unsigned int nPixelsY{0};
|
||||||
const static int npixelsx_jctb = 400;
|
const static int npixelsx_jctb = 400;
|
||||||
int npixelsy_jctb{0};
|
int npixelsy_jctb{0};
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <qwidget.h>
|
|
||||||
#include <qgroupbox.h>
|
#include <qgroupbox.h>
|
||||||
|
#include <qwidget.h>
|
||||||
|
|
||||||
#include "SlsQt2DPlot.h"
|
#include "SlsQt2DPlot.h"
|
||||||
|
|
||||||
@ -9,45 +9,38 @@ class QGridLayout;
|
|||||||
class QString;
|
class QString;
|
||||||
class QToolButton;
|
class QToolButton;
|
||||||
|
|
||||||
|
class SlsQt2DPlotLayout : public QGroupBox {
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
class SlsQt2DPlotLayout: public QGroupBox{
|
public:
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SlsQt2DPlotLayout(QWidget * = NULL);
|
SlsQt2DPlotLayout(QWidget * = NULL);
|
||||||
~SlsQt2DPlotLayout();
|
~SlsQt2DPlotLayout();
|
||||||
|
|
||||||
SlsQt2DPlot* GetPlot(){return the_plot;}
|
SlsQt2DPlot *GetPlot();
|
||||||
void SetXTitle(QString st);
|
void SetXTitle(QString st);
|
||||||
void SetYTitle(QString st);
|
void SetYTitle(QString st);
|
||||||
void SetZTitle(QString st);
|
void SetZTitle(QString st);
|
||||||
void KeepZRangeIfSet();
|
void SetInterpolate(bool enable);
|
||||||
// recalculate zmin and zmax from plot and update z range
|
void SetContour(bool enable);
|
||||||
void SetZRange(bool isMin, bool isMax, double min, double max);
|
void SetLogz(bool enable);
|
||||||
void SetInterpolate(bool enable);
|
void KeepZRangeIfSet();
|
||||||
void SetContour(bool enable);
|
// recalculate zmin and zmax from plot and update z range
|
||||||
void SetLogz(bool enable);
|
void SetZRange(bool isMin, bool isMax, double min, double max);
|
||||||
|
public slots:
|
||||||
private:
|
void UpdateZRange(double min, double max);
|
||||||
QGridLayout* the_layout;
|
|
||||||
QToolButton* btnInterpolate;
|
|
||||||
QToolButton* btnContour;
|
|
||||||
QToolButton* btnLogz;
|
|
||||||
SlsQt2DPlot* the_plot;
|
|
||||||
|
|
||||||
|
private:
|
||||||
void Layout();
|
void Layout();
|
||||||
|
|
||||||
|
QGridLayout *the_layout;
|
||||||
|
QToolButton *btnInterpolate;
|
||||||
|
QToolButton *btnContour;
|
||||||
|
QToolButton *btnLogz;
|
||||||
|
SlsQt2DPlot *the_plot;
|
||||||
|
|
||||||
bool isLog;
|
bool isLog;
|
||||||
double zmin;
|
double zmin;
|
||||||
double zmax;
|
double zmax;
|
||||||
bool isZmin;
|
bool isZmin;
|
||||||
bool isZmax;
|
bool isZmax;
|
||||||
|
|
||||||
public slots:
|
|
||||||
void SetZScaleToLog(bool enable);
|
|
||||||
void ResetRange();
|
|
||||||
|
|
||||||
// update z range
|
|
||||||
void UpdateZRange(double min, double max) ;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -25,14 +25,48 @@ SlsQt2DPlotLayout::~SlsQt2DPlotLayout(){
|
|||||||
delete the_plot;
|
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(){
|
void SlsQt2DPlotLayout::Layout(){
|
||||||
if(the_layout) delete the_layout;
|
if(the_layout) delete the_layout;
|
||||||
the_layout = new QGridLayout(this);
|
the_layout = new QGridLayout(this);
|
||||||
the_layout->addWidget(the_plot,2,0,3,3);
|
the_layout->addWidget(the_plot,2,0,3,3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
void SlsQt2DPlotLayout::KeepZRangeIfSet() {
|
||||||
UpdateZRange(zmin, zmax);
|
UpdateZRange(zmin, zmax);
|
||||||
}
|
}
|
||||||
@ -47,7 +81,6 @@ void SlsQt2DPlotLayout::SetZRange(bool isMin, bool isMax, double min, double max
|
|||||||
UpdateZRange(min, max);
|
UpdateZRange(min, max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
||||||
if(isLog) {
|
if(isLog) {
|
||||||
the_plot->SetZMinimumToFirstGreaterThanZero();
|
the_plot->SetZMinimumToFirstGreaterThanZero();
|
||||||
@ -68,35 +101,3 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
|
|||||||
the_plot->Update();
|
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);
|
|
||||||
}
|
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
|
||||||
qCloneWidget::qCloneWidget(QWidget *parent, int id, QString title, QString xTitle, QString yTitle, QString zTitle,
|
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) :
|
int numDim, QString fPath, QString fName, int iIndex, bool displayStats, QString min, QString max, QString sum) :
|
||||||
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), fileIndex(fIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
QMainWindow(parent), id(id), filePath(fPath), fileName(fName), imageIndex(iIndex), cloneplot1D(nullptr), cloneplot2D(nullptr),
|
||||||
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) {
|
marker(nullptr), nomarker(nullptr), mainLayout(nullptr), boxPlot(nullptr), lblHistTitle(nullptr) {
|
||||||
// Window title
|
// Window title
|
||||||
char winTitle[300], currTime[50];
|
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->GetPlot()->SetData(nbinsx, xmin, xmax, nbinsy, ymin, ymax, d);
|
||||||
cloneplot2D->KeepZRangeIfSet();
|
cloneplot2D->KeepZRangeIfSet();
|
||||||
cloneplot2D->setTitle(frameIndexTitle);
|
cloneplot2D->setTitle(frameIndexTitle.toAscii().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void qCloneWidget::SetRange(bool IsXYRange[], double XYRange[]) {
|
void qCloneWidget::SetRange(bool IsXYRange[], double XYRange[]) {
|
||||||
double XYRange[4] {0, 0, 0, 0};
|
if (cloneplot1D) {
|
||||||
void* plot = cloneplot1D;
|
cloneplot1D->SetXMinMax(XYRange[qDefs::XMIN], XYRange[qDefs::XMAX]);
|
||||||
if (cloneplot2D) {
|
cloneplot1D->SetYMinMax(XYRange[qDefs::YMIN], XYRange[qDefs::YMAX]);
|
||||||
plot = cloneplot2D->GetPlot();
|
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() {
|
void qCloneWidget::SavePlot() {
|
||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID, "%d", id);
|
sprintf(cID, "%d", id);
|
||||||
//title
|
//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();
|
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||||
//save
|
//save
|
||||||
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
||||||
@ -187,7 +187,7 @@ int qCloneWidget::SavePlotAutomatic() {
|
|||||||
char cID[10];
|
char cID[10];
|
||||||
sprintf(cID, "%d", id);
|
sprintf(cID, "%d", id);
|
||||||
//title
|
//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();
|
FILE_LOG(logDEBUG) << "fname:" << fName.toAscii().constData();
|
||||||
//save
|
//save
|
||||||
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
QImage img(boxPlot->size().width(), boxPlot->size().height(), QImage::Format_RGB32);
|
||||||
|
@ -283,7 +283,7 @@ void qDetectorMain::Initialization() {
|
|||||||
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
connect(tabs,SIGNAL(currentChanged(int)), this, SLOT(Refresh(int)));//( QWidget*)));
|
||||||
// Measurement tab
|
// Measurement tab
|
||||||
connect(tabMeasurement, SIGNAL(StartSignal()), this,SLOT(EnableTabs()));
|
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
|
// Plot tab
|
||||||
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
connect(tabPlot, SIGNAL(DisableZoomSignal(bool)), this, SLOT(SetZoomToolTip(bool)));
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@
|
|||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
|
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -177,10 +178,6 @@ void qTabMeasurement::EnableWidgetsforTimingMode() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// to let qdrawplot know that triggers or frames are used
|
|
||||||
myPlot->setFrameEnabled(lblNumFrames->isEnabled());
|
|
||||||
myPlot->setTriggerEnabled(lblNumTriggers->isEnabled());
|
|
||||||
|
|
||||||
CheckAcqPeriodGreaterThanExp();
|
CheckAcqPeriodGreaterThanExp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,24 +223,13 @@ void qTabMeasurement::SetTimingMode(int val) {
|
|||||||
void qTabMeasurement::GetNumMeasurements() {
|
void qTabMeasurement::GetNumMeasurements() {
|
||||||
FILE_LOG(logDEBUG) << "Getting number of measurements";
|
FILE_LOG(logDEBUG) << "Getting number of measurements";
|
||||||
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
disconnect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||||
|
spinNumFrames->setValue(myPlot->GetNumMeasurements());
|
||||||
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")
|
|
||||||
|
|
||||||
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
connect(spinNumMeasurements, SIGNAL(valueChanged(int)), this, SLOT(SetNumMeasurements(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::SetNumMeasurements(int val) {
|
void qTabMeasurement::SetNumMeasurements(int val) {
|
||||||
FILE_LOG(logINFO) << "Setting Number of Measurements to " << val;
|
FILE_LOG(logINFO) << "Setting Number of Measurements to " << val;
|
||||||
|
myPlot->SetNumMeasurements(val);
|
||||||
try {
|
|
||||||
myDet->setTimer(slsDetectorDefs::MEASUREMENTS_NUMBER, val);
|
|
||||||
} CATCH_HANDLE("Could not set number of measurements.", "qTabMeasurement::SetNumMeasurements", this, &qTabMeasurement::GetNumMeasurements)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void qTabMeasurement::GetNumFrames() {
|
void qTabMeasurement::GetNumFrames() {
|
||||||
@ -588,6 +574,7 @@ void qTabMeasurement::StartAcquisition() {
|
|||||||
void qTabMeasurement::StopAcquisition() {
|
void qTabMeasurement::StopAcquisition() {
|
||||||
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
FILE_LOG(logINFORED) << "Stopping Acquisition";
|
||||||
try{
|
try{
|
||||||
|
myPlot->SetStopSignal();
|
||||||
myDet->stopAcquisition();
|
myDet->stopAcquisition();
|
||||||
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
} CATCH_DISPLAY("Could not stop acquisition.", "qTabMeasurement::StopAcquisition")
|
||||||
}
|
}
|
||||||
@ -611,7 +598,7 @@ void qTabMeasurement::Enable(bool enable) {
|
|||||||
void qTabMeasurement::Refresh() {
|
void qTabMeasurement::Refresh() {
|
||||||
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
FILE_LOG(logDEBUG) << "**Updating Measurement Tab";
|
||||||
|
|
||||||
if (!myPlot->isRunning()) {
|
if (!myPlot->GetIsRunning()) {
|
||||||
GetTimingMode();
|
GetTimingMode();
|
||||||
GetNumMeasurements();
|
GetNumMeasurements();
|
||||||
GetNumFrames();
|
GetNumFrames();
|
||||||
|
@ -211,7 +211,7 @@ void qTabPlot::Select1DPlot(bool enable) {
|
|||||||
chkZMax->setEnabled(!enable);
|
chkZMax->setEnabled(!enable);
|
||||||
dispZMin->setEnabled(!enable);
|
dispZMin->setEnabled(!enable);
|
||||||
dispZMax->setEnabled(!enable);
|
dispZMax->setEnabled(!enable);
|
||||||
myplot->Select1dPlot(enable);
|
myPlot->Select1dPlot(enable);
|
||||||
SetTitles();
|
SetTitles();
|
||||||
SetXYRange();
|
SetXYRange();
|
||||||
if (!is1d) {
|
if (!is1d) {
|
||||||
@ -485,7 +485,7 @@ void qTabPlot::SetXYRange() {
|
|||||||
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
connect(dispYMax, SIGNAL(editingFinished()), this, SLOT(SetYRange()));
|
||||||
|
|
||||||
// to update plot with range
|
// to update plot with range
|
||||||
myplot->SetXYRangeChanged();
|
myPlot->SetXYRangeChanged();
|
||||||
myPlot->DisableZoom(disablezoom);
|
myPlot->DisableZoom(disablezoom);
|
||||||
emit DisableZoomSignal(disablezoom);
|
emit DisableZoomSignal(disablezoom);
|
||||||
}
|
}
|
||||||
@ -589,7 +589,7 @@ void qTabPlot::MaintainAspectRatio(int dimension) {
|
|||||||
myPlot->IsXYRangeValues(true, qDefs::YMAX);
|
myPlot->IsXYRangeValues(true, qDefs::YMAX);
|
||||||
|
|
||||||
// to update plot with range
|
// to update plot with range
|
||||||
myplot->SetXYRangeChanged();
|
myPlot->SetXYRangeChanged();
|
||||||
myPlot->DisableZoom(true);
|
myPlot->DisableZoom(true);
|
||||||
emit DisableZoomSignal(true);
|
emit DisableZoomSignal(true);
|
||||||
}
|
}
|
||||||
@ -671,7 +671,7 @@ void qTabPlot::SetStreamingFrequency() {
|
|||||||
void qTabPlot::Refresh() {
|
void qTabPlot::Refresh() {
|
||||||
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
FILE_LOG(logDEBUG) << "**Updating Plot Tab";
|
||||||
|
|
||||||
if (!myPlot->isRunning()) {
|
if (!myPlot->GetIsRunning()) {
|
||||||
boxPlotType->setEnabled(true);
|
boxPlotType->setEnabled(true);
|
||||||
|
|
||||||
// streaming frequency
|
// streaming frequency
|
||||||
|
@ -18,14 +18,13 @@ class detectorData {
|
|||||||
* @param fIndex file index
|
* @param fIndex file index
|
||||||
*/
|
*/
|
||||||
detectorData(double progress, std::string fname, int x, int y, char *d, int dbytes, int dr, uint64_t fIndex) :
|
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
|
* Destructor
|
||||||
* Also deletes gain
|
|
||||||
* data has to be deleted by caller
|
* data has to be deleted by caller
|
||||||
*/
|
*/
|
||||||
~detectorData() {if(gain) delete [] gain;};
|
~detectorData() {};
|
||||||
|
|
||||||
int64_t getChannel(int i) {
|
int64_t getChannel(int i) {
|
||||||
int off=dynamicRange/8;
|
int off=dynamicRange/8;
|
||||||
@ -54,7 +53,6 @@ class detectorData {
|
|||||||
int nx;
|
int nx;
|
||||||
int ny;
|
int ny;
|
||||||
char* data;
|
char* data;
|
||||||
double* gain;
|
|
||||||
int databytes;
|
int databytes;
|
||||||
int dynamicRange;
|
int dynamicRange;
|
||||||
};
|
};
|
||||||
|
@ -2093,16 +2093,6 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void registerAcquisitionFinishedCallback(void (*func)(double, int, void *),
|
void registerAcquisitionFinishedCallback(void (*func)(double, int, void *),
|
||||||
void *pArg);
|
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
|
* register callback for accessing detector progress
|
||||||
* @param func function to be called at the end of the acquisition.
|
* @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 (*acquisition_finished)(double, int, void *){nullptr};
|
||||||
void *acqFinished_p{nullptr};
|
void *acqFinished_p{nullptr};
|
||||||
|
|
||||||
void (*measurement_finished)(int, void *){nullptr};
|
|
||||||
void *measFinished_p{nullptr};
|
|
||||||
|
|
||||||
void (*progress_call)(double, void *){nullptr};
|
void (*progress_call)(double, void *){nullptr};
|
||||||
void *pProgressCallArg{nullptr};
|
void *pProgressCallArg{nullptr};
|
||||||
|
|
||||||
|
@ -823,14 +823,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void registerAcquisitionFinishedCallback(void( *func)(double,int, void*), void *pArg);
|
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,
|
* register callback for accessing detector progress in client,
|
||||||
* @param func function to be called at the end of the acquisition.
|
* @param func function to be called at the end of the acquisition.
|
||||||
|
@ -1109,9 +1109,7 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
|
|||||||
case FRAME_NUMBER:
|
case FRAME_NUMBER:
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
case STORAGE_CELL_NUMBER:
|
case STORAGE_CELL_NUMBER:
|
||||||
case MEASUREMENTS_NUMBER:
|
throw RuntimeError("Cannot set number of frames, cycles or storage cells individually.");
|
||||||
throw RuntimeError("Cannot set number of frames, cycles,storage cells or "
|
|
||||||
"measurements individually.");
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1129,7 +1127,6 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
|
|||||||
case FRAME_NUMBER:
|
case FRAME_NUMBER:
|
||||||
case CYCLES_NUMBER:
|
case CYCLES_NUMBER:
|
||||||
case STORAGE_CELL_NUMBER:
|
case STORAGE_CELL_NUMBER:
|
||||||
case MEASUREMENTS_NUMBER:
|
|
||||||
setTotalProgress();
|
setTotalProgress();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -3969,7 +3966,6 @@ int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) {
|
|||||||
names.emplace_back("period");
|
names.emplace_back("period");
|
||||||
names.emplace_back("frames");
|
names.emplace_back("frames");
|
||||||
names.emplace_back("cycles");
|
names.emplace_back("cycles");
|
||||||
names.emplace_back("measurements");
|
|
||||||
names.emplace_back("timing");
|
names.emplace_back("timing");
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -4075,12 +4071,6 @@ void multiSlsDetector::registerAcquisitionFinishedCallback(void (*func)(double,
|
|||||||
acqFinished_p = pArg;
|
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) {
|
void multiSlsDetector::registerProgressCallback(void (*func)(double, void *), void *pArg) {
|
||||||
progress_call = func;
|
progress_call = func;
|
||||||
pProgressCallArg = pArg;
|
pProgressCallArg = pArg;
|
||||||
@ -4102,7 +4092,7 @@ void multiSlsDetector::registerDataCallback(void (*userCallback)(detectorData *,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setTotalProgress() {
|
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) {
|
if (multi_shm()->timerValue[FRAME_NUMBER] != 0) {
|
||||||
nf = multi_shm()->timerValue[FRAME_NUMBER];
|
nf = multi_shm()->timerValue[FRAME_NUMBER];
|
||||||
@ -4116,13 +4106,9 @@ int multiSlsDetector::setTotalProgress() {
|
|||||||
ns = multi_shm()->timerValue[STORAGE_CELL_NUMBER] + 1;
|
ns = multi_shm()->timerValue[STORAGE_CELL_NUMBER] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multi_shm()->timerValue[MEASUREMENTS_NUMBER] > 0) {
|
totalProgress = nf * nc * ns;
|
||||||
nm = multi_shm()->timerValue[MEASUREMENTS_NUMBER];
|
|
||||||
}
|
|
||||||
|
|
||||||
totalProgress = nm * nf * nc * ns;
|
FILE_LOG(logDEBUG1) << "nf " << nf << " nc " << nc << " ns " << ns;
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "nm " << nm << " nf " << nf << " nc " << nc << " ns " << ns;
|
|
||||||
FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
|
FILE_LOG(logDEBUG1) << "Set total progress " << totalProgress << std::endl;
|
||||||
return totalProgress;
|
return totalProgress;
|
||||||
}
|
}
|
||||||
@ -4170,11 +4156,6 @@ int multiSlsDetector::acquire() {
|
|||||||
multi_shm()->stoppedFlag = 0;
|
multi_shm()->stoppedFlag = 0;
|
||||||
setJoinThreadFlag(false);
|
setJoinThreadFlag(false);
|
||||||
|
|
||||||
int nm = multi_shm()->timerValue[MEASUREMENTS_NUMBER];
|
|
||||||
if (nm < 1) {
|
|
||||||
nm = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify receiver is idle
|
// verify receiver is idle
|
||||||
if (receiver) {
|
if (receiver) {
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
@ -4188,58 +4169,44 @@ int multiSlsDetector::acquire() {
|
|||||||
startProcessingThread();
|
startProcessingThread();
|
||||||
|
|
||||||
// resets frames caught in receiver
|
// resets frames caught in receiver
|
||||||
if (receiver) {
|
if (receiver && multi_shm()->stoppedFlag == 0) {
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
if (resetFramesCaught() == FAIL) {
|
if (resetFramesCaught() == FAIL) {
|
||||||
multi_shm()->stoppedFlag = 1;
|
multi_shm()->stoppedFlag = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop through measurements
|
// start receiver
|
||||||
for (int im = 0; im < nm; ++im) {
|
if (receiver && multi_shm()->stoppedFlag == 0) {
|
||||||
if (multi_shm()->stoppedFlag != 0) {
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
break;
|
if (startReceiver() == FAIL) {
|
||||||
}
|
FILE_LOG(logERROR) << "Start receiver failed ";
|
||||||
|
stopReceiver();
|
||||||
// start receiver
|
multi_shm()->stoppedFlag = 1;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
// let processing thread listen to these packets
|
||||||
|
sem_post(&sem_newRTAcquisition);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (multi_shm()->stoppedFlag == 0)
|
||||||
startAndReadAll();
|
startAndReadAll();
|
||||||
|
|
||||||
// stop receiver
|
// stop receiver
|
||||||
std::lock_guard<std::mutex> lock(mg);
|
std::lock_guard<std::mutex> lock(mg);
|
||||||
if (receiver) {
|
if (receiver) {
|
||||||
if (stopReceiver() == FAIL) {
|
if (stopReceiver() == FAIL) {
|
||||||
multi_shm()->stoppedFlag = 1;
|
multi_shm()->stoppedFlag = 1;
|
||||||
} else {
|
} else {
|
||||||
if (dataReady != nullptr) {
|
if (dataReady != nullptr) {
|
||||||
sem_wait(&sem_endRTAcquisition); // waits for receiver's
|
sem_wait(&sem_endRTAcquisition); // waits for receiver's
|
||||||
}
|
|
||||||
// external process to be
|
|
||||||
// done sending data to gui
|
|
||||||
}
|
}
|
||||||
|
// external process to be
|
||||||
|
// done sending data to gui
|
||||||
}
|
}
|
||||||
int findex = 0;
|
}
|
||||||
findex = incrementFileIndex();
|
|
||||||
|
|
||||||
if (measurement_finished != nullptr) {
|
incrementFileIndex();
|
||||||
measurement_finished(im, measFinished_p);
|
|
||||||
}
|
|
||||||
if (multi_shm()->stoppedFlag != 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // end measurements loop im
|
|
||||||
|
|
||||||
// waiting for the data processing thread to finish!
|
// waiting for the data processing thread to finish!
|
||||||
setJoinThreadFlag(true);
|
setJoinThreadFlag(true);
|
||||||
|
@ -312,7 +312,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
|||||||
shm()->timerValue[ACTUAL_TIME] = 0;
|
shm()->timerValue[ACTUAL_TIME] = 0;
|
||||||
shm()->timerValue[MEASUREMENT_TIME] = 0;
|
shm()->timerValue[MEASUREMENT_TIME] = 0;
|
||||||
shm()->timerValue[PROGRESS] = 0;
|
shm()->timerValue[PROGRESS] = 0;
|
||||||
shm()->timerValue[MEASUREMENTS_NUMBER] = 1;
|
|
||||||
shm()->timerValue[FRAMES_FROM_START] = 0;
|
shm()->timerValue[FRAMES_FROM_START] = 0;
|
||||||
shm()->timerValue[FRAMES_FROM_START_PG] = 0;
|
shm()->timerValue[FRAMES_FROM_START_PG] = 0;
|
||||||
shm()->timerValue[ANALOG_SAMPLES] = 1;
|
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
|
FILE_LOG(logDEBUG1) << "Setting " << getTimerType(index) << " to " << t
|
||||||
<< " ns/value";
|
<< " 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
|
// send to detector
|
||||||
int64_t oldtimer = shm()->timerValue[index];
|
int64_t oldtimer = shm()->timerValue[index];
|
||||||
if (shm()->onlineFlag == ONLINE_FLAG) {
|
if (shm()->onlineFlag == ONLINE_FLAG) {
|
||||||
|
@ -610,13 +610,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
|
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdTimer;
|
||||||
++i;
|
++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
|
/*! \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)
|
- <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;
|
index = FRAME_NUMBER;
|
||||||
else if (cmd == "cycles")
|
else if (cmd == "cycles")
|
||||||
index = CYCLES_NUMBER;
|
index = CYCLES_NUMBER;
|
||||||
else if (cmd == "measurements")
|
|
||||||
index = MEASUREMENTS_NUMBER;
|
|
||||||
// also does digital sample
|
// also does digital sample
|
||||||
else if (cmd == "samples")
|
else if (cmd == "samples")
|
||||||
index = ANALOG_SAMPLES;
|
index = ANALOG_SAMPLES;
|
||||||
|
@ -406,10 +406,6 @@ void slsDetectorUsers::registerAcquisitionFinishedCallback(void( *func)(double,i
|
|||||||
detector.registerAcquisitionFinishedCallback(func,pArg);
|
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) {
|
void slsDetectorUsers::registerProgressCallback(void( *func)(double,void*), void *pArg) {
|
||||||
detector.registerProgressCallback(func,pArg);
|
detector.registerProgressCallback(func,pArg);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
/** default ports */
|
/** default ports */
|
||||||
#define DEFAULT_PORTNO 1952
|
#define DEFAULT_PORTNO 1952
|
||||||
#define DEFAULT_UDP_PORTNO 50001
|
#define DEFAULT_UDP_PORTNO 50001
|
||||||
#define DEFAULT_GUI_PORTNO 65001
|
|
||||||
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
#define DEFAULT_ZMQ_CL_PORTNO 30001
|
||||||
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
#define DEFAULT_ZMQ_RX_PORTNO 30001
|
||||||
|
|
||||||
@ -115,7 +114,6 @@ class slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
PROGRESS, /**< fraction of measurement elapsed - only get! */
|
PROGRESS, /**< fraction of measurement elapsed - only get! */
|
||||||
MEASUREMENTS_NUMBER,
|
|
||||||
FRAMES_FROM_START,
|
FRAMES_FROM_START,
|
||||||
FRAMES_FROM_START_PG,
|
FRAMES_FROM_START_PG,
|
||||||
ANALOG_SAMPLES,
|
ANALOG_SAMPLES,
|
||||||
@ -927,12 +925,12 @@ format
|
|||||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD,
|
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD,
|
||||||
DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER,
|
DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER,
|
||||||
ACTUAL_TIME,MEASUREMENT_TIME,
|
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
|
SUBFRAME_DEADTIME \returns std::string
|
||||||
frame_number,acquisition_time,frame_period,
|
frame_number,acquisition_time,frame_period,
|
||||||
delay_after_trigger,gates_number, cycles_number,
|
delay_after_trigger,gates_number, cycles_number,
|
||||||
actual_time,measurement_time,
|
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
|
SUBFRAME_DEADTIME
|
||||||
*/
|
*/
|
||||||
static std::string getTimerType(timerIndex t) {
|
static std::string getTimerType(timerIndex t) {
|
||||||
@ -955,8 +953,6 @@ format
|
|||||||
return std::string("measurement_time");
|
return std::string("measurement_time");
|
||||||
case PROGRESS:
|
case PROGRESS:
|
||||||
return std::string("progress");
|
return std::string("progress");
|
||||||
case MEASUREMENTS_NUMBER:
|
|
||||||
return std::string("measurements_number");
|
|
||||||
case FRAMES_FROM_START:
|
case FRAMES_FROM_START:
|
||||||
return std::string("frames_from_start");
|
return std::string("frames_from_start");
|
||||||
case FRAMES_FROM_START_PG:
|
case FRAMES_FROM_START_PG:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user