mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
slsReceiver, slsDetector(eiger server), client: added sub period to receiver, fixed eiger subperiod updates to client, added subperiod and subexptime to users, fixed hdf5 warnings
This commit is contained in:
@ -63,12 +63,14 @@ class BinaryFile : private virtual slsReceiverDefs, public File, public BinaryFi
|
||||
* @param nx number of pixels in x direction
|
||||
* @param ny number of pixels in y direction
|
||||
* @param at acquisition time
|
||||
* @param at sub exposure time
|
||||
* @param st sub exposure time
|
||||
* @param sp sub period
|
||||
* @param ap acquisition period
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int CreateMasterFile(bool en, uint32_t size,
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t ap);
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
||||
uint64_t ap);
|
||||
|
||||
/**
|
||||
* Close Current File
|
||||
|
@ -109,12 +109,15 @@ class BinaryFileStatic {
|
||||
* @param acquisitionTime acquisition time
|
||||
* @param acquisitionPeriod acquisition period
|
||||
* @param subexposuretime sub exposure time
|
||||
* @param subperiod sub period
|
||||
* @param version version of software for binary writing
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateMasterDataFile(FILE*& fd, string fname, bool owenable,
|
||||
uint32_t dr, bool tenE, uint32_t size, uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
|
||||
uint64_t acquisitionTime, uint64_t subexposuretime, uint64_t acquisitionPeriod, double version)
|
||||
uint32_t dr, bool tenE, uint32_t size,
|
||||
uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
|
||||
uint64_t acquisitionTime, uint64_t subexposuretime,
|
||||
uint64_t subperiod, uint64_t acquisitionPeriod, double version)
|
||||
{
|
||||
if(!owenable){
|
||||
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
|
||||
@ -130,32 +133,33 @@ class BinaryFileStatic {
|
||||
time_t t = time(0);
|
||||
char message[MAX_STR_LENGTH];
|
||||
sprintf(message,
|
||||
"Version : %.1f\n"
|
||||
"Dynamic Range : %d\n"
|
||||
"Ten Giga : %d\n"
|
||||
"Image Size : %d bytes\n"
|
||||
"x : %d pixels\n"
|
||||
"y : %d pixels\n"
|
||||
"Total Frames : %lld\n"
|
||||
"Exptime (ns) : %lld\n"
|
||||
"SubExptime (ns) : %lld\n"
|
||||
"Period (ns) : %lld\n"
|
||||
"Timestamp : %s\n\n"
|
||||
"Version : %.1f\n"
|
||||
"Dynamic Range : %d\n"
|
||||
"Ten Giga : %d\n"
|
||||
"Image Size : %d bytes\n"
|
||||
"x : %d pixels\n"
|
||||
"y : %d pixels\n"
|
||||
"Total Frames : %lld\n"
|
||||
"Exptime (ns) : %lld\n"
|
||||
"SubExptime (ns) : %lld\n"
|
||||
"SubPeriod(ns) : %lld\n"
|
||||
"Period (ns) : %lld\n"
|
||||
"Timestamp : %s\n\n"
|
||||
|
||||
"#Frame Header\n"
|
||||
"Frame Number : 8 bytes\n"
|
||||
"SubFrame Number/ExpLength : 4 bytes\n"
|
||||
"Packet Number : 4 bytes\n"
|
||||
"Bunch ID : 8 bytes\n"
|
||||
"Timestamp : 8 bytes\n"
|
||||
"Module Id : 2 bytes\n"
|
||||
"X Coordinate : 2 bytes\n"
|
||||
"Y Coordinate : 2 bytes\n"
|
||||
"Z Coordinate : 2 bytes\n"
|
||||
"Debug : 4 bytes\n"
|
||||
"Round Robin Number : 2 bytes\n"
|
||||
"Detector Type : 1 byte\n"
|
||||
"Header Version : 1 byte\n"
|
||||
"Frame Number : 8 bytes\n"
|
||||
"SubFrame Number/ExpLength : 4 bytes\n"
|
||||
"Packet Number : 4 bytes\n"
|
||||
"Bunch ID : 8 bytes\n"
|
||||
"Timestamp : 8 bytes\n"
|
||||
"Module Id : 2 bytes\n"
|
||||
"X Coordinate : 2 bytes\n"
|
||||
"Y Coordinate : 2 bytes\n"
|
||||
"Z Coordinate : 2 bytes\n"
|
||||
"Debug : 4 bytes\n"
|
||||
"Round Robin Number : 2 bytes\n"
|
||||
"Detector Type : 1 byte\n"
|
||||
"Header Version : 1 byte\n"
|
||||
,
|
||||
version,
|
||||
dr,
|
||||
@ -166,6 +170,7 @@ class BinaryFileStatic {
|
||||
(long long int)nf,
|
||||
(long long int)acquisitionTime,
|
||||
(long long int)subexposuretime,
|
||||
(long long int)subperiod,
|
||||
(long long int)acquisitionPeriod,
|
||||
ctime(&t));
|
||||
if (strlen(message) > MAX_STR_LENGTH) {
|
||||
|
@ -173,11 +173,13 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param en ten giga enable
|
||||
* @param nf number of frames
|
||||
* @param at acquisition time
|
||||
* @param at sub exposure time
|
||||
* @param st sub exposure time
|
||||
* @param sp sub period
|
||||
* @param ap acquisition period
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st, uint64_t ap);
|
||||
int CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st,
|
||||
uint64_t sp, uint64_t ap);
|
||||
|
||||
/**
|
||||
* Closes files
|
||||
|
@ -89,7 +89,8 @@ class File : private virtual slsReceiverDefs {
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
virtual int CreateFile(uint64_t fnum){
|
||||
cprintf(RED,"This is a generic function CreateFile that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function CreateFile that should be "
|
||||
"overloaded by a derived class\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -97,14 +98,16 @@ class File : private virtual slsReceiverDefs {
|
||||
* Close Current File
|
||||
*/
|
||||
virtual void CloseCurrentFile() {
|
||||
cprintf(RED,"This is a generic function CloseCurrentFile that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function CloseCurrentFile that should be "
|
||||
"overloaded by a derived class\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Close Files
|
||||
*/
|
||||
virtual void CloseAllFiles() {
|
||||
cprintf(RED,"This is a generic function that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function that should be overloaded "
|
||||
"by a derived class\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,7 +118,8 @@ class File : private virtual slsReceiverDefs {
|
||||
* @param OK or FAIL
|
||||
*/
|
||||
virtual int WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) {
|
||||
cprintf(RED,"This is a generic function WriteToFile that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function WriteToFile that "
|
||||
"should be overloaded by a derived class\n");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
@ -126,13 +130,16 @@ class File : private virtual slsReceiverDefs {
|
||||
* @param nx number of pixels in x direction
|
||||
* @param ny number of pixels in y direction
|
||||
* @param at acquisition time
|
||||
* @param at sub exposure time
|
||||
* @param st sub exposure time
|
||||
* @param sp sub period
|
||||
* @param ap acquisition period
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
virtual int CreateMasterFile(bool en, uint32_t size,
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t ap) {
|
||||
cprintf(RED,"This is a generic function CreateMasterFile that should be overloaded by a derived class\n");
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st,
|
||||
uint64_t sp, uint64_t ap) {
|
||||
cprintf(RED,"This is a generic function CreateMasterFile that "
|
||||
"should be overloaded by a derived class\n");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -143,7 +150,8 @@ class File : private virtual slsReceiverDefs {
|
||||
* @param ny number of pixels in y direction
|
||||
*/
|
||||
virtual void SetNumberofPixels(uint32_t nx, uint32_t ny) {
|
||||
cprintf(RED,"This is a generic function SetNumberofPixels that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function SetNumberofPixels that "
|
||||
"should be overloaded by a derived class\n");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,7 +159,8 @@ class File : private virtual slsReceiverDefs {
|
||||
* @param numf number of images caught
|
||||
*/
|
||||
virtual void EndofAcquisition(uint64_t numf) {
|
||||
cprintf(RED,"This is a generic function EndofAcquisition that should be overloaded by a derived class\n");
|
||||
cprintf(RED,"This is a generic function EndofAcquisition that "
|
||||
"should be overloaded by a derived class\n");
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -99,12 +99,14 @@ class HDF5File : private virtual slsReceiverDefs, public File, public HDF5FileSt
|
||||
* @param nx number of pixels in x direction
|
||||
* @param ny number of pixels in y direction
|
||||
* @param at acquisition time
|
||||
* @param at sub exposure time
|
||||
* @param st sub exposure time
|
||||
* @param sp sub period
|
||||
* @param ap acquisition period
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int CreateMasterFile(bool en, uint32_t size,
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t ap);
|
||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
||||
uint64_t ap);
|
||||
|
||||
/**
|
||||
* End of Acquisition
|
||||
|
@ -232,13 +232,16 @@ public:
|
||||
* @param nf number of images
|
||||
* @param acquisitionTime acquisition time
|
||||
* @param subexposuretime sub exposure time
|
||||
* @param subperiod sub period
|
||||
* @param acquisitionPeriod acquisition period
|
||||
* @param version version of software for hdf5 writing
|
||||
* @returns 0 for success and 1 for fail
|
||||
*/
|
||||
static int CreateMasterDataFile(H5File*& fd, string fname, bool owenable,
|
||||
uint32_t dr, bool tenE, uint32_t size, uint32_t nPixelsx, uint32_t nPixelsy, uint64_t nf,
|
||||
uint64_t acquisitionTime, uint64_t subexposuretime, uint64_t acquisitionPeriod, double version)
|
||||
uint32_t dr, bool tenE, uint32_t size,
|
||||
uint32_t nPixelsx, uint32_t nPixelsy, uint64_t nf,
|
||||
uint64_t acquisitionTime, uint64_t subexposuretime,
|
||||
uint64_t subperiod, uint64_t acquisitionPeriod, double version)
|
||||
{
|
||||
try {
|
||||
Exception::dontPrint(); //to handle errors
|
||||
@ -246,9 +249,13 @@ public:
|
||||
FileAccPropList flist;
|
||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
if(!owenable)
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL, NULL, flist );
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
flist );
|
||||
else
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_TRUNC, NULL, flist );
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_TRUNC,
|
||||
FileCreatPropList::DEFAULT,
|
||||
flist );
|
||||
|
||||
//variables
|
||||
DataSpace dataspace = DataSpace (H5S_SCALAR);
|
||||
@ -313,6 +320,12 @@ public:
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
|
||||
//SubPeriod
|
||||
dataset = group5.createDataSet ( "sub period", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &subperiod, PredType::STD_U64LE);
|
||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||
attribute.write(strdatatype, string("ns"));
|
||||
|
||||
//Period
|
||||
dataset = group5.createDataSet ( "acquisition period", PredType::STD_U64LE, dataspace );
|
||||
dataset.write ( &acquisitionPeriod, PredType::STD_U64LE);
|
||||
@ -374,9 +387,13 @@ public:
|
||||
FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
if(!owenable)
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL, NULL,fapl );
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
fapl );
|
||||
else
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_TRUNC, NULL, fapl );
|
||||
fd = new H5File( fname.c_str(), H5F_ACC_TRUNC,
|
||||
FileCreatPropList::DEFAULT,
|
||||
fapl );
|
||||
|
||||
//attributes - version
|
||||
double dValue=version;
|
||||
@ -678,9 +695,13 @@ public:
|
||||
FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
if(!owenable)
|
||||
newfd = new H5File( newFileName.c_str(), H5F_ACC_EXCL, NULL,fapl );
|
||||
newfd = new H5File( newFileName.c_str(), H5F_ACC_EXCL,
|
||||
FileCreatPropList::DEFAULT,
|
||||
fapl );
|
||||
else
|
||||
newfd = new H5File( newFileName.c_str(), H5F_ACC_TRUNC, NULL, fapl );
|
||||
newfd = new H5File( newFileName.c_str(), H5F_ACC_TRUNC,
|
||||
FileCreatPropList::DEFAULT,
|
||||
fapl );
|
||||
//dataspace and dataset
|
||||
DataSpace* newDataspace;
|
||||
if (rank == 3) {
|
||||
|
@ -206,6 +206,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
*/
|
||||
uint64_t getSubExpTime() const;
|
||||
|
||||
/**
|
||||
* Get Sub Period
|
||||
* @return Sub Period
|
||||
*/
|
||||
uint64_t getSubPeriod() const;
|
||||
|
||||
/*
|
||||
* Get Number of Frames expected by receiver from detector
|
||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (Not implemented)
|
||||
@ -445,6 +451,13 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
*/
|
||||
void setSubExpTime(const uint64_t i);
|
||||
|
||||
/**
|
||||
* Set Sub Period
|
||||
* @param i Period
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
void setSubPeriod(const uint64_t i);
|
||||
|
||||
/**
|
||||
* Set Number of Frames expected by receiver from detector
|
||||
* The data receiver status will change from running to idle when it gets this number of frames
|
||||
@ -682,6 +695,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
uint64_t acquisitionTime;
|
||||
/** Sub Exposure Time */
|
||||
uint64_t subExpTime;
|
||||
/** Sub Period */
|
||||
uint64_t subPeriod;
|
||||
/** Frame Number */
|
||||
uint64_t numberOfFrames;
|
||||
/** Samples Number */
|
||||
|
@ -294,6 +294,12 @@ class UDPInterface {
|
||||
*/
|
||||
virtual uint64_t getSubExpTime() const = 0;
|
||||
|
||||
/**
|
||||
* Get Sub Period
|
||||
* @return Sub Period
|
||||
*/
|
||||
virtual uint64_t getSubPeriod() const = 0;
|
||||
|
||||
/*
|
||||
* Get Number of Frames expected by receiver from detector
|
||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (for Leo? Not implemented)
|
||||
@ -531,6 +537,13 @@ class UDPInterface {
|
||||
*/
|
||||
virtual void setSubExpTime(const uint64_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set Sub Period
|
||||
* @param i Period
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual void setSubPeriod(const uint64_t i) = 0;
|
||||
|
||||
/**
|
||||
* Set Number of Frames expected by receiver from detector
|
||||
* The data receiver status will change from running to idle when it gets this number of frames FIXME: (for Leo? Not implemented)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
|
||||
#define GITREPUUID "b8bdbf4da61f95b88893b02ddabc2491b16fa10f"
|
||||
#define GITREPUUID "51fd9ed423b7a8fb45a76b4f48316537c4fb0f5d"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x3746
|
||||
#define GITDATE 0x20180327
|
||||
#define GITREV 0x3818
|
||||
#define GITDATE 0x20180517
|
||||
#define GITBRANCH "developer"
|
||||
|
Reference in New Issue
Block a user