Skip to content
Snippets Groups Projects
Commit 4d7a4fc5 authored by John Hill's avatar John Hill
Browse files

Refs #10397 making changes to handle rotation file

parent 779a5433
No related branches found
No related tags found
No related merge requests found
......@@ -102,7 +102,9 @@ namespace DataHandling
void loadChunkOfBinsFromFile(Mantid::API::MatrixWorkspace_sptr &workspace, vector<vector<double> > &yVals, vector<vector<double> > &eVals, void *&bufferAny, MantidVecPtr &x, size_t spetraCount, int bitsPerPixel, size_t binChunkStartIndex);
/// Initialises a workspace with IDF and fills it with data
API::MatrixWorkspace_sptr initAndPopulateHistogramWorkspace();
/// Creates a comma separated string of rotations from a file
std::string ReadRotations(std::string rotFilePath, size_t fileCount);
vector<FITSInfo> m_allHeaderInfo;
size_t m_binChunkSize;
static const int FIXED_HEADER_SIZE = 2880;
......
......@@ -181,10 +181,11 @@ namespace Mantid
// If it's loading into a single file, perform a cursory check on file extensions only.
if((ifl && ifl->loadMutipleAsOne()) || (iflNexus && iflNexus->loadMutipleAsOne()))
{
if( fileNames[i].substr(fileNames[i].find_last_of(".")) != ext)
// Currently disabled for ticket http://trac.mantidproject.org/mantid/ticket/10397 : should be put back in when completing 10231
/* if( fileNames[i].substr(fileNames[i].find_last_of(".")) != ext)
{
throw std::runtime_error("Cannot load multiple files when more than one Loader is needed.");
}
}*/
}
else
{
......@@ -320,6 +321,7 @@ namespace Mantid
exts.push_back(".h5");
exts.push_back(".hd5");
exts.push_back(".sqw");
exts.push_back(".fits");
declareProperty(new MultipleFileProperty("Filename", exts),
"The name of the file(s) to read, including the full or relative "
......
This diff is collapsed.
......@@ -152,19 +152,38 @@ namespace Mantid
// TODO: Write sample info
// name
std::vector<double> rotationAngles(dims_array[0]);
// Initialise rotations - if unknown, fill with equal steps from 0 to 180 over all frames.
// TODO: collect and use actual rotation values
double step = static_cast<double>(180/dims_array[0]);
rotationAngles[0] = step;
std::vector<double> rotationAngles(dims_array[0]);
std::string rotValues = "";
std::vector<std::string> rotSplit;
for(auto it = rotationAngles.begin()+1; it != rotationAngles.end(); ++it)
if(inputWS->run().hasProperty("Rotations"))
{
rotValues = inputWS->run().getLogData("Rotations")->value();
boost::split(rotSplit, rotValues, boost::is_any_of(","));
}
if(rotSplit.size() == static_cast<size_t>(dims_array[0]) )
{
for(size_t i=0; i<rotSplit.size(); i++)
{
rotationAngles[i] = boost::lexical_cast<double>(rotSplit[i]);
}
}
else
{
*it = (*(it-1)) + step;
// Make some fake values
g_log.notice("Unable to find a correctly formatted rotation angle file with same entry count as input; creating fake values.");
double step = static_cast<double>(180/dims_array[0]);
rotationAngles[0] = step;
for(auto it = rotationAngles.begin()+1; it != rotationAngles.end(); ++it)
{
*it = (*(it-1)) + step;
}
}
nxFile.writeData("rotation_angle", rotationAngles);
nxFile.writeData("rotation_angle", rotationAngles);
// Create a link object for rotation_angle to use later
nxFile.openData("rotation_angle");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment