mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
receiver master file includes quad, gap pixels enable, version updated for binary and hdf5, parallel, analog, digital, adc, dbitofset, dbitlist
This commit is contained in:
parent
8dae9243a5
commit
e635ff035c
@ -58,19 +58,10 @@ class BinaryFile : private virtual slsDetectorDefs, public File, public BinaryFi
|
|||||||
/**
|
/**
|
||||||
* Create master file
|
* Create master file
|
||||||
* @param mfwenable master file write enable
|
* @param mfwenable master file write enable
|
||||||
* @param en ten giga enable
|
* @param attr master file attributes
|
||||||
* @param size image size
|
|
||||||
* @param nx number of pixels in x direction
|
|
||||||
* @param ny number of pixels in y direction
|
|
||||||
* @param at acquisition time
|
|
||||||
* @param st sub exposure time
|
|
||||||
* @param sp sub period
|
|
||||||
* @param ap acquisition period
|
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
int CreateMasterFile(bool mfwenable, masterAttributes& attr) override;
|
||||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
|
||||||
uint64_t ap) override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Close Current File
|
* Close Current File
|
||||||
|
@ -97,26 +97,11 @@ class BinaryFileStatic {
|
|||||||
* @param fd pointer to file handle
|
* @param fd pointer to file handle
|
||||||
* @param fname master file name
|
* @param fname master file name
|
||||||
* @param owenable overwrite enable
|
* @param owenable overwrite enable
|
||||||
* @param dr dynamic range
|
* @param attr master file attributes
|
||||||
* @param tenE ten giga enable
|
|
||||||
* @param size image size
|
|
||||||
* @param nPixelsX number of pixels in x direction
|
|
||||||
* @param nPixelsY number of pixels in y direction
|
|
||||||
* @param nf number of images
|
|
||||||
* @param maxf maximum frames per file
|
|
||||||
* @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
|
* @returns 0 for success and 1 for fail
|
||||||
*/
|
*/
|
||||||
static int CreateMasterDataFile(FILE*& fd, std::string fname, bool owenable,
|
static int CreateMasterDataFile(FILE*& fd, std::string fname, bool owenable,
|
||||||
uint32_t dr, bool tenE, uint32_t size,
|
masterAttributes& attr)
|
||||||
uint32_t nPixelsX, uint32_t nPixelsY, uint64_t nf,
|
|
||||||
uint32_t maxf,
|
|
||||||
uint64_t acquisitionTime, uint64_t subexposuretime,
|
|
||||||
uint64_t subperiod, uint64_t acquisitionPeriod, double version)
|
|
||||||
{
|
{
|
||||||
if(!owenable){
|
if(!owenable){
|
||||||
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
|
if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){
|
||||||
@ -135,17 +120,26 @@ class BinaryFileStatic {
|
|||||||
char message[MAX_MASTER_FILE_LENGTH];
|
char message[MAX_MASTER_FILE_LENGTH];
|
||||||
sprintf(message,
|
sprintf(message,
|
||||||
"Version : %.1f\n"
|
"Version : %.1f\n"
|
||||||
|
"Detector Type : %d\n"
|
||||||
"Dynamic Range : %d\n"
|
"Dynamic Range : %d\n"
|
||||||
"Ten Giga : %d\n"
|
"Ten Giga : %d\n"
|
||||||
"Image Size : %d bytes\n"
|
"Image Size : %d bytes\n"
|
||||||
"row : %d pixels\n"
|
"nPixelsX : %d pixels\n"
|
||||||
"col : %d pixels\n"
|
"nPixelsY : %d pixels\n"
|
||||||
"Max. Frames Per File : %u\n"
|
"Max Frames Per File : %u\n"
|
||||||
"Total Frames : %lld\n"
|
"Total Frames : %lld\n"
|
||||||
"Exptime (ns) : %lld\n"
|
"Exptime (ns) : %lld\n"
|
||||||
"SubExptime (ns) : %lld\n"
|
"SubExptime (ns) : %lld\n"
|
||||||
"SubPeriod(ns) : %lld\n"
|
"SubPeriod(ns) : %lld\n"
|
||||||
"Period (ns) : %lld\n"
|
"Period (ns) : %lld\n"
|
||||||
|
"Gap Pixels Enable : %d\n"
|
||||||
|
"Quad Enable : %d\n"
|
||||||
|
"Parallel Flag : %d\n"
|
||||||
|
"Analog Flag : %d\n"
|
||||||
|
"Digital Flag : %d\n"
|
||||||
|
"ADC Mask : %d\n"
|
||||||
|
"Dbit Offset : %d\n"
|
||||||
|
"Dbit Bitset : %lld\n"
|
||||||
"Timestamp : %s\n\n"
|
"Timestamp : %s\n\n"
|
||||||
|
|
||||||
"#Frame Header\n"
|
"#Frame Header\n"
|
||||||
@ -164,18 +158,27 @@ class BinaryFileStatic {
|
|||||||
"Header Version : 1 byte\n"
|
"Header Version : 1 byte\n"
|
||||||
"Packets Caught Mask : 64 bytes\n"
|
"Packets Caught Mask : 64 bytes\n"
|
||||||
,
|
,
|
||||||
version,
|
attr.version,
|
||||||
dr,
|
attr.detectorType,
|
||||||
tenE,
|
attr.dynamicRange,
|
||||||
size,
|
attr.tenGiga,
|
||||||
nPixelsX,
|
attr.imageSize,
|
||||||
nPixelsY,
|
attr.nPixelsX,
|
||||||
maxf,
|
attr.nPixelsY,
|
||||||
(long long int)nf,
|
attr.maxFramesPerFile,
|
||||||
(long long int)acquisitionTime,
|
(long long int)attr.totalFrames,
|
||||||
(long long int)subexposuretime,
|
(long long int)attr.exptimeNs,
|
||||||
(long long int)subperiod,
|
(long long int)attr.subExptimeNs,
|
||||||
(long long int)acquisitionPeriod,
|
(long long int)attr.subPeriodNs,
|
||||||
|
(long long int)attr.periodNs,
|
||||||
|
attr.gapPixelsEnable,
|
||||||
|
attr.quadEnable,
|
||||||
|
attr.parallelFlag,
|
||||||
|
attr.analogFlag,
|
||||||
|
attr.digitalFlag,
|
||||||
|
attr.adcmask,
|
||||||
|
attr.dbitoffset,
|
||||||
|
(long long int)attr.dbitlist,
|
||||||
ctime(&t));
|
ctime(&t));
|
||||||
if (strlen(message) > MAX_MASTER_FILE_LENGTH) {
|
if (strlen(message) > MAX_MASTER_FILE_LENGTH) {
|
||||||
FILE_LOG(logERROR) << "Master File Size " << strlen(message) <<
|
FILE_LOG(logERROR) << "Master File Size " << strlen(message) <<
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ThreadObject.h"
|
#include "ThreadObject.h"
|
||||||
|
#include "receiver_defs.h"
|
||||||
|
|
||||||
class GeneralData;
|
class GeneralData;
|
||||||
class Fifo;
|
class Fifo;
|
||||||
@ -175,16 +176,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create New File
|
* Create New File
|
||||||
* @param en ten giga enable
|
* @param attr master file attributes
|
||||||
* @param nf number of frames
|
|
||||||
* @param at acquisition time
|
|
||||||
* @param st sub exposure time
|
|
||||||
* @param sp sub period
|
|
||||||
* @param ap acquisition period
|
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st,
|
int CreateNewFile(masterAttributes& attr);
|
||||||
uint64_t sp, uint64_t ap);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes files
|
* Closes files
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
|
#include "receiver_defs.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -109,19 +110,10 @@ class File : private virtual slsDetectorDefs {
|
|||||||
/**
|
/**
|
||||||
* Create master file
|
* Create master file
|
||||||
* @param mfwenable master file write enable
|
* @param mfwenable master file write enable
|
||||||
* @param en ten giga enable
|
* @param attr master file attributes
|
||||||
* @param size image size
|
|
||||||
* @param nx number of pixels in x direction
|
|
||||||
* @param ny number of pixels in y direction
|
|
||||||
* @param at acquisition time
|
|
||||||
* @param st sub exposure time
|
|
||||||
* @param sp sub period
|
|
||||||
* @param ap acquisition period
|
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual int CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
virtual int CreateMasterFile(bool mfwenable, masterAttributes& attr) = 0;
|
||||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st,
|
|
||||||
uint64_t sp, uint64_t ap) = 0;
|
|
||||||
|
|
||||||
// HDf5 specific
|
// HDf5 specific
|
||||||
/**
|
/**
|
||||||
|
@ -94,19 +94,10 @@ class HDF5File : private virtual slsDetectorDefs, public File, public HDF5FileSt
|
|||||||
/**
|
/**
|
||||||
* Create master file
|
* Create master file
|
||||||
* @param mfwenable master file write enable
|
* @param mfwenable master file write enable
|
||||||
* @param en ten giga enable
|
* @param attr master file attributes
|
||||||
* @param size image size
|
|
||||||
* @param nx number of pixels in x direction
|
|
||||||
* @param ny number of pixels in y direction
|
|
||||||
* @param at acquisition time
|
|
||||||
* @param st sub exposure time
|
|
||||||
* @param sp sub period
|
|
||||||
* @param ap acquisition period
|
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
int CreateMasterFile(bool mfwenable, masterAttributes& attr);
|
||||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
|
||||||
uint64_t ap);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End of Acquisition
|
* End of Acquisition
|
||||||
|
@ -291,26 +291,11 @@ public:
|
|||||||
* Create master file
|
* Create master file
|
||||||
* @param fname master file name
|
* @param fname master file name
|
||||||
* @param owenable overwrite enable
|
* @param owenable overwrite enable
|
||||||
* @param dr dynamic range
|
* @param attr master file attributes
|
||||||
* @param tenE ten giga enable
|
|
||||||
* @param size image size
|
|
||||||
* @param nx number of pixels in x direction
|
|
||||||
* @param ny number of pixels in y direction
|
|
||||||
* @param nf number of images
|
|
||||||
* @param maxf maximum frames per file
|
|
||||||
* @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
|
* @returns 0 for success and 1 for fail
|
||||||
*/
|
*/
|
||||||
static int CreateMasterDataFile(H5File*& fd, std::string fname, bool owenable,
|
static int CreateMasterDataFile(H5File*& fd, std::string fname, bool owenable,
|
||||||
uint32_t dr, bool tenE, uint32_t size,
|
masterAttributes& attr)
|
||||||
uint32_t nPixelsx, uint32_t nPixelsy, uint64_t nf,
|
|
||||||
uint32_t maxf,
|
|
||||||
uint64_t acquisitionTime, uint64_t subexposuretime,
|
|
||||||
uint64_t subperiod, uint64_t acquisitionPeriod, double version)
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
Exception::dontPrint(); //to handle errors
|
Exception::dontPrint(); //to handle errors
|
||||||
@ -337,7 +322,7 @@ public:
|
|||||||
|
|
||||||
//create attributes
|
//create attributes
|
||||||
//version
|
//version
|
||||||
dValue=version;
|
dValue = attr.version;
|
||||||
attribute = fd->createAttribute("version",PredType::NATIVE_DOUBLE, dataspace);
|
attribute = fd->createAttribute("version",PredType::NATIVE_DOUBLE, dataspace);
|
||||||
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
|
attribute.write(PredType::NATIVE_DOUBLE, &dValue);
|
||||||
|
|
||||||
@ -351,61 +336,101 @@ public:
|
|||||||
|
|
||||||
//Dynamic Range
|
//Dynamic Range
|
||||||
dataset = group5.createDataSet ( "dynamic range", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "dynamic range", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &dr, PredType::NATIVE_INT);
|
dataset.write ( &(attr.dynamicRange), PredType::NATIVE_INT);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("bits"));
|
attribute.write(strdatatype, std::string("bits"));
|
||||||
|
|
||||||
//Ten Giga
|
//Ten Giga
|
||||||
iValue = tenE;
|
iValue = attr.tenGiga;
|
||||||
dataset = group5.createDataSet ( "ten giga enable", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "ten giga enable", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &iValue, PredType::NATIVE_INT);
|
dataset.write ( &iValue, PredType::NATIVE_INT);
|
||||||
|
|
||||||
//Image Size
|
//Image Size
|
||||||
dataset = group5.createDataSet ( "image size", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "image size", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &size, PredType::NATIVE_INT);
|
dataset.write ( &(attr.imageSize), PredType::NATIVE_INT);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("bytes"));
|
attribute.write(strdatatype, std::string("bytes"));
|
||||||
|
|
||||||
//x
|
//x
|
||||||
dataset = group5.createDataSet ( "number of pixels in x axis", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "number of pixels in x axis", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &nPixelsx, PredType::NATIVE_INT);
|
dataset.write ( &(attr.nPixelsX), PredType::NATIVE_INT);
|
||||||
|
|
||||||
//y
|
//y
|
||||||
dataset = group5.createDataSet ( "number of pixels in y axis", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "number of pixels in y axis", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &nPixelsy, PredType::NATIVE_INT);
|
dataset.write ( &(attr.nPixelsY), PredType::NATIVE_INT);
|
||||||
|
|
||||||
//Maximum frames per file
|
//Maximum frames per file
|
||||||
dataset = group5.createDataSet ( "maximum frames per file", PredType::NATIVE_INT, dataspace );
|
dataset = group5.createDataSet ( "maximum frames per file", PredType::NATIVE_INT, dataspace );
|
||||||
dataset.write ( &maxf, PredType::NATIVE_INT);
|
dataset.write ( &(attr.maxFramesPerFile), PredType::NATIVE_INT);
|
||||||
|
|
||||||
//Total Frames
|
//Total Frames
|
||||||
dataset = group5.createDataSet ( "total frames", PredType::STD_U64LE, dataspace );
|
dataset = group5.createDataSet ( "total frames", PredType::STD_U64LE, dataspace );
|
||||||
dataset.write ( &nf, PredType::STD_U64LE);
|
dataset.write ( &(attr.totalFrames), PredType::STD_U64LE);
|
||||||
|
|
||||||
//Exptime
|
//Exptime
|
||||||
dataset = group5.createDataSet ( "exposure time", PredType::STD_U64LE, dataspace );
|
dataset = group5.createDataSet ( "exposure time", PredType::STD_U64LE, dataspace );
|
||||||
dataset.write ( &acquisitionTime, PredType::STD_U64LE);
|
dataset.write ( &(attr.exptimeNs), PredType::STD_U64LE);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("ns"));
|
attribute.write(strdatatype, std::string("ns"));
|
||||||
|
|
||||||
//SubExptime
|
//SubExptime
|
||||||
dataset = group5.createDataSet ( "sub exposure time", PredType::STD_U64LE, dataspace );
|
dataset = group5.createDataSet ( "sub exposure time", PredType::STD_U64LE, dataspace );
|
||||||
dataset.write ( &subexposuretime, PredType::STD_U64LE);
|
dataset.write ( &(attr.subExptimeNs), PredType::STD_U64LE);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("ns"));
|
attribute.write(strdatatype, std::string("ns"));
|
||||||
|
|
||||||
//SubPeriod
|
//SubPeriod
|
||||||
dataset = group5.createDataSet ( "sub period", PredType::STD_U64LE, dataspace );
|
dataset = group5.createDataSet ( "sub period", PredType::STD_U64LE, dataspace );
|
||||||
dataset.write ( &subperiod, PredType::STD_U64LE);
|
dataset.write ( &(attr.subPeriodNs), PredType::STD_U64LE);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("ns"));
|
attribute.write(strdatatype, std::string("ns"));
|
||||||
|
|
||||||
//Period
|
//Period
|
||||||
dataset = group5.createDataSet ( "acquisition period", PredType::STD_U64LE, dataspace );
|
dataset = group5.createDataSet ( "acquisition period", PredType::STD_U64LE, dataspace );
|
||||||
dataset.write ( &acquisitionPeriod, PredType::STD_U64LE);
|
dataset.write ( &(attr.periodNs), PredType::STD_U64LE);
|
||||||
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
attribute = dataset.createAttribute("unit",strdatatype, dataspace);
|
||||||
attribute.write(strdatatype, std::string("ns"));
|
attribute.write(strdatatype, std::string("ns"));
|
||||||
|
|
||||||
|
//Gap Pixels Enable
|
||||||
|
dataset = group5.createDataSet ( "gap pixels enable", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Quad Enable
|
||||||
|
dataset = group5.createDataSet ( "quad enable", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Gap Pixels Enable
|
||||||
|
dataset = group5.createDataSet ( "gap pixels enable", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Quad Enable
|
||||||
|
dataset = group5.createDataSet ( "quad enable", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Parallel Flag
|
||||||
|
dataset = group5.createDataSet ( "parallel flag", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Analog Flag
|
||||||
|
dataset = group5.createDataSet ( "analog flag", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Digital Flag
|
||||||
|
dataset = group5.createDataSet ( "digital flag", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//ADC Mask
|
||||||
|
dataset = group5.createDataSet ( "adc mask", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.quadEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
//Dbit Offset
|
||||||
|
dataset = group5.createDataSet ( "dbit offset", PredType::NATIVE_INT, dataspace );
|
||||||
|
dataset.write ( &(attr.gapPixelsEnable), PredType::NATIVE_INT);
|
||||||
|
|
||||||
|
// Dbit List
|
||||||
|
dataset = group5.createDataSet ( "dbit bitset list", PredType::STD_U64LE, dataspace );
|
||||||
|
dataset.write ( &(attr.periodNs), PredType::STD_U64LE);
|
||||||
|
|
||||||
//Timestamp
|
//Timestamp
|
||||||
time_t t = time(0);
|
time_t t = time(0);
|
||||||
dataset = group5.createDataSet ( "timestamp", strdatatype, dataspace );
|
dataset = group5.createDataSet ( "timestamp", strdatatype, dataspace );
|
||||||
|
@ -30,8 +30,8 @@
|
|||||||
#define MAX_CHUNKED_IMAGES (1)
|
#define MAX_CHUNKED_IMAGES (1)
|
||||||
|
|
||||||
//versions
|
//versions
|
||||||
#define HDF5_WRITER_VERSION (3.0) //1 decimal places
|
#define HDF5_WRITER_VERSION (5.0) //1 decimal places
|
||||||
#define BINARY_WRITER_VERSION (3.0) //1 decimal places
|
#define BINARY_WRITER_VERSION (5.0) //1 decimal places
|
||||||
|
|
||||||
|
|
||||||
//parameters to calculate fifo depth
|
//parameters to calculate fifo depth
|
||||||
@ -49,3 +49,26 @@
|
|||||||
#define STREAMER_PRIORITY (10)
|
#define STREAMER_PRIORITY (10)
|
||||||
#define TCP_PRIORITY (10)
|
#define TCP_PRIORITY (10)
|
||||||
|
|
||||||
|
struct masterAttributes {
|
||||||
|
double version;
|
||||||
|
uint32_t detectorType;
|
||||||
|
uint32_t dynamicRange;
|
||||||
|
uint32_t tenGiga;
|
||||||
|
uint32_t imageSize;
|
||||||
|
uint32_t nPixelsX;
|
||||||
|
uint32_t nPixelsY;
|
||||||
|
uint32_t maxFramesPerFile;
|
||||||
|
uint64_t totalFrames;
|
||||||
|
uint64_t exptimeNs;
|
||||||
|
uint64_t subExptimeNs;
|
||||||
|
uint64_t subPeriodNs;
|
||||||
|
uint64_t periodNs;
|
||||||
|
uint32_t gapPixelsEnable;
|
||||||
|
uint32_t quadEnable;
|
||||||
|
uint32_t parallelFlag;
|
||||||
|
uint32_t analogFlag;
|
||||||
|
uint32_t digitalFlag;
|
||||||
|
uint32_t adcmask;
|
||||||
|
uint32_t dbitoffset;
|
||||||
|
uint64_t dbitlist;
|
||||||
|
};
|
@ -114,9 +114,7 @@ int BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int BinaryFile::CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
int BinaryFile::CreateMasterFile(bool mfwenable, masterAttributes& attr) {
|
||||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
|
||||||
uint64_t ap) {
|
|
||||||
//beginning of every acquisition
|
//beginning of every acquisition
|
||||||
numFramesInFile = 0;
|
numFramesInFile = 0;
|
||||||
numActualPacketsInFile = 0;
|
numActualPacketsInFile = 0;
|
||||||
@ -127,10 +125,9 @@ int BinaryFile::CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
|||||||
if(!(*silentMode)) {
|
if(!(*silentMode)) {
|
||||||
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
||||||
}
|
}
|
||||||
|
attr.version = BINARY_WRITER_VERSION;
|
||||||
return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName,
|
return BinaryFileStatic::CreateMasterDataFile(masterfd, masterFileName,
|
||||||
*overWriteEnable,
|
*overWriteEnable, attr);
|
||||||
*dynamicRange, en, size, nx, ny, *numImages, *maxFramesPerFile,
|
|
||||||
at, st, sp, ap, BINARY_WRITER_VERSION);
|
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -248,15 +248,12 @@ void DataProcessor::SetupFileWriter(bool fwe, int* nd, uint32_t* maxf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// only the first file
|
// only the first file
|
||||||
int DataProcessor::CreateNewFile(bool en, uint64_t nf, uint64_t at, uint64_t st,
|
int DataProcessor::CreateNewFile(masterAttributes& attr) {
|
||||||
uint64_t sp, uint64_t ap) {
|
|
||||||
if (file == nullptr)
|
if (file == nullptr)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
file->CloseAllFiles();
|
file->CloseAllFiles();
|
||||||
file->resetSubFileIndex();
|
file->resetSubFileIndex();
|
||||||
if (file->CreateMasterFile(*masterFileWriteEnable, en, generalData->imageSize,
|
if (file->CreateMasterFile(*masterFileWriteEnable, attr) == FAIL)
|
||||||
generalData->nPixelsX, generalData->nPixelsY,
|
|
||||||
at, st, sp, ap) == FAIL)
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
if (file->CreateFile() == FAIL)
|
if (file->CreateFile() == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
@ -240,9 +240,7 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int HDF5File::CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
int HDF5File::CreateMasterFile(bool mfwenable, masterAttributes& attr) {
|
||||||
uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp,
|
|
||||||
uint64_t ap) {
|
|
||||||
|
|
||||||
//beginning of every acquisition
|
//beginning of every acquisition
|
||||||
numFramesInFile = 0;
|
numFramesInFile = 0;
|
||||||
@ -257,11 +255,9 @@ int HDF5File::CreateMasterFile(bool mfwenable, bool en, uint32_t size,
|
|||||||
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
FILE_LOG(logINFO) << "Master File: " << masterFileName;
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&Mutex);
|
pthread_mutex_lock(&Mutex);
|
||||||
|
attr.version = HDF5_WRITER_VERSION;
|
||||||
int ret = HDF5FileStatic::CreateMasterDataFile(masterfd, masterFileName,
|
int ret = HDF5FileStatic::CreateMasterDataFile(masterfd, masterFileName,
|
||||||
*overWriteEnable,
|
*overWriteEnable, attr);
|
||||||
*dynamicRange, en, size, nx, ny, *numImages, *maxFramesPerFile,
|
|
||||||
at, st, sp, ap,
|
|
||||||
HDF5_WRITER_VERSION);
|
|
||||||
pthread_mutex_unlock(&Mutex);
|
pthread_mutex_unlock(&Mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1647,10 +1647,32 @@ int slsReceiverImplementation::CreateUDPSockets() {
|
|||||||
int slsReceiverImplementation::SetupWriter() {
|
int slsReceiverImplementation::SetupWriter() {
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
masterAttributes attr;
|
||||||
|
attr.detectorType = myDetectorType;
|
||||||
|
attr.dynamicRange = dynamicRange;
|
||||||
|
attr.tenGiga = tengigaEnable;
|
||||||
|
attr.imageSize = generalData->imageSize;
|
||||||
|
attr.nPixelsX = generalData->nPixelsX;
|
||||||
|
attr.nPixelsY = generalData->nPixelsY;
|
||||||
|
attr.maxFramesPerFile = framesPerFile;
|
||||||
|
attr.totalFrames = numberOfFrames;
|
||||||
|
attr.exptimeNs = acquisitionTime;
|
||||||
|
attr.subExptimeNs = subExpTime;
|
||||||
|
attr.subPeriodNs = subPeriod;
|
||||||
|
attr.periodNs = acquisitionPeriod;
|
||||||
|
attr.gapPixelsEnable = gapPixelsEnable;
|
||||||
|
attr.quadEnable = quadEnable;
|
||||||
|
attr.parallelFlag = (readoutFlags & PARALLEL) ? 1 : 0;
|
||||||
|
attr.analogFlag = (readoutFlags == NORMAL_READOUT || readoutFlags & ANALOG_AND_DIGITAL) ? 1 : 0;
|
||||||
|
attr.digitalFlag = (readoutFlags & DIGITAL_ONLY || readoutFlags & ANALOG_AND_DIGITAL) ? 1 : 0;
|
||||||
|
attr.adcmask = adcEnableMask;
|
||||||
|
attr.dbitoffset = ctbDbitOffset;
|
||||||
|
attr.dbitlist = 0;
|
||||||
|
for (auto &i : ctbDbitList) {
|
||||||
|
attr.dbitlist |= (1 << i);
|
||||||
|
}
|
||||||
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
for (unsigned int i = 0; i < dataProcessor.size(); ++i)
|
||||||
if (dataProcessor[i]->CreateNewFile(
|
if (dataProcessor[i]->CreateNewFile(attr) == FAIL) {
|
||||||
tengigaEnable, numberOfFrames, acquisitionTime, subExpTime,
|
|
||||||
subPeriod, acquisitionPeriod) == FAIL) {
|
|
||||||
error = true;
|
error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user