mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-06 01:50:40 +02:00
some updates to the moench data processing
This commit is contained in:
parent
25b5b02302
commit
9ecafbf8d5
@ -1 +1 @@
|
|||||||
Subproject commit 914c06fb252b6cc3727d0eedab6736e88a3fcb01
|
Subproject commit 8de7772cc72daca8e947b79b83fea46214931604
|
@ -21,9 +21,9 @@ class commonModeSubtractionColumn : public commonModeSubtraction {
|
|||||||
nCm[iroi]++;
|
nCm[iroi]++;
|
||||||
if (nCm[iroi] > rows)
|
if (nCm[iroi] > rows)
|
||||||
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
|
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
|
||||||
/* if (ix==10 && iy<20) */
|
/* if (ix==10 && iy==20) */
|
||||||
/* cout << " ** "<<val << " " << mean[iroi] << " " <<
|
/* std::cout << " ** "<<val << " " << mean[iroi] << " " << */
|
||||||
* nCm[iroi] << " " << getCommonMode(ix, iy) << endl; */
|
/* nCm[iroi] << " " << getCommonMode(ix, iy) << std::endl; */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -36,6 +36,40 @@ class commonModeSubtractionColumn : public commonModeSubtraction {
|
|||||||
int rows;
|
int rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class commonModeSubtractionRow : public commonModeSubtraction {
|
||||||
|
public:
|
||||||
|
commonModeSubtractionRow(int nc = 400)
|
||||||
|
: commonModeSubtraction(200), cols(nc){};
|
||||||
|
virtual int getROI(int ix, int iy) {
|
||||||
|
if (iy/200<1) return 199-iy%200;
|
||||||
|
else return iy%200;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void addToCommonMode(double val, int ix = 0, int iy = 0) {
|
||||||
|
if (ix < cols || ix > 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 << " ** "<<val << " " << mean[iroi] << " " << */
|
||||||
|
/* nCm[iroi] << " " << getCommonMode(ix, iy) << std::endl; */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
virtual commonModeSubtractionRow *Clone() {
|
||||||
|
return new commonModeSubtractionRow(this->cols);
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
int cols;
|
||||||
|
};
|
||||||
|
|
||||||
class commonModeSubtractionSuperColumn : public commonModeSubtraction {
|
class commonModeSubtractionSuperColumn : public commonModeSubtraction {
|
||||||
public:
|
public:
|
||||||
commonModeSubtractionSuperColumn() : commonModeSubtraction(32){};
|
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
|
/** @short class to calculate the common mode noise for moench02 i.e. on 4
|
||||||
* supercolumns separately */
|
* supercolumns separately */
|
||||||
public:
|
public:
|
||||||
/** constructor - initalizes a commonModeSubtraction with 4 different
|
/** constructor - initalizes a commonModeSubtraction with 4 different
|
||||||
regions of interest \param nn number of samples for the moving average
|
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
|
#endif
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||||
//#include "sls/ansi.h"
|
//#include "sls/ansi.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
//#define CORR
|
||||||
#undef CORR
|
#undef CORR
|
||||||
|
|
||||||
#define C_GHOST 0.0004
|
#define C_GHOST 0 //0.0004
|
||||||
|
|
||||||
#define CM_ROWS 50
|
#define CM_ROWS 20
|
||||||
|
|
||||||
#define RAWDATA
|
#define RAWDATA
|
||||||
|
|
||||||
@ -164,8 +165,8 @@ int main(int argc, char *argv[]) {
|
|||||||
cout << "Applying common mode " << ncol_cm << endl;
|
cout << "Applying common mode " << ncol_cm << endl;
|
||||||
cm = new moench03CommonMode(ncol_cm);
|
cm = new moench03CommonMode(ncol_cm);
|
||||||
|
|
||||||
cout << "Applying ghost corrections " << xt_ghost << endl;
|
// cout << "Applying ghost corrections " << xt_ghost << endl;
|
||||||
gs = new moench03GhostSummation(decoder, xt_ghost);
|
// gs = new moench03GhostSummation(decoder, xt_ghost);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
singlePhotonDetector *filter = new singlePhotonDetector(
|
singlePhotonDetector *filter = new singlePhotonDetector(
|
||||||
@ -222,15 +223,20 @@ int main(int argc, char *argv[]) {
|
|||||||
// cout << "mt " << endl;
|
// cout << "mt " << endl;
|
||||||
|
|
||||||
int ifr = 0;
|
int ifr = 0;
|
||||||
|
char froot[1000];
|
||||||
double *ped=new double[nx * ny];//, *ped1;
|
double *ped=new double[nx * ny];//, *ped1;
|
||||||
|
int pos,pos1;
|
||||||
|
|
||||||
if (pedfile) {
|
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;
|
cout << "PEDESTAL " << endl;
|
||||||
sprintf(imgfname, "%s/pedestals.tiff", outdir);
|
if (string(pedfile).find(".tif") == std::string::npos) {
|
||||||
|
|
||||||
if (string(pedfile).find(".tif") == std::string::npos) {
|
|
||||||
sprintf(fname, "%s", pedfile);
|
sprintf(fname, "%s", pedfile);
|
||||||
cout << fname << endl;
|
cout << fname << endl;
|
||||||
std::time(&end_time);
|
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
|
} else
|
||||||
cout << "Could not open pedestal file " << fname
|
cout << "Could not open pedestal file " << fname
|
||||||
<< " for reading " << endl;
|
<< " for reading " << endl;
|
||||||
@ -276,7 +286,6 @@ int main(int argc, char *argv[]) {
|
|||||||
<< " for reading " << endl;
|
<< " for reading " << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mt->writePedestal(imgfname);
|
|
||||||
std::time(&end_time);
|
std::time(&end_time);
|
||||||
cout << std::ctime(&end_time) << endl;
|
cout << std::ctime(&end_time) << endl;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ int main(int argc, char *argv[]) {
|
|||||||
char *socketip2 = 0;
|
char *socketip2 = 0;
|
||||||
uint32_t portnum2 = 0;
|
uint32_t portnum2 = 0;
|
||||||
|
|
||||||
zmqHeader zHeader, outHeader;
|
sls::zmqHeader zHeader, outHeader;
|
||||||
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
|
zHeader.jsonversion = SLS_DETECTOR_JSON_HEADER_VERSION;
|
||||||
outHeader.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->StartThreads();
|
||||||
mt->popFree(buff);
|
mt->popFree(buff);
|
||||||
|
|
||||||
ZmqSocket *zmqsocket = NULL;
|
sls::ZmqSocket *zmqsocket = NULL;
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
#ifdef NEWZMQ
|
||||||
// receive socket
|
// receive socket
|
||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
zmqsocket = new ZmqSocket(socketip, portnum);
|
zmqsocket = new sls::ZmqSocket(socketip, portnum);
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
#ifdef NEWZMQ
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@ -256,14 +256,14 @@ int main(int argc, char *argv[]) {
|
|||||||
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
|
printf("Zmq Client at %s\n", zmqsocket->GetZmqServerAddress().c_str());
|
||||||
|
|
||||||
// send socket
|
// send socket
|
||||||
ZmqSocket *zmqsocket2 = 0;
|
sls::ZmqSocket *zmqsocket2 = 0;
|
||||||
// cout << "zmq2 " << endl;
|
// cout << "zmq2 " << endl;
|
||||||
if (send) {
|
if (send) {
|
||||||
#ifdef NEWZMQ
|
#ifdef NEWZMQ
|
||||||
// receive socket
|
// receive socket
|
||||||
try {
|
try {
|
||||||
#endif
|
#endif
|
||||||
zmqsocket2 = new ZmqSocket(portnum2, socketip2);
|
zmqsocket2 = new sls::ZmqSocket(portnum2, socketip2);
|
||||||
|
|
||||||
#ifdef NEWZMQ
|
#ifdef NEWZMQ
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
|
@ -229,7 +229,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
|||||||
double *rest = new double[ny * nx];
|
double *rest = new double[ny * nx];
|
||||||
newFrame(data);
|
newFrame(data);
|
||||||
if (cmSub) {
|
if (cmSub) {
|
||||||
cout << "add to common mode?" << endl;
|
//cout << "add to common mode?" << endl;
|
||||||
addToCommonMode(data);
|
addToCommonMode(data);
|
||||||
}
|
}
|
||||||
for (iy = ymin; iy < ymax; ++iy) {
|
for (iy = ymin; iy < ymax; ++iy) {
|
||||||
@ -386,7 +386,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
|||||||
// double quadTot;
|
// double quadTot;
|
||||||
// quadrant quad;
|
// quadrant quad;
|
||||||
double rms;
|
double rms;
|
||||||
// if (cmSub) cm=1;
|
|
||||||
if (ph == NULL)
|
if (ph == NULL)
|
||||||
ph = image;
|
ph = image;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user