/**Convert a binned workspace to point data * * @param workspace :: The input workspace * @return the converted workspace containing point data */ MatrixWorkspace_sptr SplineInterpolation::convertBinnedData(MatrixWorkspace_sptr workspace) const { if (workspace->isHistogramData()) { const size_t histNo = workspace->getNumberHistograms(); const size_t size = workspace->y(0).size(); // make a new workspace for the point data MatrixWorkspace_sptr pointWorkspace = WorkspaceFactory::Instance().create(workspace, histNo, size, size); // loop over each histogram for (size_t i = 0; i < histNo; ++i) { const auto &xValues = workspace->x(i); pointWorkspace->setSharedY(i, workspace->sharedY(i)); auto &newXValues = pointWorkspace->mutableX(i); // set x values to be average of bin bounds for (size_t j = 0; j < size; ++j) { newXValues[j] = (xValues[j] + xValues[j + 1]) / 2; } } return pointWorkspace; } return workspace; }