diff --git a/libs/pybind11 b/libs/pybind11 index 914c06fb2..8de7772cc 160000 --- a/libs/pybind11 +++ b/libs/pybind11 @@ -1 +1 @@ -Subproject commit 914c06fb252b6cc3727d0eedab6736e88a3fcb01 +Subproject commit 8de7772cc72daca8e947b79b83fea46214931604 diff --git a/slsDetectorCalibration/moench03CommonMode.h b/slsDetectorCalibration/moench03CommonMode.h index e2e3bb7ff..188a4c40c 100644 --- a/slsDetectorCalibration/moench03CommonMode.h +++ b/slsDetectorCalibration/moench03CommonMode.h @@ -21,9 +21,9 @@ class commonModeSubtractionColumn : public commonModeSubtraction { nCm[iroi]++; if (nCm[iroi] > rows) std::cout << "Too many pixels added " << nCm[iroi] << std::endl; - /* if (ix==10 && iy<20) */ - /* cout << " ** "< 399 - cols) { + int iroi = getROI(ix, iy); + // cout << iy << " " << ix << " " << iroi ; + if (iroi >= 0 && iroi < nROI) { + mean[iroi] += val; + mean2[iroi] += val * val; + nCm[iroi]++; + if (nCm[iroi] > 4*cols) + std::cout << "Too many pixels added " << nCm[iroi] << std::endl; + /* if (ix==10 && iy==20) */ + /* std::cout << " ** "<cols); + }; + + private: + int cols; +}; + class commonModeSubtractionSuperColumn : public commonModeSubtraction { public: commonModeSubtractionSuperColumn() : commonModeSubtraction(32){}; @@ -51,14 +85,15 @@ class commonModeSubtractionHalf : public commonModeSubtraction { }; }; -class moench03CommonMode : public commonModeSubtractionColumn { +class moench03CommonMode : public commonModeSubtractionRow { /** @short class to calculate the common mode noise for moench02 i.e. on 4 * supercolumns separately */ public: /** constructor - initalizes a commonModeSubtraction with 4 different regions of interest \param nn number of samples for the moving average */ - moench03CommonMode(int nr = 20) : commonModeSubtractionColumn(nr){}; + //moench03CommonMode(int nr = 20) : commonModeSubtractionColumn(nr){}; + moench03CommonMode(int nr = 20) : commonModeSubtractionRow(nr){}; }; #endif diff --git a/slsDetectorCalibration/moenchExecutables/moenchRawDataProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchRawDataProcess.cpp index 9968eb77e..5c29fd622 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchRawDataProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchRawDataProcess.cpp @@ -2,11 +2,12 @@ // Copyright (C) 2021 Contributors to the SLS Detector Package //#include "sls/ansi.h" #include +//#define CORR #undef CORR -#define C_GHOST 0.0004 +#define C_GHOST 0 //0.0004 -#define CM_ROWS 50 +#define CM_ROWS 20 #define RAWDATA @@ -164,8 +165,8 @@ int main(int argc, char *argv[]) { cout << "Applying common mode " << ncol_cm << endl; cm = new moench03CommonMode(ncol_cm); - cout << "Applying ghost corrections " << xt_ghost << endl; - gs = new moench03GhostSummation(decoder, xt_ghost); + // cout << "Applying ghost corrections " << xt_ghost << endl; + // gs = new moench03GhostSummation(decoder, xt_ghost); #endif singlePhotonDetector *filter = new singlePhotonDetector( @@ -222,15 +223,20 @@ int main(int argc, char *argv[]) { // cout << "mt " << endl; int ifr = 0; - + char froot[1000]; double *ped=new double[nx * ny];//, *ped1; - + int pos,pos1; + if (pedfile) { + if (string(pedfile).find(".raw") != std::string::npos) { + pos1=string(pedfile).rfind("/"); + strcpy(froot,pedfile+pos1); + pos=string(froot).find(".raw"); + froot[pos]='\0'; + } - cout << "PEDESTAL " << endl; - sprintf(imgfname, "%s/pedestals.tiff", outdir); - - if (string(pedfile).find(".tif") == std::string::npos) { + cout << "PEDESTAL " << endl; + if (string(pedfile).find(".tif") == std::string::npos) { sprintf(fname, "%s", pedfile); cout << fname << endl; std::time(&end_time); @@ -259,6 +265,10 @@ int main(int argc, char *argv[]) { ; } + sprintf(imgfname, "%s/%s_ped.tiff", outdir,froot); + mt->writePedestal(imgfname); + sprintf(imgfname, "%s/%s_var.tiff", outdir,froot); + mt->writePedestalRMS(imgfname); } else cout << "Could not open pedestal file " << fname << " for reading " << endl; @@ -276,7 +286,6 @@ int main(int argc, char *argv[]) { << " for reading " << endl; } } - mt->writePedestal(imgfname); std::time(&end_time); cout << std::ctime(&end_time) << endl; } diff --git a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp index 1617057fe..7c68bb1d0 100644 --- a/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp +++ b/slsDetectorCalibration/moenchExecutables/moenchZmqProcess.cpp @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) { char *socketip2 = 0; uint32_t portnum2 = 0; - zmqHeader zHeader, outHeader; + sls::zmqHeader zHeader, outHeader; zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION; outHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION; @@ -219,14 +219,14 @@ int main(int argc, char *argv[]) { mt->StartThreads(); mt->popFree(buff); - ZmqSocket *zmqsocket = NULL; + sls::ZmqSocket *zmqsocket = NULL; #ifdef NEWZMQ // receive socket try { #endif - zmqsocket = new ZmqSocket(socketip, portnum); + zmqsocket = new sls::ZmqSocket(socketip, portnum); #ifdef NEWZMQ } catch (...) { @@ -256,14 +256,14 @@ int main(int argc, char *argv[]) { printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str()); // send socket - ZmqSocket *zmqsocket2 = 0; + sls::ZmqSocket *zmqsocket2 = 0; // cout << "zmq2 " << endl; if (send) { #ifdef NEWZMQ // receive socket try { #endif - zmqsocket2 = new ZmqSocket(portnum2, socketip2); + zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2); #ifdef NEWZMQ } catch (...) { diff --git a/slsDetectorCalibration/singlePhotonDetector.h b/slsDetectorCalibration/singlePhotonDetector.h index 96d239c97..79a3cf44d 100644 --- a/slsDetectorCalibration/singlePhotonDetector.h +++ b/slsDetectorCalibration/singlePhotonDetector.h @@ -229,7 +229,7 @@ class singlePhotonDetector : public analogDetector { double *rest = new double[ny * nx]; newFrame(data); if (cmSub) { - cout << "add to common mode?" << endl; + //cout << "add to common mode?" << endl; addToCommonMode(data); } for (iy = ymin; iy < ymax; ++iy) { @@ -386,7 +386,7 @@ class singlePhotonDetector : public analogDetector { // double quadTot; // quadrant quad; double rms; - // if (cmSub) cm=1; + if (ph == NULL) ph = image;