mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-04 00:50:42 +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]++;
|
||||
if (nCm[iroi] > rows)
|
||||
std::cout << "Too many pixels added " << nCm[iroi] << std::endl;
|
||||
/* if (ix==10 && iy<20) */
|
||||
/* cout << " ** "<<val << " " << mean[iroi] << " " <<
|
||||
* nCm[iroi] << " " << getCommonMode(ix, iy) << endl; */
|
||||
/* if (ix==10 && iy==20) */
|
||||
/* std::cout << " ** "<<val << " " << mean[iroi] << " " << */
|
||||
/* nCm[iroi] << " " << getCommonMode(ix, iy) << std::endl; */
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -36,6 +36,40 @@ class commonModeSubtractionColumn : public commonModeSubtraction {
|
||||
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 {
|
||||
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
|
||||
|
@ -2,11 +2,12 @@
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
//#include "sls/ansi.h"
|
||||
#include <iostream>
|
||||
//#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;
|
||||
}
|
||||
|
@ -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 (...) {
|
||||
|
@ -229,7 +229,7 @@ class singlePhotonDetector : public analogDetector<uint16_t> {
|
||||
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<uint16_t> {
|
||||
// double quadTot;
|
||||
// quadrant quad;
|
||||
double rms;
|
||||
// if (cmSub) cm=1;
|
||||
|
||||
if (ph == NULL)
|
||||
ph = image;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user