This commit is contained in:
maliakal_d 2019-07-05 08:54:50 +02:00
parent c582ba15d5
commit 8ac7d96ef3
7 changed files with 42 additions and 60 deletions

View File

@ -4,7 +4,7 @@
* @version 1.0
*/
#include "ansi.h"
#include <iostream>
#include <cmath>
#include "SlsQt2DHist.h"
@ -89,8 +89,8 @@ void SlsQt2DHist::SetData(int nbinsx, double xmin, double xmax, int nbinsy,doubl
}
void SlsQt2DHist::SetMinMax(double zmin,double zmax){
cprintf(GREEN, "zmin:%f zmax:%f\n", zmin, zmax);
if(zmin<zmax){
/* if(zmin<zmax){ edited out to test*/
if(zmax != -1){
z_min=zmin;
z_max=zmax;
}else{

View File

@ -3,7 +3,7 @@
* @author Ian Johnson
* @version 1.0
*/
#include "ansi.h"
#include <cmath>
#include <iostream>
#include <qlist.h>
@ -235,34 +235,19 @@ void SlsQt2DPlot::Update() {
const QwtInterval zInterval = d_spectrogram->data()->interval(Qt::ZAxis);
rightAxis->setColorMap(zInterval, myColourMap(isLog));
#endif
if (!zoomer->zoomRectIndex())
UnZoom();
#if QWT_VERSION < 0x060000
setAxisScale(QwtPlot::yRight, d_spectrogram->data().range().minValue(),
d_spectrogram->data().range().maxValue());
#else
//cprintf(MAGENTA, "zmin:%f zmax:%f\n", zInterval.minValue(), zInterval.maxValue());
setAxisScale(QwtPlot::yRight, zInterval.minValue(), zInterval.maxValue());
#ifdef VERYVERBOSE
std::cout << "axis scale set\n";
#endif
plotLayout()->setAlignCanvasToScales(true);
#ifdef VERYVERBOSE
std::cout << "layout\n";
#endif
#endif
#ifdef VERYVERBOSE
std::cout << "going to replot\n";
#endif
replot();
#ifdef VERYVERBOSE
std::cout << "done\n";
#endif
}
void SlsQt2DPlot::showContour(bool on) {

View File

@ -2,7 +2,7 @@
#include "logger.h"
#include <iostream>
#include "ansi.h"
#include <qtoolbutton.h>
#include <qgroupbox.h>
#include <qgridlayout.h>
@ -84,12 +84,10 @@ void SlsQt2DPlotLayout::UpdateZRange(double min, double max) {
if(isLog) {
the_plot->SetZMinimumToFirstGreaterThanZero();
}
cprintf(BLUE, "zmin:%f zmax:%f\n", zmin, zmax);
// set zmin and zmax
if (isZmin || isZmax) {
zmin = (isZmin ? min : the_plot->GetZMinimum());
zmax = (isZmax ? max : the_plot->GetZMaximum());
cprintf(RED, "zmin:%f zmax:%f\n", zmin, zmax);
// if it is the same values, we should reset it to plots min and max (not doing this now: not foolproof now)
// setting the range of values possible in the dispZMin and dispZMax (not doin this now: not foolproof)
the_plot->SetZMinMax(zmin, zmax);
@ -97,7 +95,6 @@ cprintf(BLUE, "zmin:%f zmax:%f\n", zmin, zmax);
zmin = 0;
zmax = -1;
}
the_plot->Update();
}

View File

@ -2023,7 +2023,7 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetTopLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read tl value. Value read:%d\n", value);
FILE_LOG(logERROR, ("Could not read tl value. Value read:%d\n", value));
value = 0;
}
} else {
@ -2032,7 +2032,7 @@ uint32_t Feb_Control_WriteRegister(uint32_t offset, uint32_t data) {
value = 0;
}
if(!Feb_Interface_WriteRegister(Module_GetBottomLeftAddress (&modules[1]),offset, data,0, 0)) {
cprintf(RED,"Could not read bl value. Value read:%d\n", value);
FILE_LOG(logERROR, ("Could not read bl value. Value read:%d\n", value));
value = 0;
}
}
@ -2050,7 +2050,7 @@ uint32_t Feb_Control_ReadRegister(uint32_t offset) {
}
printf("Read top right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetTopLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
FILE_LOG(logERROR, (RED,"Could not read value. Value read:%d\n", value1));
value1 = 0;
}
printf("Read top left addr: 0x%08x\n", value1);
@ -2063,7 +2063,7 @@ uint32_t Feb_Control_ReadRegister(uint32_t offset) {
}
printf("Read bottom right addr: 0x%08x\n", value);
if(!Feb_Interface_ReadRegister(Module_GetBottomLeftAddress (&modules[1]),offset, &value1)) {
cprintf(RED,"Could not read value. Value read:%d\n", value1);
FILE_LOG(logERROR, (RED,"Could not read value. Value read:%d\n", value1));
value1 = 0;
}
printf("Read bottom left addr: 0x%08x\n", value1);

View File

@ -2203,11 +2203,11 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[],
return helpAcquire(HELP_ACTION);
}
if (!myDet->getNumberOfDetectors()) {
cprintf(RED, "Error: This shared memory has no detectors added. Aborting.\n");
FILE_LOG(logERROR) << "This shared memory has no detectors added. Aborting.";
return std::string("acquire failed");
}
if (detPos >= 0) {
cprintf(RED, "Error: Individual detectors not allowed for readout. Aborting.\n");
FILE_LOG(logERROR) << "Individual detectors not allowed for readout. Aborting.";
return std::string("acquire failed");
}

View File

@ -190,7 +190,7 @@ public:
* @returns true or false for odd starting packet number
*/
virtual bool SetOddStartingPacket(int index, char* packetData) {
cprintf(RED,"SetOddStartingPacket is a generic function that should be overloaded by a derived class\n");
FILE_LOG(logERROR) << "SetOddStartingPacket is a generic function that should be overloaded by a derived class";
return false;
};
@ -204,7 +204,7 @@ public:
* @returns analog data bytes
*/
virtual int setImageSize(uint32_t a, uint64_t as, uint64_t ds, bool t, slsDetectorDefs::readOutFlags f = slsDetectorDefs::GET_READOUT_FLAGS) {
cprintf(RED,"setImageSize is a generic function that should be overloaded by a derived class\n");
FILE_LOG(logERROR) << "setImageSize is a generic function that should be overloaded by a derived class";
return 0;
};
@ -213,7 +213,7 @@ public:
* @param number of interfaces
*/
virtual void SetNumberofInterfaces(const int n) {
cprintf(RED,"SetNumberofInterfaces is a generic function that should be overloaded by a derived class\n");
FILE_LOG(logERROR) << "SetNumberofInterfaces is a generic function that should be overloaded by a derived class";
}
/**

View File

@ -204,17 +204,17 @@ public:
// get host info into res
int errcode = getaddrinfo (hostname, NULL, &hints, res);
if (errcode != 0) {
cprintf (RED,"Error: Could not convert %s hostname to internet address (zmq):"
"%s\n", hostname, gai_strerror(errcode));
FILE_LOG(logERROR) << "Error: Could not convert hostname " << hostname << " to internet address (zmq):"
<< gai_strerror(errcode);
} else {
if (*res == NULL) {
cprintf (RED,"Error: Could not convert %s hostname to internet address (zmq): "
"gettaddrinfo returned null\n", hostname);
FILE_LOG(logERROR) << "Could not convert hostname " << hostname << " to internet address (zmq): "
"gettaddrinfo returned null";
} else{
return 0;
}
}
cprintf(RED, "Error: Could not convert hostname to internet address\n");
FILE_LOG(logERROR) << "Could not convert hostname to internet address";
return 1;
};
@ -232,7 +232,7 @@ public:
freeaddrinfo(res);
return 0;
}
cprintf(RED, "Error: Could not convert internet address to ip string\n");
FILE_LOG(logERROR) << "Could not convert internet address to ip string";
return 1;
}
@ -351,7 +351,7 @@ public:
int length = zmq_msg_recv (&message, sockfd.socketDescriptor, 0);
if (length == -1) {
PrintError ();
cprintf (BG_RED,"Error: Could not read header for socket %d\n",index);
FILE_LOG(logERROR) << "Could not read header for socket " << index;
}
#ifdef VERBOSE
else
@ -419,7 +419,7 @@ public:
Document& document, bool& dummy, uint32_t version)
{
if ( document.Parse( buff, length).HasParseError() ) {
cprintf( RED,"%d Could not parse. len:%d: Message:%s \n", index, length, buff );
FILE_LOG(logERROR) << index << " Could not parse. len:" << length << ": Message:" << buff;
fflush ( stdout );
// char* buf = (char*) zmq_msg_data (&message);
for ( int i= 0; i < length; ++i ) {
@ -431,7 +431,7 @@ public:
}
if (document["jsonversion"].GetUint() != version) {
cprintf( RED, "version mismatch. required %u, got %u\n", version, document["jsonversion"].GetUint());
FILE_LOG(logERROR) << "version mismatch. required " << version << ", got " << document["jsonversion"].GetUint();
return 0;
}
@ -474,7 +474,7 @@ public:
}
//incorrect size (larger)
else {
cprintf(RED,"Error: Received weird packet size %d for socket %d\n", length, index);
FILE_LOG(logERROR) << "Received weird packet size " << length << " for socket " << index;
memset(buf,0xFF,size);
}
@ -490,52 +490,52 @@ public:
void PrintError () {
switch (errno) {
case EINVAL:
cprintf(RED, "Error: The socket type/option or value/endpoint supplied is invalid (zmq)\n");
FILE_LOG(logERROR) << "The socket type/option or value/endpoint supplied is invalid (zmq)";
break;
case EAGAIN:
cprintf(RED, "Error: Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)\n");
FILE_LOG(logERROR) << "Non-blocking mode was requested and the message cannot be sent/available at the moment (zmq)";
break;
case ENOTSUP:
cprintf(RED, "Error: The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)\n");
FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() operation is not supported by this socket type (zmq)";
break;
case EFSM:
cprintf(RED, "Error: The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)\n");
FILE_LOG(logERROR) << "The zmq_send()/zmq_msg_recv() unavailable now as socket in inappropriate state (eg. ZMQ_REP). Look up messaging patterns (zmq)";
break;
case EFAULT:
cprintf(RED, "Error: The provided context/message is invalid (zmq)\n");
FILE_LOG(logERROR) << "The provided context/message is invalid (zmq)";
break;
case EMFILE:
cprintf(RED, "Error: The limit on the total number of open ØMQ sockets has been reached (zmq)\n");
FILE_LOG(logERROR) << "The limit on the total number of open ØMQ sockets has been reached (zmq)";
break;
case EPROTONOSUPPORT:
cprintf(RED, "Error: The requested transport protocol is not supported (zmq)\n");
FILE_LOG(logERROR) << "The requested transport protocol is not supported (zmq)";
break;
case ENOCOMPATPROTO:
cprintf(RED, "Error: The requested transport protocol is not compatible with the socket type (zmq)\n");
FILE_LOG(logERROR) << "The requested transport protocol is not compatible with the socket type (zmq)";
break;
case EADDRINUSE:
cprintf(RED, "Error: The requested address is already in use (zmq)\n");
FILE_LOG(logERROR) << "The requested address is already in use (zmq)";
break;
case EADDRNOTAVAIL:
cprintf(RED, "Error: The requested address was not local (zmq)\n");
FILE_LOG(logERROR) << "The requested address was not local (zmq)";
break;
case ENODEV:
cprintf(RED, "Error: The requested address specifies a nonexistent interface (zmq)\n");
FILE_LOG(logERROR) << "The requested address specifies a nonexistent interface (zmq)";
break;
case ETERM:
cprintf(RED, "Error: The ØMQ context associated with the specified socket was terminated (zmq)\n");
FILE_LOG(logERROR) << "The ØMQ context associated with the specified socket was terminated (zmq)";
break;
case ENOTSOCK:
cprintf(RED, "Error: The provided socket was invalid (zmq)\n");
FILE_LOG(logERROR) << "The provided socket was invalid (zmq)";
break;
case EINTR:
cprintf(RED, "Error: The operation was interrupted by delivery of a signal (zmq)\n");
FILE_LOG(logERROR) << "The operation was interrupted by delivery of a signal (zmq)";
break;
case EMTHREAD:
cprintf(RED, "Error: No I/O thread is available to accomplish the task (zmq)\n");
FILE_LOG(logERROR) << "No I/O thread is available to accomplish the task (zmq)";
break;
default:
cprintf(RED, "Error: Unknown socket error (zmq)\n");
FILE_LOG(logERROR) << "Unknown socket error (zmq)";
break;
}
};