mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
enableWriteToFile added
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@204 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
c04ed80b83
commit
aa480795c6
@ -1,5 +1,5 @@
|
||||
CFLAGS= -DC_ONLY
|
||||
FLAGS= -DVERBOSE -DVERYVERBOSE
|
||||
#FLAGS= -DVERBOSE -DVERYVERBOSE
|
||||
INCLUDES= -IcommonFiles -IslsDetector -IMySocketTCP -IusersFunctions -ImultiSlsDetector -IslsDetectorUtils -IslsDetectorCommand -IslsDetectorAnalysis
|
||||
|
||||
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom
|
||||
|
@ -103,7 +103,7 @@ typedef struct {
|
||||
int reg; /**< is the module register (e.g. dynamic range?)
|
||||
\see moduleRegisterBit */
|
||||
float *dacs; /**< is the pointer to the array of the dac values (in V) */
|
||||
float *adcs; /**< is the pointer to the array of the adc values (in V) */
|
||||
float *adcs; /**< is the pointer to the array of the adc values (in V) FLAT_FIELD_CORRECTION*/
|
||||
int *chipregs; /**< is the pointer to the array of the chip registers
|
||||
\see ::chipRegisterBit */
|
||||
int *chanregs; /**< is the pointer to the array of the channel registers
|
||||
@ -426,6 +426,7 @@ enum correctionFlags {
|
||||
FLAT_FIELD_CORRECTION, /**< data are flat field corrected */
|
||||
RATE_CORRECTION, /**< data are rate corrected */
|
||||
ANGULAR_CONVERSION,/**< angular conversion is calculated */
|
||||
WRITE_FILE,
|
||||
I0_NORMALIZATION
|
||||
};
|
||||
/** port type */
|
||||
|
@ -3977,7 +3977,9 @@ float* slsDetector::decodeData(int *datain, float *fdata) {
|
||||
}
|
||||
*/
|
||||
|
||||
int slsDetector::setFlatFieldCorrection(string fname){
|
||||
int slsDetector::setFlatFieldCorrection(string fname)
|
||||
|
||||
{
|
||||
float data[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
|
||||
//float err[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
|
||||
float xmed[thisDetector->nModMax[X]*thisDetector->nModMax[Y]*thisDetector->nChans*thisDetector->nChips];
|
||||
|
@ -64,7 +64,7 @@ using namespace std;
|
||||
*/
|
||||
|
||||
//public virtual slsDetectorUsers,
|
||||
class slsDetectorBase : public virtual slsDetectorDefs, public slsDetectorUsers {
|
||||
class slsDetectorBase : public virtual slsDetectorUsers , public virtual slsDetectorDefs {
|
||||
|
||||
public:
|
||||
|
||||
|
@ -183,6 +183,11 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdOnline;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="enablefwrite"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdEnablefwrite;
|
||||
i++;
|
||||
|
||||
|
||||
/* Acquisition actions */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="positions"; //
|
||||
@ -530,6 +535,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdTimer;
|
||||
i++;
|
||||
|
||||
|
||||
/* read only timers */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="exptimel"; //
|
||||
@ -1295,6 +1301,32 @@ string slsDetectorCommand::helpFileName(int narg, char *args[], int action){
|
||||
}
|
||||
|
||||
|
||||
//enable file write
|
||||
string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int action){
|
||||
|
||||
int i;
|
||||
char ans[100];
|
||||
if (action==HELP_ACTION) {
|
||||
return helpFileName(narg, args, action);
|
||||
}
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%d",&i))
|
||||
myDet->enableWriteToFile(i);
|
||||
;
|
||||
}
|
||||
return string(myDet->getFileName());
|
||||
}
|
||||
|
||||
|
||||
|
||||
string slsDetectorCommand::helpEnablefwrite(int narg, char *args[], int action){
|
||||
ostringstream os;
|
||||
if (action==GET_ACTION || action==HELP_ACTION)
|
||||
os << string("When Enabled writes the data into the file\n");
|
||||
if (action==PUT_ACTION || action==HELP_ACTION)
|
||||
os << string(" i \t should be 1 or 0 or -1\n");
|
||||
return os.str();
|
||||
}
|
||||
|
||||
string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action){
|
||||
|
||||
|
@ -81,7 +81,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
static string helpImage(int narg, char *args[], int action);
|
||||
static string helpCounter(int narg, char *args[], int action);
|
||||
static string helpADC(int narg, char *args[], int action);
|
||||
|
||||
static string helpEnablefwrite(int narg, char *args[], int action);
|
||||
|
||||
|
||||
|
||||
@ -151,7 +151,8 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
||||
string cmdImage(int narg, char *args[], int action);
|
||||
string cmdCounter(int narg, char *args[], int action);
|
||||
string cmdADC(int narg, char *args[], int action);
|
||||
|
||||
//string helpADC(int narg, char *args[], int action);
|
||||
string cmdEnablefwrite(int narg, char *args[], int action);
|
||||
|
||||
|
||||
|
||||
|
@ -143,6 +143,7 @@ class slsDetectorUsers
|
||||
virtual int setFlatFieldCorrectionFile(string fname="")=0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@short enable/disable flat field corrections (without changing file name)
|
||||
\param i 0 disables, 1 enables, -1 gets
|
||||
@ -171,6 +172,10 @@ class slsDetectorUsers
|
||||
*/
|
||||
virtual int enableAngularConversion(int i=-1)=0;
|
||||
|
||||
/**Enable write file function included*/
|
||||
|
||||
virtual int enableWriteToFile(int i=-1)=0;
|
||||
|
||||
/**
|
||||
@short set positions for the acquisition
|
||||
\param nPos number of positions
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "usersFunctions.h"
|
||||
|
||||
|
||||
|
||||
postProcessing::postProcessing(){
|
||||
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
|
||||
mp=mp1;
|
||||
@ -33,7 +34,7 @@ int postProcessing::flatFieldCorrect(float datain, float errin, float &dataout,
|
||||
if (dataout>0)
|
||||
errout=sqrt(e*ffcoefficient*e*ffcoefficient+datain*fferr*datain*fferr);
|
||||
else
|
||||
errout=1.;
|
||||
errout=1.0;
|
||||
|
||||
return 0;
|
||||
};
|
||||
@ -147,12 +148,19 @@ void postProcessing::processFrame(int *myData, int delflag) {
|
||||
|
||||
fdata=decodeData(myData, fdata);
|
||||
|
||||
|
||||
fname=createFileName();
|
||||
|
||||
//Checking for write flag
|
||||
if(*correctionMask&(1<<WRITE_FILE))
|
||||
{
|
||||
|
||||
|
||||
//uses static function?!?!?!?
|
||||
writeDataFile (fname+string(".raw"),fdata, NULL, NULL, 'i');
|
||||
|
||||
}
|
||||
|
||||
doProcessing(fdata,delflag, fname);
|
||||
|
||||
delete [] myData;
|
||||
|
@ -31,11 +31,11 @@ using namespace std;
|
||||
|
||||
(including thread for writing data files and plotting in parallel with the acquisition)
|
||||
*/
|
||||
class postProcessing : public angularConversion, public fileIO
|
||||
//: public virtual angularConversion, public virtual fileIO
|
||||
{
|
||||
|
||||
class postProcessing : public virtual angularConversion, public virtual fileIO {
|
||||
|
||||
|
||||
//: public angularConversion, public fileIO
|
||||
|
||||
public:
|
||||
postProcessing();
|
||||
@ -120,16 +120,17 @@ class postProcessing : public angularConversion, public fileIO
|
||||
static int rateCorrect(float datain, float errin, float &dataout, float &errout, float tau, float t);
|
||||
|
||||
|
||||
int enableWriteToFile(int i=-1) {if (i>0) ((*correctionMask)|=(1<<WRITE_FILE)); if(i==0) ((*correctionMask)&=~(1<< WRITE_FILE)); return ((*correctionMask)&(1<< WRITE_FILE));};
|
||||
|
||||
|
||||
int setAngularCorrectionMask(int i=-1){if (i==0) (*correctionMask)&=~(1<< ANGULAR_CONVERSION); if (i>0) (*correctionMask)|=(1<< ANGULAR_CONVERSION); return ((*correctionMask)&(1<< ANGULAR_CONVERSION));};
|
||||
|
||||
|
||||
|
||||
int enableAngularConversion(int i=-1) {if (i>0) return setAngularConversionFile("default"); if (i==0) return setAngularConversionFile(""); return setAngularCorrectionMask();}
|
||||
int enableAngularConversion(int i=-1) {if (i>0) return setAngularConversionFile("default"); if (i==0) return setAngularConversionFile(""); return setAngularCorrectionMask();};
|
||||
|
||||
|
||||
int enableBadChannelCorrection(int i=-1) {if (i>0) return setBadChannelCorrection("default"); if (i==0) return setBadChannelCorrection(""); return ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS));}
|
||||
int enableBadChannelCorrection(int i=-1) {if (i>0) return setBadChannelCorrection("default"); if (i==0) return setBadChannelCorrection(""); return ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS));};
|
||||
|
||||
|
||||
|
||||
@ -138,10 +139,6 @@ class postProcessing : public angularConversion, public fileIO
|
||||
string getBadChannelCorrectionFile() {if ((*correctionMask)&(1<< DISCARD_BAD_CHANNELS)) return string(badChanFile); else return string("none");};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
get flat field corrections file directory
|
||||
\returns flat field correction file directory
|
||||
@ -169,7 +166,7 @@ s
|
||||
\returns thread flag
|
||||
*/
|
||||
|
||||
int setThreadedProcessing(int b=-1) {if (b>=0) *threadedProcessing=b; return *threadedProcessing;}
|
||||
int setThreadedProcessing(int b=-1) {if (b>=0) *threadedProcessing=b; return *threadedProcessing;};
|
||||
|
||||
|
||||
|
||||
|
@ -158,10 +158,10 @@ float defaultGetPosition(void *d) {
|
||||
|
||||
|
||||
|
||||
return pos
|
||||
;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
/* moves the encoder to position p */
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@ int defaultGoToPosition(float p,void *d) {
|
||||
#ifdef VERBOSE
|
||||
printf("caput: success\n");
|
||||
#endif
|
||||
|
||||
} else
|
||||
printf(ca_message(status));
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user