add Red/Green mode handling for NeXus HDF5 IDF V2. See also the musrfit docu.
Build and Deploy Documentation / build-and-deploy (push) Successful in 32s

This commit is contained in:
2026-07-15 07:54:42 +02:00
parent c8b87bb4f7
commit 1f4fa54928
3 changed files with 24 additions and 15 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ if (CMAKE_VERSION GREATER_EQUAL "3.3")
cmake_policy(SET CMP0167 NEW)
endif ()
project(musrfit VERSION 1.11.2 LANGUAGES C CXX)
project(musrfit VERSION 1.11.3 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+6
View File
@@ -12,6 +12,12 @@ or
https://bitbucket.org/muonspin/musrfit
Release of V1.11.3, 2026/07/15
==============================
Add Red/Green mode handling for NeXus, especially HDF5 IDF V2. Offset between the
routed histograms is 10000 (for LEM it is 20).
Release of V1.11.2, 2026/06/27
==============================
+17 -14
View File
@@ -865,7 +865,7 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
// data with its metadata
if (nxs_file->HasDataset("/raw_data_1/instrument/detector_1/counts")) {
int t0_bin{-1}, fgb{-1}, lgb{-1}, noOfHistos{-1}, histoLength{-1};
int t0_bin{-1}, fgb{-1}, lgb{-1}, noOfPeriods{-1}, noOfHistos{-1}, histoLength{-1};
auto count_ds = nxs_file->template GetDataset<int>("/raw_data_1/instrument/detector_1/counts");
auto count = count_ds.GetData();
auto dims = count_ds.GetDimensions();
@@ -873,6 +873,7 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
std::cerr << std::endl << "**ERROR** PNeXus data dimension error! dims.size()=" << dims.size() << ", expecting == 3." << std::endl;
return false;
}
noOfPeriods = dims[0];
noOfHistos = dims[1];
histoLength = dims[2];
// get all necessary attributes
@@ -882,24 +883,26 @@ Bool_t PRunDataHandler::ReadNexusFileIdf2(T& nxs_file)
fgb = std::any_cast<int>(count_ds.GetAttribute("first_good_bin"));
if (count_ds.HasAttribute("last_good_bin"))
lgb = std::any_cast<int>(count_ds.GetAttribute("last_good_bin"));
if (static_cast<int>(count.size()) != noOfHistos*histoLength) {
std::cerr << std::endl << "**ERROR** PNeXus data size error! count.size()=" << count.size() << ", #histos=" << noOfHistos << ", length=" << histoLength << "." << std::endl;
if (static_cast<int>(count.size()) != noOfPeriods*noOfHistos*histoLength) {
std::cerr << std::endl << "**ERROR** PNeXus data size error! count.size()=" << count.size() << ", #periods=" << noOfPeriods << ", #histos=" << noOfHistos << ", length=" << histoLength << "." << std::endl;
return false;
}
// fill dataSet
PDoubleVector data;
for (int i=0; i<noOfHistos; i++) {
dataSet.Clear();
dataSet.SetHistoNo(i+1); // i.e. histo numbers start with 1
dataSet.SetTimeZeroBin(t0_bin);
dataSet.SetFirstGoodBin(fgb);
dataSet.SetLastGoodBin(lgb);
for (int j=0; j<histoLength; j++)
data.push_back(count[i*histoLength+j]);
dataSet.SetData(data);
runData.SetDataSet(dataSet);
data.clear();
for (int i=0; i<noOfPeriods; i++) {
for (int j=0; j<noOfHistos; j++) {
dataSet.Clear();
dataSet.SetHistoNo(i*10000+j+1); // i.e. histo numbers start with 1
dataSet.SetTimeZeroBin(t0_bin);
dataSet.SetFirstGoodBin(fgb);
dataSet.SetLastGoodBin(lgb);
for (int k=0; k<histoLength; k++)
data.push_back(count[i*noOfHistos*histoLength+j*histoLength+k]);
dataSet.SetData(data);
runData.SetDataSet(dataSet);
data.clear();
}
}
// keep run name from the msr-file