Commit fe5eb775 authored by Karl Palmen's avatar Karl Palmen
Browse files

Now it saves nine columns into Nexus re #4137


Signed-off-by: default avatarKarl Palmen <karl.palmen@stfc.ac.uk>
parent 7b9b114e
......@@ -253,16 +253,109 @@ namespace DataObjects
std::vector<int> detectorID;
std::vector<double> H;
for (size_t i=0; i < peaks.size(); i++)
std::vector<double> K;
std::vector<double> L;
std::vector<double> intensity;
std::vector<double> sigmaIntensity;
std::vector<double> binCount;
std::vector<double> initialEnergy;
std::vector<double> finalEnergy;
// etc.
for (size_t i=0; i < peaks.size(); i++)
{
Peak p = peaks[i];
detectorID.push_back( p.getDetectorID() );
H.push_back( p.getH() );
detectorID.push_back( p.getDetectorID() );
H.push_back( p.getH() );
K.push_back( p.getK() );
L.push_back( p.getL() );
intensity.push_back( p.getIntensity() );
sigmaIntensity.push_back( p.getSigmaIntensity() );
binCount.push_back( p.getBinCount() );
initialEnergy.push_back( p.getInitialEnergy() );
finalEnergy.push_back( p.getFinalEnergy() );
// etc.
}
file->writeData("detector_id", detectorID);
file->writeData("H", H);
// Start Peaks Workspace
file->makeGroup("peaks workspace", "NXentry", true);
// Detectors column
file->writeData("column_1", detectorID);
file->openData("column_1");
file->putAttr("name", "Dectector ID");
file->putAttr("interpret_as","An integer");
file->putAttr("units","Not known");
file->closeData();
// H column
file->writeData("column_2", H);
file->openData("column_2");
file->putAttr("name", "H");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// K column
file->writeData("column_3", K);
file->openData("column_3");
file->putAttr("name", "K");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// L column
file->writeData("column_4", L);
file->openData("column_4");
file->putAttr("name", "L");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Intensity column
file->writeData("column_5", intensity);
file->openData("column_5");
file->putAttr("name", "Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Sigma Intensity column
file->writeData("column_6", sigmaIntensity);
file->openData("column_6");
file->putAttr("name", "Sigma Intensity");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Bin Count column
file->writeData("column_7", binCount);
file->openData("column_7");
file->putAttr("name", "Bin Count");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Initial Energy column
file->writeData("column_8", initialEnergy );
file->openData("column_8");
file->putAttr("name", "Initial Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// Final Energy column
file->writeData("column_9", finalEnergy );
file->openData("column_9");
file->putAttr("name", "Final Energy");
file->putAttr("interpret_as","A double");
file->putAttr("units","Not known"); // Units may need changing when known
file->closeData();
// etc.
file->closeGroup(); // end of peaks workpace
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment