//----------------------------------------------------------------------------- /// @return the label for the X axis QString MantidQwtIMDWorkspaceData::getXAxisLabel() const { QString xLabel; if ( m_originalWorkspace.expired() ) return xLabel; // Empty string if (m_currentPlotAxis >= 0) { // One of the dimensions of the original IMDDimension_const_sptr dim = m_originalWorkspace.lock()->getDimension(m_currentPlotAxis); xLabel = QString::fromStdString(dim->getName()) + " (" + QString::fromStdWString(dim->getUnits().utf8()) + ")"; } else { // Distance // Distance, or not set. xLabel = "Distance from start"; // if (dimX->getUnits() == dimY->getUnits()) // xLabel += " (" + dimX->getUnits() + ")"; // else // xLabel += " (undefined units)"; // break; } return xLabel; }
/* Extract the geometry and function information This implementation is an override of the base-class method, which deals with the more common event based route. However the SQW files will provide complete dimensions with ranges already set. Less work needs to be done here than for event workspaces where the extents of each dimension need to be individually extracted. @param eventWs : event workspace to get the information from. */ void SQWLoadingPresenter::extractMetadata(Mantid::API::IMDEventWorkspace_sptr eventWs) { using namespace Mantid::Geometry; MDGeometryBuilderXML<NoDimensionPolicy> refresh; this->xmlBuilder= refresh; //Reassign. std::vector<IMDDimension_sptr> dimensions; size_t nDimensions = eventWs->getNumDims(); for (size_t d=0; d<nDimensions; d++) { IMDDimension_const_sptr inDim = eventWs->getDimension(d); //Copy the dimension, but set the ID and name to be the same. This is an assumption in bintohistoworkspace. MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getUnits(), inDim->getMinimum(), inDim->getMaximum(), size_t(10))); dimensions.push_back(dim); } //Configuring the geometry xml builder allows the object panel associated with this reader to later //determine how to display all geometry related properties. if(nDimensions > 0) { this->xmlBuilder.addXDimension( dimensions[0] ); } if(nDimensions > 1) { this->xmlBuilder.addYDimension( dimensions[1] ); } if(nDimensions > 2) { this->xmlBuilder.addZDimension( dimensions[2] ); } if(nDimensions > 3) { this->tDimension = dimensions[3]; this->xmlBuilder.addTDimension(this->tDimension); } this->m_isSetup = true; }
/* Extract the geometry and function information @param histoWs : histogram workspace to get the information from. */ void MDHWLoadingPresenter::extractMetadata(Mantid::API::IMDHistoWorkspace_sptr histoWs) { using namespace Mantid::Geometry; MDGeometryBuilderXML<NoDimensionPolicy> refresh; xmlBuilder= refresh; //Reassign. std::vector<IMDDimension_sptr> dimensions; size_t nDimensions = histoWs->getNumDims(); for (size_t d=0; d<nDimensions; d++) { IMDDimension_const_sptr inDim = histoWs->getDimension(d); coord_t min = inDim->getMinimum(); coord_t max = inDim->getMaximum(); if (min > max) { min = 0.0; max = 1.0; } //std::cout << "dim " << d << min << " to " << max << std::endl; axisLabels.push_back(makeAxisTitle(inDim)); MDHistoDimension_sptr dim(new MDHistoDimension(inDim->getName(), inDim->getName(), inDim->getUnits(), min, max, inDim->getNBins())); dimensions.push_back(dim); } //Configuring the geometry xml builder allows the object panel associated with this reader to later //determine how to display all geometry related properties. if(nDimensions > 0) { xmlBuilder.addXDimension( dimensions[0] ); } if(nDimensions > 1) { xmlBuilder.addYDimension( dimensions[1] ); } if(nDimensions > 2) { xmlBuilder.addZDimension( dimensions[2] ); } if(nDimensions > 3) { tDimension = dimensions[3]; xmlBuilder.addTDimension(tDimension); } m_isSetup = true; }