mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-09 14:20:03 +02:00
gainplot added, masking done separately before converting to double
This commit is contained in:
parent
91fece87b2
commit
272167435d
@ -279,6 +279,7 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
||||
threadpool = 0;
|
||||
if(createThreadPool() == FAIL)
|
||||
exit(-1);
|
||||
gainDataEnable = false;
|
||||
|
||||
}
|
||||
|
||||
@ -5436,7 +5437,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
|
||||
|
||||
|
||||
|
||||
int multiSlsDetector::getData(const int isocket, const bool masking, int* image, const int size,
|
||||
int multiSlsDetector::getData(const int isocket, int* image, const int size,
|
||||
uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename) {
|
||||
|
||||
//fail is on parse error or end of acquisition
|
||||
@ -5446,14 +5447,6 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
|
||||
//receiving incorrect size is replaced by 0xFF
|
||||
zmqSocket[isocket]->ReceiveData(isocket, image, size);
|
||||
|
||||
//jungfrau masking adcval
|
||||
if(masking){
|
||||
unsigned int snel = size/sizeof(int);
|
||||
for(unsigned int i=0;i<snel;++i){
|
||||
image[i] = (image[i] & 0x3FFF3FFF);
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -5468,6 +5461,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
int numSockets = thisMultiDetector->numberOfDetectors;
|
||||
int numSocketsPerSLSDetector = 1;
|
||||
bool jungfrau = false;
|
||||
double* gdata = NULL;
|
||||
switch(getDetectorsType()){
|
||||
case EIGER:
|
||||
numSocketsPerSLSDetector = 2;
|
||||
@ -5526,6 +5520,9 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
return;
|
||||
}
|
||||
int* multiframe=new int[nel]();
|
||||
int* multiframegain=NULL;
|
||||
if (jungfrau)
|
||||
multiframegain = new int[nel]();
|
||||
int nch;
|
||||
|
||||
bool runningList[numSockets];
|
||||
@ -5552,7 +5549,7 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
//if running
|
||||
if (runningList[isocket]) {
|
||||
//get individual images
|
||||
if(FAIL == getData(isocket, jungfrau, image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
||||
if(FAIL == getData(isocket, image, expectedslssize, currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex,currentFileName)){
|
||||
runningList[isocket] = false;
|
||||
numRunning--;
|
||||
continue;
|
||||
@ -5606,12 +5603,29 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
|
||||
//send data to callback
|
||||
if(running){
|
||||
if (jungfrau) {
|
||||
// with gain data
|
||||
if (gainDataEnable) {
|
||||
memcpy(multiframegain, multiframe, nel * sizeof(int));
|
||||
for(unsigned int i=0;i<nel;++i){
|
||||
multiframegain[i] = ((multiframe[i] & 0xC0000000) >> 14) | ((multiframe[i] & 0x0000C000) >> 14) ;
|
||||
multiframe[i] = (multiframe[i] & 0x3FFF3FFF);
|
||||
}
|
||||
gdata = decodeData(multiframegain,nch);
|
||||
}
|
||||
// without gain data
|
||||
else {
|
||||
for(unsigned int i=0;i<nel;++i)
|
||||
multiframe[i] = (multiframe[i] & 0x3FFF3FFF);
|
||||
}
|
||||
}
|
||||
fdata = decodeData(multiframe,nch);
|
||||
if ((fdata) && (dataReady)){
|
||||
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentFileName.c_str(),nx,ny);
|
||||
thisData = new detectorData(fdata, NULL,NULL,getCurrentProgress(),currentFileName.c_str(),nx,ny, gdata);
|
||||
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
|
||||
delete thisData;
|
||||
fdata = NULL;
|
||||
gdata = NULL;
|
||||
//cout<<"Send frame #"<< currentFrameIndex << " to gui"<<endl;
|
||||
}
|
||||
setCurrentProgress(currentAcquisitionIndex+1);
|
||||
@ -5624,6 +5638,8 @@ void multiSlsDetector::readFrameFromReceiver(){
|
||||
//free resources
|
||||
delete [] image;
|
||||
delete[] multiframe;
|
||||
if (jungfrau)
|
||||
delete [] multiframegain;
|
||||
}
|
||||
|
||||
|
||||
@ -6256,3 +6272,8 @@ void multiSlsDetector::setExternalGuiFlag(bool b){
|
||||
bool multiSlsDetector::getExternalGuiFlag(){
|
||||
return thisMultiDetector->externalgui;
|
||||
}
|
||||
|
||||
|
||||
void multiSlsDetector::setGainDataEnableinDataCallback(bool e) {
|
||||
gainDataEnable = e;
|
||||
}
|
||||
|
@ -1457,6 +1457,13 @@ class multiSlsDetector : public slsDetectorUtils {
|
||||
*/
|
||||
bool getExternalGuiFlag();
|
||||
|
||||
/**
|
||||
* Set Gain Data enable for gain plot
|
||||
* in data call back
|
||||
* @param e enable
|
||||
*/
|
||||
void setGainDataEnableinDataCallback(bool e);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
@ -1464,7 +1471,6 @@ private:
|
||||
/**
|
||||
* Gets data from socket
|
||||
* @param isocket socket index
|
||||
* @param masking if masking required (jungfrau)
|
||||
* @param image image buffer
|
||||
* @param size size of image
|
||||
* @param acqIndex address of acquisition index
|
||||
@ -1472,7 +1478,7 @@ private:
|
||||
* @param subframeIndex address of subframe index
|
||||
* @param filename address of file name
|
||||
*/
|
||||
int getData(const int isocket, const bool masking, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename);
|
||||
int getData(const int isocket, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename);
|
||||
|
||||
|
||||
/** Ensures if sockets created successfully */
|
||||
@ -1496,6 +1502,9 @@ private:
|
||||
private:
|
||||
ThreadPool* threadpool;
|
||||
|
||||
/** Gain Data enabled in data call back */
|
||||
bool gainDataEnable;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@ -16,15 +16,16 @@ class detectorData {
|
||||
\param fname file name to which the data are saved
|
||||
\param np number of points in x coordinate defaults to the number of detector channels (1D detector)
|
||||
\param ny dimension in y (1D detector)
|
||||
\param gval pointer to gain data (for jungfrau)
|
||||
*/
|
||||
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny){
|
||||
detectorData(double *val=NULL, double *err=NULL, double *ang=NULL, double p_ind=-1, const char *fname="", int np=-1, int ny=1, double* gval=NULL) : values(val), errors(err), angles(ang), progressIndex(p_ind), npoints(np), npy(ny), gvalues(gval){
|
||||
strcpy(fileName,fname);
|
||||
};
|
||||
/**
|
||||
@short The destructor
|
||||
deletes also the arrays pointing to data/errors/angles if not NULL
|
||||
*/
|
||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles;};
|
||||
~detectorData() {if (values) delete [] values; if (errors) delete [] errors; if (angles) delete [] angles; if (gvalues) delete [] gvalues;};
|
||||
//private:
|
||||
double *values; /**< @short pointer to the data */
|
||||
double *errors; /**< @short pointer to the errors */
|
||||
@ -33,6 +34,7 @@ class detectorData {
|
||||
char fileName[1000];/**< @short file name */
|
||||
int npoints;/**< @short number of points */
|
||||
int npy;/**< @short dimensions in y coordinate*/
|
||||
double *gvalues; /**< @short pointer to the gain data */
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user