mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 17:40:01 +02:00
Merge branch 'developer' into g2rxr
This commit is contained in:
commit
37a8c61124
@ -82,6 +82,7 @@ This document describes the differences between v7.0.0 and v6.x.x
|
||||
-rx_bunchsize, (default fifodepth for g2 changed to 50)
|
||||
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
|
||||
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
|
||||
- set dataset name for all hdf5 files to "data" only
|
||||
|
||||
2. Resolved Issues
|
||||
==================
|
||||
|
@ -180,7 +180,7 @@ uint32_t DataProcessor::GetFilesInAcquisition() const {
|
||||
return dataFile_->GetFilesInAcquisition();
|
||||
}
|
||||
|
||||
std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
||||
std::string DataProcessor::CreateVirtualFile(
|
||||
const std::string &filePath, const std::string &fileNamePrefix,
|
||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||
const int modulePos, const int numUnitsPerReadout,
|
||||
@ -206,7 +206,7 @@ std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
||||
// stop acquisition)
|
||||
return masterFileUtility::CreateVirtualHDF5File(
|
||||
filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode,
|
||||
modulePos, numUnitsPerReadout, framesPerFile, numImages,
|
||||
modulePos, numUnitsPerReadout, framesPerFile,
|
||||
generalData_->nPixelsX, generalData_->nPixelsY, dynamicRange,
|
||||
numFramesCaught_, numModX, numModY, dataFile_->GetPDataType(),
|
||||
dataFile_->GetParameterNames(), dataFile_->GetParameterDataTypes(),
|
||||
@ -215,21 +215,18 @@ std::array<std::string, 2> DataProcessor::CreateVirtualFile(
|
||||
|
||||
void DataProcessor::LinkFileInMaster(const std::string &masterFileName,
|
||||
const std::string &virtualFileName,
|
||||
const std::string &virtualDatasetName,
|
||||
const bool silentMode,
|
||||
std::mutex *hdf5LibMutex) {
|
||||
|
||||
if (receiverRoiEnabled_) {
|
||||
throw std::runtime_error("Should not be here, roi with hdf5 virtual should throw.");
|
||||
}
|
||||
std::string fname{virtualFileName}, datasetName{virtualDatasetName}, masterfname{masterFileName};
|
||||
std::string fname{virtualFileName}, masterfname{masterFileName};
|
||||
// if no virtual file, link data file
|
||||
if (virtualFileName.empty()) {
|
||||
auto res = dataFile_->GetFileAndDatasetName();
|
||||
fname = res[0];
|
||||
datasetName = res[1];
|
||||
fname = dataFile_->GetFileName();
|
||||
}
|
||||
masterFileUtility::LinkHDF5FileInMaster(masterfname, fname, datasetName,
|
||||
masterFileUtility::LinkHDF5FileInMaster(masterfname, fname,
|
||||
dataFile_->GetParameterNames(),
|
||||
silentMode, hdf5LibMutex);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
const bool detectorDataStream);
|
||||
#ifdef HDF5C
|
||||
uint32_t GetFilesInAcquisition() const;
|
||||
std::array<std::string, 2> CreateVirtualFile(
|
||||
std::string CreateVirtualFile(
|
||||
const std::string &filePath, const std::string &fileNamePrefix,
|
||||
const uint64_t fileIndex, const bool overWriteEnable,
|
||||
const bool silentMode, const int modulePos,
|
||||
@ -72,7 +72,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
const uint32_t dynamicRange, std::mutex *hdf5LibMutex);
|
||||
void LinkFileInMaster(const std::string &masterFileName,
|
||||
const std::string &virtualFileName,
|
||||
const std::string &virtualDatasetName,
|
||||
const bool silentMode, std::mutex *hdf5LibMutex);
|
||||
#endif
|
||||
|
||||
|
@ -25,11 +25,11 @@ class File : private virtual slsDetectorDefs {
|
||||
virtual void CloseFile() = 0;
|
||||
|
||||
#ifdef HDF5C
|
||||
virtual std::array<std::string, 2> GetFileAndDatasetName() const {
|
||||
virtual std::string GetFileName() const {
|
||||
LOG(logERROR)
|
||||
<< "This is a generic function GetFilesInAcquisition that "
|
||||
<< "This is a generic function GetFileName that "
|
||||
"should be overloaded by a derived class";
|
||||
return std::array<std::string, 2>{};
|
||||
return std::string{};
|
||||
}
|
||||
|
||||
virtual uint32_t GetFilesInAcquisition() const {
|
||||
@ -47,14 +47,14 @@ class File : private virtual slsDetectorDefs {
|
||||
|
||||
virtual std::vector<std::string> GetParameterNames() const {
|
||||
LOG(logERROR)
|
||||
<< "This is a generic function GetFilesInAcquisition that "
|
||||
<< "This is a generic function GetParameterNames that "
|
||||
"should be overloaded by a derived class";
|
||||
return std::vector<std::string>{};
|
||||
};
|
||||
|
||||
virtual std::vector<H5::DataType> GetParameterDataTypes() const {
|
||||
LOG(logERROR)
|
||||
<< "This is a generic function GetFilesInAcquisition that "
|
||||
<< "This is a generic function GetParameterDataTypes that "
|
||||
"should be overloaded by a derived class";
|
||||
return std::vector<H5::DataType>{};
|
||||
};
|
||||
@ -67,7 +67,7 @@ class File : private virtual slsDetectorDefs {
|
||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||
const uint32_t dynamicRange) {
|
||||
LOG(logERROR) << "This is a generic function CreateFirstDataFile that "
|
||||
LOG(logERROR) << "This is a generic function CreateFirstHDF5DataFile that "
|
||||
"should be overloaded by a derived class";
|
||||
};
|
||||
#endif
|
||||
@ -77,7 +77,7 @@ class File : private virtual slsDetectorDefs {
|
||||
const bool silentMode, const int modulePos,
|
||||
const int numUnitsPerReadout, const uint32_t udpPortNumber,
|
||||
const uint32_t maxFramesPerFile) {
|
||||
LOG(logERROR) << "This is a generic function CreateFirstDataFile that "
|
||||
LOG(logERROR) << "This is a generic function CreateFirstBinaryDataFile that "
|
||||
"should be overloaded by a derived class";
|
||||
};
|
||||
|
||||
|
@ -26,44 +26,44 @@ HDF5DataFile::HDF5DataFile(int index, std::mutex *hdf5Lib)
|
||||
"detector header version",
|
||||
"packets caught bit mask",
|
||||
};
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, sizeof(bitset_storage));
|
||||
parameterDataTypes_ = std::vector<::H5::DataType>{
|
||||
::H5::PredType::STD_U64LE, ::H5::PredType::STD_U32LE, ::H5::PredType::STD_U32LE,
|
||||
::H5::PredType::STD_U64LE, ::H5::PredType::STD_U64LE, ::H5::PredType::STD_U16LE,
|
||||
::H5::PredType::STD_U16LE, ::H5::PredType::STD_U16LE, ::H5::PredType::STD_U16LE,
|
||||
::H5::PredType::STD_U32LE, ::H5::PredType::STD_U16LE, ::H5::PredType::STD_U8LE,
|
||||
::H5::PredType::STD_U8LE, strdatatype};
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, sizeof(bitset_storage));
|
||||
parameterDataTypes_ = std::vector<H5::DataType>{
|
||||
H5::PredType::STD_U64LE, H5::PredType::STD_U32LE, H5::PredType::STD_U32LE,
|
||||
H5::PredType::STD_U64LE, H5::PredType::STD_U64LE, H5::PredType::STD_U16LE,
|
||||
H5::PredType::STD_U16LE, H5::PredType::STD_U16LE, H5::PredType::STD_U16LE,
|
||||
H5::PredType::STD_U32LE, H5::PredType::STD_U16LE, H5::PredType::STD_U8LE,
|
||||
H5::PredType::STD_U8LE, strdatatype};
|
||||
}
|
||||
|
||||
HDF5DataFile::~HDF5DataFile() { CloseFile(); }
|
||||
|
||||
std::array<std::string, 2> HDF5DataFile::GetFileAndDatasetName() const {
|
||||
return std::array<std::string, 2>{fileName_, dataSetName_};
|
||||
std::string HDF5DataFile::GetFileName() const {
|
||||
return fileName_;
|
||||
}
|
||||
|
||||
uint32_t HDF5DataFile::GetFilesInAcquisition() const {
|
||||
return numFilesInAcquisition_;
|
||||
}
|
||||
|
||||
::H5::DataType HDF5DataFile::GetPDataType() const { return dataType_; }
|
||||
H5::DataType HDF5DataFile::GetPDataType() const { return dataType_; }
|
||||
|
||||
std::vector<std::string> HDF5DataFile::GetParameterNames() const {
|
||||
return parameterNames_;
|
||||
}
|
||||
std::vector<::H5::DataType> HDF5DataFile::GetParameterDataTypes() const {
|
||||
std::vector<H5::DataType> HDF5DataFile::GetParameterDataTypes() const {
|
||||
return parameterDataTypes_;
|
||||
}
|
||||
|
||||
void HDF5DataFile::CloseFile() {
|
||||
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
if (fd_) {
|
||||
fd_->close();
|
||||
delete fd_;
|
||||
fd_ = nullptr;
|
||||
}
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
LOG(logERROR) << "Could not close data HDF5 handles of index "
|
||||
<< index_;
|
||||
error.printErrorStack();
|
||||
@ -116,13 +116,13 @@ void HDF5DataFile::CreateFirstHDF5DataFile(
|
||||
switch (dynamicRange_) {
|
||||
case 12:
|
||||
case 16:
|
||||
dataType_ = ::H5::PredType::STD_U16LE;
|
||||
dataType_ = H5::PredType::STD_U16LE;
|
||||
break;
|
||||
case 32:
|
||||
dataType_ = ::H5::PredType::STD_U32LE;
|
||||
dataType_ = H5::PredType::STD_U32LE;
|
||||
break;
|
||||
default:
|
||||
dataType_ = ::H5::PredType::STD_U8LE;
|
||||
dataType_ = H5::PredType::STD_U8LE;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -153,42 +153,35 @@ void HDF5DataFile::CreateFile() {
|
||||
uint32_t nDimz = ((dynamicRange_ == 4) ? (nPixelsX_ / 2) : nPixelsX_);
|
||||
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
// file
|
||||
::H5::FileAccPropList fapl;
|
||||
H5::FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
fd_ = nullptr;
|
||||
if (!overWriteEnable_)
|
||||
fd_ = new ::H5::H5File(fileName_.c_str(), H5F_ACC_EXCL,
|
||||
::H5::FileCreatPropList::DEFAULT, fapl);
|
||||
fd_ = new H5::H5File(fileName_.c_str(), H5F_ACC_EXCL,
|
||||
H5::FileCreatPropList::DEFAULT, fapl);
|
||||
else
|
||||
fd_ = new ::H5::H5File(fileName_.c_str(), H5F_ACC_TRUNC,
|
||||
::H5::FileCreatPropList::DEFAULT, fapl);
|
||||
fd_ = new H5::H5File(fileName_.c_str(), H5F_ACC_TRUNC,
|
||||
H5::FileCreatPropList::DEFAULT, fapl);
|
||||
|
||||
// attributes - version
|
||||
double dValue = HDF5_WRITER_VERSION;
|
||||
::H5::DataSpace dataspace_attr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::Attribute attribute = fd_->createAttribute(
|
||||
"version", ::H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(::H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::Attribute attribute = fd_->createAttribute(
|
||||
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
|
||||
// dataspace
|
||||
hsize_t srcdims[3] = {nDimx, nDimy, nDimz};
|
||||
hsize_t srcdimsmax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
||||
dataSpace_ = nullptr;
|
||||
dataSpace_ = new ::H5::DataSpace(3, srcdims, srcdimsmax);
|
||||
|
||||
// dataset name
|
||||
std::ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if (numImages_ > 1)
|
||||
osfn << "_f" << std::setfill('0') << std::setw(12) << subFileIndex_;
|
||||
dataSetName_ = osfn.str();
|
||||
dataSpace_ = new H5::DataSpace(3, srcdims, srcdimsmax);
|
||||
|
||||
// dataset
|
||||
// fill value
|
||||
::H5::DSetCreatPropList plist;
|
||||
H5::DSetCreatPropList plist;
|
||||
int fill_value = -1;
|
||||
plist.setFillValue(dataType_, &fill_value);
|
||||
// always create chunked dataset as unlimited is only
|
||||
@ -196,28 +189,28 @@ void HDF5DataFile::CreateFile() {
|
||||
hsize_t chunk_dims[3] = {MAX_CHUNKED_IMAGES, nDimy, nDimz};
|
||||
plist.setChunk(3, chunk_dims);
|
||||
dataSet_ = nullptr;
|
||||
dataSet_ = new ::H5::DataSet(fd_->createDataSet(
|
||||
dataSetName_.c_str(), dataType_, *dataSpace_, plist));
|
||||
dataSet_ = new H5::DataSet(fd_->createDataSet(
|
||||
DATASET_NAME, dataType_, *dataSpace_, plist));
|
||||
|
||||
// create parameter datasets
|
||||
hsize_t dims[1] = {nDimx};
|
||||
hsize_t dimsmax[1] = {H5S_UNLIMITED};
|
||||
dataSpacePara_ = nullptr;
|
||||
dataSpacePara_ = new ::H5::DataSpace(1, dims, dimsmax);
|
||||
dataSpacePara_ = new H5::DataSpace(1, dims, dimsmax);
|
||||
|
||||
// always create chunked dataset as unlimited is only
|
||||
// supported with chunked layout
|
||||
::H5::DSetCreatPropList paralist;
|
||||
H5::DSetCreatPropList paralist;
|
||||
hsize_t chunkpara_dims[3] = {MAX_CHUNKED_IMAGES};
|
||||
paralist.setChunk(1, chunkpara_dims);
|
||||
|
||||
for (unsigned int i = 0; i < parameterNames_.size(); ++i) {
|
||||
::H5::DataSet *ds = new ::H5::DataSet(fd_->createDataSet(
|
||||
H5::DataSet *ds = new H5::DataSet(fd_->createDataSet(
|
||||
parameterNames_[i].c_str(), parameterDataTypes_[i],
|
||||
*dataSpacePara_, paralist));
|
||||
dataSetPara_.push_back(ds);
|
||||
}
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
CloseFile();
|
||||
throw RuntimeError("Could not create HDF5 handles in object " +
|
||||
@ -287,16 +280,16 @@ void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber,
|
||||
hsize_t start[3] = {nDimx, 0, 0};
|
||||
hsize_t dims2[2] = {nDimy, nDimz};
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
dataSpace_->selectHyperslab(H5S_SELECT_SET, count, start);
|
||||
::H5::DataSpace memspace(2, dims2);
|
||||
H5::DataSpace memspace(2, dims2);
|
||||
dataSet_->write(revBuffer, dataType_, memspace, *dataSpace_);
|
||||
memspace.close();
|
||||
if (dynamicRange_ == 12) {
|
||||
free(revBuffer);
|
||||
}
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
if (dynamicRange_ == 12) {
|
||||
free(revBuffer);
|
||||
}
|
||||
@ -320,9 +313,9 @@ void HDF5DataFile::WriteParameterDatasets(const uint64_t currentFrameNumber,
|
||||
hsize_t start[1] = {fnum};
|
||||
int i = 0;
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
dataSpacePara_->selectHyperslab(H5S_SELECT_SET, count, start);
|
||||
::H5::DataSpace memspace(H5S_SCALAR);
|
||||
H5::DataSpace memspace(H5S_SCALAR);
|
||||
dataSetPara_[0]->write(&header.frameNumber, parameterDataTypes_[0],
|
||||
memspace, *dataSpacePara_);
|
||||
i = 1;
|
||||
@ -383,7 +376,7 @@ void HDF5DataFile::WriteParameterDatasets(const uint64_t currentFrameNumber,
|
||||
memspace, *dataSpacePara_);
|
||||
}
|
||||
i = 14;
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
throw RuntimeError(
|
||||
"Could not write parameters (index:" + std::to_string(i) +
|
||||
@ -395,7 +388,7 @@ void HDF5DataFile::ExtendDataset() {
|
||||
std::lock_guard<std::mutex> lock(*hdf5Lib_);
|
||||
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
hsize_t dims[3];
|
||||
dataSpace_->getSimpleExtentDims(dims);
|
||||
@ -404,16 +397,16 @@ void HDF5DataFile::ExtendDataset() {
|
||||
dataSet_->extend(dims);
|
||||
delete dataSpace_;
|
||||
dataSpace_ = nullptr;
|
||||
dataSpace_ = new ::H5::DataSpace(dataSet_->getSpace());
|
||||
dataSpace_ = new H5::DataSpace(dataSet_->getSpace());
|
||||
|
||||
hsize_t dims_para[1] = {dims[0]};
|
||||
for (unsigned int i = 0; i < dataSetPara_.size(); ++i)
|
||||
dataSetPara_[i]->extend(dims_para);
|
||||
delete dataSpacePara_;
|
||||
dataSpacePara_ = nullptr;
|
||||
dataSpacePara_ = new ::H5::DataSpace(dataSetPara_[0]->getSpace());
|
||||
dataSpacePara_ = new H5::DataSpace(dataSetPara_[0]->getSpace());
|
||||
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
throw RuntimeError("Could not extend dataset in object " +
|
||||
std::to_string(index_));
|
||||
|
@ -14,11 +14,11 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
|
||||
HDF5DataFile(const int index, std::mutex *hdf5Lib);
|
||||
~HDF5DataFile();
|
||||
|
||||
std::array<std::string, 2> GetFileAndDatasetName() const override;
|
||||
std::string GetFileName() const override;
|
||||
uint32_t GetFilesInAcquisition() const override;
|
||||
::H5::DataType GetPDataType() const override;
|
||||
H5::DataType GetPDataType() const override;
|
||||
std::vector<std::string> GetParameterNames() const override;
|
||||
std::vector<::H5::DataType> GetParameterDataTypes() const override;
|
||||
std::vector<H5::DataType> GetParameterDataTypes() const override;
|
||||
|
||||
void CloseFile() override;
|
||||
|
||||
@ -45,17 +45,17 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File {
|
||||
|
||||
int index_;
|
||||
std::mutex *hdf5Lib_;
|
||||
::H5::H5File *fd_{nullptr};
|
||||
H5::H5File *fd_{nullptr};
|
||||
std::string fileName_;
|
||||
std::string dataSetName_;
|
||||
::H5::DataSpace *dataSpace_{nullptr};
|
||||
::H5::DataSet *dataSet_{nullptr};
|
||||
::H5::DataType dataType_{::H5::PredType::STD_U16LE};
|
||||
H5::DataSpace *dataSpace_{nullptr};
|
||||
H5::DataSet *dataSet_{nullptr};
|
||||
H5::DataType dataType_{H5::PredType::STD_U16LE};
|
||||
|
||||
::H5::DataSpace *dataSpacePara_{nullptr};
|
||||
std::vector<::H5::DataSet *> dataSetPara_{nullptr};
|
||||
H5::DataSpace *dataSpacePara_{nullptr};
|
||||
std::vector<H5::DataSet *> dataSetPara_{nullptr};
|
||||
std::vector<std::string> parameterNames_;
|
||||
std::vector<::H5::DataType> parameterDataTypes_;
|
||||
std::vector<H5::DataType> parameterDataTypes_;
|
||||
|
||||
uint32_t subFileIndex_{0};
|
||||
uint32_t numFramesInFile_{0};
|
||||
|
@ -936,11 +936,11 @@ void Implementation::StartMasterWriter() {
|
||||
}
|
||||
#ifdef HDF5C
|
||||
if (fileFormatType == HDF5) {
|
||||
std::array<std::string, 2> virtualFileAndDatasetNames;
|
||||
std::string virtualFileName;
|
||||
// create virtual hdf5 file (if multiple files)
|
||||
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
||||
(numPorts.x * numPorts.y) > 1) {
|
||||
virtualFileAndDatasetNames =
|
||||
virtualFileName =
|
||||
dataProcessor[0]->CreateVirtualFile(
|
||||
filePath, fileName, fileIndex, overwriteEnable,
|
||||
silentMode, modulePos, numUDPInterfaces, framesPerFile,
|
||||
@ -950,8 +950,7 @@ void Implementation::StartMasterWriter() {
|
||||
// link file in master
|
||||
if (masterFileWriteEnable) {
|
||||
dataProcessor[0]->LinkFileInMaster(
|
||||
masterFileName, virtualFileAndDatasetNames[0],
|
||||
virtualFileAndDatasetNames[1], silentMode, &hdf5LibMutex);
|
||||
masterFileName, virtualFileName, silentMode, &hdf5LibMutex);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@ void MasterAttributes::GetBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
WriteCommonHDF5Attributes(fd, group);
|
||||
switch (detType) {
|
||||
case slsDetectorDefs::GOTTHARD:
|
||||
@ -169,40 +169,40 @@ void MasterAttributes::GetFinalBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteCommonHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
// version
|
||||
{
|
||||
double version = BINARY_WRITER_VERSION;
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::Attribute attribute =
|
||||
fd->createAttribute("Version", ::H5::PredType::NATIVE_DOUBLE, dataspace);
|
||||
attribute.write(::H5::PredType::NATIVE_DOUBLE, &version);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::Attribute attribute =
|
||||
fd->createAttribute("Version", H5::PredType::NATIVE_DOUBLE, dataspace);
|
||||
attribute.write(H5::PredType::NATIVE_DOUBLE, &version);
|
||||
}
|
||||
// timestamp
|
||||
{
|
||||
time_t t = std::time(nullptr);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Timestamp", strdatatype, dataspace);
|
||||
strcpy_safe(c, std::string(ctime(&t)));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
// detector type
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Detector Type", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(detType));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
// timing mode
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Timing Mode", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(timingMode));
|
||||
dataset.write(c, strdatatype);
|
||||
@ -210,27 +210,27 @@ void MasterAttributes::WriteCommonHDF5Attributes(::H5::H5File *fd, ::H5::Group *
|
||||
// TODO: make this into an array?
|
||||
// geometry x
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Geometry in x axis",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&geometry.x, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Geometry in x axis",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&geometry.x, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// geometry y
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Geometry in y axis",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&geometry.y, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Geometry in y axis",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&geometry.y, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Image Size
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Image Size", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&imageSize, ::H5::PredType::NATIVE_INT);
|
||||
::H5::DataSpace dataspaceAttr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::Attribute attribute =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Image Size", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&imageSize, H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::Attribute attribute =
|
||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||
strcpy_safe(c, "bytes");
|
||||
attribute.write(strdatatype, c);
|
||||
@ -238,335 +238,335 @@ void MasterAttributes::WriteCommonHDF5Attributes(::H5::H5File *fd, ::H5::Group *
|
||||
// TODO: make this into an array?
|
||||
// npixels x
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Number of pixels in x axis",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&nPixels.x, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Number of pixels in x axis",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&nPixels.x, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// npixels y
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Number of pixels in y axis",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&nPixels.y, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Number of pixels in y axis",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&nPixels.y, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Maximum frames per file
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Maximum frames per file",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&maxFramesPerFile, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Maximum frames per file",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&maxFramesPerFile, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Frame Discard Policy
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset = group->createDataSet("Frame Discard Policy",
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset = group->createDataSet("Frame Discard Policy",
|
||||
strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(frameDiscardMode));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
// Frame Padding
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Frame Padding",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&framePadding, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Frame Padding",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&framePadding, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Scan Parameters
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Scan Parameters", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(scanParams));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
// Total Frames
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Total Frames",
|
||||
::H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&totalFrames, ::H5::PredType::STD_U64LE);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Total Frames",
|
||||
H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&totalFrames, H5::PredType::STD_U64LE);
|
||||
}
|
||||
// Receiver Roi xmin
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("receiver roi xmin",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.xmin, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("receiver roi xmin",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.xmin, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Receiver Roi xmax
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("receiver roi xmax",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.xmax, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("receiver roi xmax",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.xmax, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Receiver Roi ymin
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("receiver roi ymin",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.ymin, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("receiver roi ymin",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.ymin, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Receiver Roi ymax
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("receiver roi ymax",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.ymax, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("receiver roi ymax",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&receiverRoi.ymax, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteFinalHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteFinalHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
// Total Frames in file
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Frames in File",
|
||||
::H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&framesInFile, ::H5::PredType::STD_U64LE);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Frames in File",
|
||||
H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&framesInFile, H5::PredType::STD_U64LE);
|
||||
}
|
||||
// additional json header
|
||||
if (!additionalJsonHeader.empty()) {
|
||||
std::string json = ToString(additionalJsonHeader);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, json.length());
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Additional JSON Header",
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, json.length());
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Additional JSON Header",
|
||||
strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(additionalJsonHeader));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5Exptime(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
void MasterAttributes::WriteHDF5Exptime(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Exposure Time", strdatatype, dataspace);
|
||||
char c[1024]{};
|
||||
strcpy_safe(c, ToString(exptime));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5Period(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
void MasterAttributes::WriteHDF5Period(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Acquisition Period", strdatatype, dataspace);
|
||||
char c[1024]{};
|
||||
strcpy_safe(c, ToString(period));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5DynamicRange(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Dynamic Range", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&dynamicRange, ::H5::PredType::NATIVE_INT);
|
||||
::H5::DataSpace dataspaceAttr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::Attribute attribute =
|
||||
void MasterAttributes::WriteHDF5DynamicRange(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Dynamic Range", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&dynamicRange, H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::Attribute attribute =
|
||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||
char c[1024] = "bits";
|
||||
attribute.write(strdatatype, c);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5TenGiga(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Ten Giga Enable",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&tenGiga, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5TenGiga(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Ten Giga Enable",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&tenGiga, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5ROI(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5ROI(H5::H5File *fd, H5::Group *group) {
|
||||
// Roi xmin
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("roi xmin", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&detectorRoi.xmin, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("roi xmin", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&detectorRoi.xmin, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
// Roi xmax
|
||||
{
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("roi xmax", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&detectorRoi.xmax, ::H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("roi xmax", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&detectorRoi.xmax, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5NumUDPInterfaces(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Number of UDP Interfaces",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&numUDPInterfaces, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5NumUDPInterfaces(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Number of UDP Interfaces",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&numUDPInterfaces, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5ReadNRows(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Number of rows", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&readNRows, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5ReadNRows(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Number of rows", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&readNRows, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5ThresholdEnergy(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5ThresholdEnergy(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Threshold Energy",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&thresholdEnergyeV, ::H5::PredType::NATIVE_INT);
|
||||
::H5::DataSpace dataspaceAttr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::Attribute attribute =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Threshold Energy",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&thresholdEnergyeV, H5::PredType::NATIVE_INT);
|
||||
H5::DataSpace dataspaceAttr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::Attribute attribute =
|
||||
dataset.createAttribute("Unit", strdatatype, dataspaceAttr);
|
||||
strcpy_safe(c, "eV");
|
||||
attribute.write(strdatatype, c);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5ThresholdEnergies(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5ThresholdEnergies(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 1024);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 1024);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Threshold Energies", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(thresholdAllEnergyeV));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5SubExpTime(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5SubExpTime(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Sub Exposure Time", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(subExptime));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5SubPeriod(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5SubPeriod(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Sub Period", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(subPeriod));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5SubQuad(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Quad", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&quad, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5SubQuad(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Quad", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&quad, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5RateCorrections(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5RateCorrections(H5::H5File *fd, H5::Group *group) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 1024);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 1024);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Rate Corrections", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(ratecorr));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5CounterMask(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Counter Mask", ::H5::PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&counterMask, ::H5::PredType::STD_U32LE);
|
||||
void MasterAttributes::WriteHDF5CounterMask(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Counter Mask", H5::PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&counterMask, H5::PredType::STD_U32LE);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5ExptimeArray(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5ExptimeArray(H5::H5File *fd, H5::Group *group) {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Exposure Time1", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(exptimeArray[i]));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5GateDelayArray(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteHDF5GateDelayArray(H5::H5File *fd, H5::Group *group) {
|
||||
for (int i = 0; i != 3; ++i) {
|
||||
char c[1024]{};
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Gate Delay1", strdatatype, dataspace);
|
||||
strcpy_safe(c, ToString(gateDelayArray[i]));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5Gates(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Gates", ::H5::PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&gates, ::H5::PredType::STD_U32LE);
|
||||
void MasterAttributes::WriteHDF5Gates(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Gates", H5::PredType::STD_U32LE, dataspace);
|
||||
dataset.write(&gates, H5::PredType::STD_U32LE);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5BurstMode(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::StrType strdatatype(::H5::PredType::C_S1, 256);
|
||||
::H5::DataSet dataset =
|
||||
void MasterAttributes::WriteHDF5BurstMode(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::StrType strdatatype(H5::PredType::C_S1, 256);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Burst Mode", strdatatype, dataspace);
|
||||
char c[1024]{};
|
||||
strcpy_safe(c, ToString(burstMode));
|
||||
dataset.write(c, strdatatype);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5AdcMask(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("ADC Mask", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&adcmask, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5AdcMask(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("ADC Mask", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&adcmask, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5AnalogFlag(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Analog Flag", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&analog, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5AnalogFlag(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Analog Flag", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&analog, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5AnalogSamples(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Analog Samples", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&analogSamples, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5AnalogSamples(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Analog Samples", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&analogSamples, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5DigitalFlag(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Digital Flag", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&digital, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5DigitalFlag(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Digital Flag", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&digital, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5DigitalSamples(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Digital Samples",
|
||||
::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&digitalSamples, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5DigitalSamples(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Digital Samples",
|
||||
H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&digitalSamples, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5DbitOffset(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset =
|
||||
group->createDataSet("Dbit Offset", ::H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&dbitoffset, ::H5::PredType::NATIVE_INT);
|
||||
void MasterAttributes::WriteHDF5DbitOffset(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset =
|
||||
group->createDataSet("Dbit Offset", H5::PredType::NATIVE_INT, dataspace);
|
||||
dataset.write(&dbitoffset, H5::PredType::NATIVE_INT);
|
||||
}
|
||||
|
||||
void MasterAttributes::WriteHDF5DbitList(::H5::H5File *fd, ::H5::Group *group) {
|
||||
::H5::DataSpace dataspace = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::DataSet dataset = group->createDataSet("Dbit Bitset List",
|
||||
::H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&dbitlist, ::H5::PredType::STD_U64LE);
|
||||
void MasterAttributes::WriteHDF5DbitList(H5::H5File *fd, H5::Group *group) {
|
||||
H5::DataSpace dataspace = H5::DataSpace(H5S_SCALAR);
|
||||
H5::DataSet dataset = group->createDataSet("Dbit Bitset List",
|
||||
H5::PredType::STD_U64LE, dataspace);
|
||||
dataset.write(&dbitlist, H5::PredType::STD_U64LE);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -586,7 +586,7 @@ void MasterAttributes::GetGotthardBinaryAttributes(
|
||||
};
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteGotthardHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteGotthardHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5ROI(fd, group);
|
||||
@ -606,7 +606,7 @@ void MasterAttributes::GetJungfrauBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteJungfrauHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteJungfrauHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5NumUDPInterfaces(fd, group);
|
||||
@ -639,7 +639,7 @@ void MasterAttributes::GetEigerBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteEigerHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteEigerHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
@ -678,7 +678,7 @@ void MasterAttributes::GetMythen3BinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteMythen3HDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteMythen3HDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5DynamicRange(fd, group);
|
||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
@ -701,7 +701,7 @@ void MasterAttributes::GetGotthard2BinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteGotthard2HDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteGotthard2HDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5BurstMode(fd, group);
|
||||
@ -723,7 +723,7 @@ void MasterAttributes::GetMoenchBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteMoenchHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteMoenchHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||
@ -757,7 +757,7 @@ void MasterAttributes::GetCtbBinaryAttributes(
|
||||
}
|
||||
|
||||
#ifdef HDF5C
|
||||
void MasterAttributes::WriteCtbHDF5Attributes(::H5::H5File *fd, ::H5::Group *group) {
|
||||
void MasterAttributes::WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group) {
|
||||
MasterAttributes::WriteHDF5Exptime(fd, group);
|
||||
MasterAttributes::WriteHDF5Period(fd, group);
|
||||
MasterAttributes::WriteHDF5TenGiga(fd, group);
|
||||
|
@ -71,7 +71,7 @@ class MasterAttributes {
|
||||
void
|
||||
GetBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetCommonBinaryAttributes(
|
||||
@ -79,75 +79,75 @@ class MasterAttributes {
|
||||
void GetFinalBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteCommonHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteFinalHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5Exptime(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5Period(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5DynamicRange(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5TenGiga(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5ROI(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5NumUDPInterfaces(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5ReadNRows(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5ThresholdEnergy(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5ThresholdEnergies(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5SubExpTime(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5SubPeriod(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5SubQuad(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5RateCorrections(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5CounterMask(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5ExptimeArray(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5GateDelayArray(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5Gates(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5BurstMode(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5AdcMask(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5AnalogFlag(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5AnalogSamples(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5DigitalFlag(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5DigitalSamples(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5DbitOffset(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteHDF5DbitList(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteCommonHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
void WriteFinalHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5Exptime(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5Period(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5DynamicRange(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5TenGiga(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5ROI(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5NumUDPInterfaces(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5ReadNRows(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5ThresholdEnergy(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5ThresholdEnergies(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5SubExpTime(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5SubPeriod(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5SubQuad(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5RateCorrections(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5CounterMask(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5ExptimeArray(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5GateDelayArray(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5Gates(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5BurstMode(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5AdcMask(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5AnalogFlag(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5AnalogSamples(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5DigitalFlag(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5DigitalSamples(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5DbitOffset(H5::H5File *fd, H5::Group *group);
|
||||
void WriteHDF5DbitList(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetGotthardBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteGotthardHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteGotthardHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetJungfrauBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteJungfrauHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteJungfrauHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetEigerBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteEigerHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteEigerHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetMythen3BinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteMythen3HDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteMythen3HDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetGotthard2BinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteGotthard2HDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteGotthard2HDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void GetMoenchBinaryAttributes(
|
||||
rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteMoenchHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteMoenchHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
|
||||
void
|
||||
GetCtbBinaryAttributes(rapidjson::PrettyWriter<rapidjson::StringBuffer> *w);
|
||||
#ifdef HDF5C
|
||||
void WriteCtbHDF5Attributes(::H5::H5File *fd, ::H5::Group *group);
|
||||
void WriteCtbHDF5Attributes(H5::H5File *fd, H5::Group *group);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -49,30 +49,29 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
|
||||
#ifdef HDF5C
|
||||
void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||
std::string &dataFilename,
|
||||
std::string &dataSetname,
|
||||
std::vector<std::string> parameterNames,
|
||||
const bool silentMode, std::mutex *hdf5LibMutex) {
|
||||
|
||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||
std::unique_ptr<::H5::H5File> fd{nullptr};
|
||||
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
::H5::FileAccPropList flist;
|
||||
H5::FileAccPropList flist;
|
||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
|
||||
// open master file
|
||||
::H5::H5File masterfd(masterFileName.c_str(), H5F_ACC_RDWR,
|
||||
::H5::FileCreatPropList::DEFAULT, flist);
|
||||
H5::H5File masterfd(masterFileName.c_str(), H5F_ACC_RDWR,
|
||||
H5::FileCreatPropList::DEFAULT, flist);
|
||||
|
||||
// open data file
|
||||
fd = make_unique<::H5::H5File>(dataFilename.c_str(), H5F_ACC_RDONLY,
|
||||
::H5::FileCreatPropList::DEFAULT, flist);
|
||||
fd = make_unique<H5::H5File>(dataFilename.c_str(), H5F_ACC_RDONLY,
|
||||
H5::FileCreatPropList::DEFAULT, flist);
|
||||
|
||||
// create link for data dataset
|
||||
::H5::DataSet dset = fd->openDataSet(dataSetname.c_str());
|
||||
std::string linkname = std::string("/entry/data/") + dataSetname;
|
||||
if (H5Lcreate_external(dataFilename.c_str(), dataSetname.c_str(),
|
||||
H5::DataSet dset = fd->openDataSet(DATASET_NAME);
|
||||
std::string linkname = std::string("/entry/data/") + std::string(DATASET_NAME);
|
||||
if (H5Lcreate_external(dataFilename.c_str(), DATASET_NAME,
|
||||
masterfd.getLocId(), linkname.c_str(),
|
||||
H5P_DEFAULT, H5P_DEFAULT) < 0) {
|
||||
throw RuntimeError(
|
||||
@ -81,7 +80,7 @@ void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||
|
||||
// create link for parameter datasets
|
||||
for (unsigned int i = 0; i < parameterNames.size(); ++i) {
|
||||
::H5::DataSet pDset = fd->openDataSet(parameterNames[i].c_str());
|
||||
H5::DataSet pDset = fd->openDataSet(parameterNames[i].c_str());
|
||||
linkname = std::string("/entry/data/") + parameterNames[i];
|
||||
if (H5Lcreate_external(dataFilename.c_str(),
|
||||
parameterNames[i].c_str(),
|
||||
@ -93,7 +92,7 @@ void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||
}
|
||||
fd->close();
|
||||
masterfd.close();
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
if (fd != nullptr)
|
||||
fd->close();
|
||||
@ -118,38 +117,38 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
||||
|
||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||
|
||||
std::unique_ptr<::H5::H5File> fd{nullptr};
|
||||
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
::H5::FileAccPropList flist;
|
||||
H5::FileAccPropList flist;
|
||||
flist.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
|
||||
unsigned int createFlags = H5F_ACC_EXCL;
|
||||
if (overWriteEnable) {
|
||||
createFlags = H5F_ACC_TRUNC;
|
||||
}
|
||||
fd = make_unique<::H5::H5File>(fileName.c_str(), createFlags,
|
||||
::H5::FileCreatPropList::DEFAULT, flist);
|
||||
fd = make_unique<H5::H5File>(fileName.c_str(), createFlags,
|
||||
H5::FileCreatPropList::DEFAULT, flist);
|
||||
|
||||
// attributes - version
|
||||
double dValue = HDF5_WRITER_VERSION;
|
||||
::H5::DataSpace dataspace_attr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::Attribute attribute = fd->createAttribute(
|
||||
"version", ::H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(::H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::Attribute attribute = fd->createAttribute(
|
||||
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
|
||||
// Create a group in the file
|
||||
::H5::Group group1(fd->createGroup("entry"));
|
||||
::H5::Group group2(group1.createGroup("data"));
|
||||
::H5::Group group3(group1.createGroup("instrument"));
|
||||
::H5::Group group4(group3.createGroup("beam"));
|
||||
::H5::Group group5(group3.createGroup("detector"));
|
||||
::H5::Group group6(group1.createGroup("sample"));
|
||||
H5::Group group1(fd->createGroup("entry"));
|
||||
H5::Group group2(group1.createGroup("data"));
|
||||
H5::Group group3(group1.createGroup("instrument"));
|
||||
H5::Group group4(group3.createGroup("beam"));
|
||||
H5::Group group5(group3.createGroup("detector"));
|
||||
H5::Group group6(group1.createGroup("sample"));
|
||||
|
||||
attr->WriteHDF5Attributes(fd.get(), &group5);
|
||||
fd->close();
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
if (fd != nullptr)
|
||||
fd->close();
|
||||
@ -162,16 +161,16 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
||||
return fileName;
|
||||
}
|
||||
|
||||
std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
std::string CreateVirtualHDF5File(
|
||||
const std::string &filePath, const std::string &fileNamePrefix,
|
||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||
const int modulePos, const int numUnitsPerReadout,
|
||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
||||
const uint32_t maxFramesPerFile,
|
||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
||||
const int numModX, const int numModY, const ::H5::DataType dataType,
|
||||
const int numModX, const int numModY, const H5::DataType dataType,
|
||||
const std::vector<std::string> parameterNames,
|
||||
const std::vector<::H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||
const std::vector<H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||
bool gotthard25um) {
|
||||
|
||||
// virtual file name
|
||||
@ -180,8 +179,6 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
<< "_" << fileIndex << ".h5";
|
||||
std::string fileName = osfn.str();
|
||||
|
||||
std::string dataSetName = "data";
|
||||
|
||||
unsigned int paraSize = parameterNames.size();
|
||||
uint64_t numModZ = numModX;
|
||||
uint32_t nDimy = nPixelsY;
|
||||
@ -189,42 +186,42 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
|
||||
std::lock_guard<std::mutex> lock(*hdf5LibMutex);
|
||||
|
||||
std::unique_ptr<::H5::H5File> fd{nullptr};
|
||||
std::unique_ptr<H5::H5File> fd{nullptr};
|
||||
try {
|
||||
::H5::Exception::dontPrint(); // to handle errors
|
||||
H5::Exception::dontPrint(); // to handle errors
|
||||
|
||||
// file
|
||||
::H5::FileAccPropList fapl;
|
||||
H5::FileAccPropList fapl;
|
||||
fapl.setFcloseDegree(H5F_CLOSE_STRONG);
|
||||
if (!overWriteEnable)
|
||||
fd = make_unique<::H5::H5File>(fileName.c_str(), H5F_ACC_EXCL,
|
||||
::H5::FileCreatPropList::DEFAULT, fapl);
|
||||
fd = make_unique<H5::H5File>(fileName.c_str(), H5F_ACC_EXCL,
|
||||
H5::FileCreatPropList::DEFAULT, fapl);
|
||||
else
|
||||
fd = make_unique<::H5::H5File>(fileName.c_str(), H5F_ACC_TRUNC,
|
||||
::H5::FileCreatPropList::DEFAULT, fapl);
|
||||
fd = make_unique<H5::H5File>(fileName.c_str(), H5F_ACC_TRUNC,
|
||||
H5::FileCreatPropList::DEFAULT, fapl);
|
||||
|
||||
// attributes - version
|
||||
double dValue = HDF5_WRITER_VERSION;
|
||||
::H5::DataSpace dataspace_attr = ::H5::DataSpace(H5S_SCALAR);
|
||||
::H5::Attribute attribute = fd->createAttribute(
|
||||
"version", ::H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(::H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
H5::DataSpace dataspace_attr = H5::DataSpace(H5S_SCALAR);
|
||||
H5::Attribute attribute = fd->createAttribute(
|
||||
"version", H5::PredType::NATIVE_DOUBLE, dataspace_attr);
|
||||
attribute.write(H5::PredType::NATIVE_DOUBLE, &dValue);
|
||||
|
||||
// virtual dataspace
|
||||
hsize_t vdsDims[3] = {numImagesCaught, numModY * nDimy,
|
||||
numModZ * nDimz};
|
||||
::H5::DataSpace vdsDataSpace(3, vdsDims, nullptr);
|
||||
H5::DataSpace vdsDataSpace(3, vdsDims, nullptr);
|
||||
hsize_t vdsDimsPara[2] = {numImagesCaught,
|
||||
(unsigned int)numModY * numModZ};
|
||||
::H5::DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr);
|
||||
H5::DataSpace vdsDataSpacePara(2, vdsDimsPara, nullptr);
|
||||
|
||||
// property list (fill value and datatype)
|
||||
int fill_value = -1;
|
||||
::H5::DSetCreatPropList plist;
|
||||
H5::DSetCreatPropList plist;
|
||||
plist.setFillValue(dataType, &fill_value);
|
||||
|
||||
// property list for parameters (datatype)
|
||||
std::vector<::H5::DSetCreatPropList> plistPara(paraSize);
|
||||
std::vector<H5::DSetCreatPropList> plistPara(paraSize);
|
||||
|
||||
// hyperslab (files)
|
||||
int numFiles = numImagesCaught / maxFramesPerFile;
|
||||
@ -286,24 +283,17 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
p + 1, srcFileName.length() - p));
|
||||
}
|
||||
|
||||
// source dataset name
|
||||
std::ostringstream osfn;
|
||||
osfn << "/data";
|
||||
if (numImages > 1)
|
||||
osfn << "_f" << std::setfill('0') << std::setw(12) << iFile;
|
||||
std::string srcDatasetName = osfn.str();
|
||||
|
||||
// source dataspace
|
||||
hsize_t srcDims[3] = {nDimx, nDimy, nDimz};
|
||||
hsize_t srcDimsMax[3] = {H5S_UNLIMITED, nDimy, nDimz};
|
||||
::H5::DataSpace srcDataSpace(3, srcDims, srcDimsMax);
|
||||
H5::DataSpace srcDataSpace(3, srcDims, srcDimsMax);
|
||||
hsize_t srcDimsPara[1] = {nDimx};
|
||||
hsize_t srcDimsMaxPara[1] = {H5S_UNLIMITED};
|
||||
::H5::DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara);
|
||||
H5::DataSpace srcDataSpacePara(1, srcDimsPara, srcDimsMaxPara);
|
||||
|
||||
// mapping of property list
|
||||
plist.setVirtual(vdsDataSpace, relative_srcFileName.c_str(),
|
||||
srcDatasetName.c_str(), srcDataSpace);
|
||||
DATASET_NAME, srcDataSpace);
|
||||
for (unsigned int p = 0; p < paraSize; ++p) {
|
||||
plistPara[p].setVirtual(
|
||||
vdsDataSpacePara, relative_srcFileName.c_str(),
|
||||
@ -325,17 +315,17 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
framesSaved += nDimx;
|
||||
}
|
||||
// datasets
|
||||
::H5::DataSet vdsDataSet(fd->createDataSet(dataSetName.c_str(), dataType,
|
||||
H5::DataSet vdsDataSet(fd->createDataSet(DATASET_NAME, dataType,
|
||||
vdsDataSpace, plist));
|
||||
|
||||
for (unsigned int p = 0; p < paraSize; ++p) {
|
||||
::H5::DataSet vdsDataSetPara(fd->createDataSet(
|
||||
H5::DataSet vdsDataSetPara(fd->createDataSet(
|
||||
parameterNames[p].c_str(), parameterDataTypes[p],
|
||||
vdsDataSpacePara, plistPara[p]));
|
||||
}
|
||||
|
||||
fd->close();
|
||||
} catch (const ::H5::Exception &error) {
|
||||
} catch (const H5::Exception &error) {
|
||||
error.printErrorStack();
|
||||
if (fd) {
|
||||
fd->close();
|
||||
@ -346,7 +336,7 @@ std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
if (!silentMode) {
|
||||
LOG(logINFO) << "Virtual File: " << fileName;
|
||||
}
|
||||
return std::array<std::string, 2>{fileName, dataSetName};
|
||||
return fileName;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -23,7 +23,6 @@ std::string CreateMasterBinaryFile(const std::string &filePath,
|
||||
#ifdef HDF5C
|
||||
void LinkHDF5FileInMaster(std::string &masterFileName,
|
||||
std::string &dataFilename,
|
||||
std::string &dataSetname,
|
||||
std::vector<std::string> parameterNames,
|
||||
const bool silentMode, std::mutex *hdf5LibMutex);
|
||||
|
||||
@ -34,16 +33,16 @@ std::string CreateMasterHDF5File(const std::string &filePath,
|
||||
const bool silentMode, MasterAttributes *attr,
|
||||
std::mutex *hdf5LibMutex);
|
||||
|
||||
std::array<std::string, 2> CreateVirtualHDF5File(
|
||||
std::string CreateVirtualHDF5File(
|
||||
const std::string &filePath, const std::string &fileNamePrefix,
|
||||
const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode,
|
||||
const int modulePos, const int numUnitsPerReadout,
|
||||
const uint32_t maxFramesPerFile, const uint64_t numImages,
|
||||
const uint32_t maxFramesPerFile,
|
||||
const uint32_t nPixelsX, const uint32_t nPixelsY,
|
||||
const uint32_t dynamicRange, const uint64_t numImagesCaught,
|
||||
const int numModX, const int numModY, const ::H5::DataType dataType,
|
||||
const int numModX, const int numModY, const H5::DataType dataType,
|
||||
const std::vector<std::string> parameterNames,
|
||||
const std::vector<::H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||
const std::vector<H5::DataType> parameterDataTypes, std::mutex *hdf5LibMutex,
|
||||
bool gotthard25um);
|
||||
#endif
|
||||
} // namespace masterFileUtility
|
||||
|
@ -57,4 +57,7 @@ namespace sls {
|
||||
#define TCP_PRIORITY (10)
|
||||
|
||||
|
||||
#ifdef HDF5C
|
||||
#define DATASET_NAME "/data"
|
||||
#endif
|
||||
} // namespace sls
|
||||
|
Loading…
x
Reference in New Issue
Block a user