From 432974f1d7cc39e39c8d9f0a25e944200d878200 Mon Sep 17 00:00:00 2001 From: Arturs Bekasovs Date: Mon, 9 Dec 2013 19:20:50 +0000 Subject: [PATCH] Refs #8550. Removed unused functions. --- .../MantidQtCustomInterfaces/MuonAnalysis.h | 7 - .../CustomInterfaces/src/MuonAnalysis.cpp | 244 ------------------ 2 files changed, 251 deletions(-) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MuonAnalysis.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MuonAnalysis.h index 2522e7a2355e..2d4280b6b208 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MuonAnalysis.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/MuonAnalysis.h @@ -247,9 +247,6 @@ private slots: void createPlotWS(const std::string& groupName, const std::string& inputWS, const std::string& outWS); - /// Apply whatever grouping is specified in GUI tables to workspace - bool applyGroupingToWS( const std::string& inputWS, const std::string& outputWS); - /// Update front void updateFront(); @@ -399,10 +396,6 @@ private slots: /// Get the new plot name QString getNewPlotName(const QString & cropWSfirstPart); - /// set grouping in table from information from nexus raw file - void setGroupingFromNexus(const QString& nexusFile); - - /// title of run std::string m_title; diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp index 27dbed2f6ee3..3dc2213b4db2 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/MuonAnalysis.cpp @@ -2475,89 +2475,6 @@ bool MuonAnalysis::isGroupingSet() return true; } -/** - * Apply whatever grouping is specified in GUI tables to workspace. - */ -bool MuonAnalysis::applyGroupingToWS( const std::string& inputWsName, const std::string& outputWsName) -{ - if (!isGroupingSet() || !AnalysisDataService::Instance().doesExist(inputWsName)) - return false; - - std::string complaint = isGroupingAndDataConsistent(); - if (!( complaint.empty() ) ) - { - if (m_uiForm.frontPlotButton->isEnabled() ) - QMessageBox::warning(this, "MantidPlot - MuonAnalysis", complaint.c_str()); - m_optionTab->noDataAvailable(); - return false; - } - else - { - if (!m_uiForm.frontPlotButton->isEnabled() ) - m_optionTab->nowDataAvailable(); - } - - // If output workspace exists, remove explicitly, so even if something goes wrong - old data - // is not used - if(AnalysisDataService::Instance().doesExist(outputWsName)) - { - // Using DeleteWorkspace algorithm so if outputWs is a group - it is fully removed - Mantid::API::IAlgorithm_sptr rmWs = AlgorithmManager::Instance().create("DeleteWorkspace"); - rmWs->initialize(); - rmWs->setPropertyValue("Workspace", outputWsName); - rmWs->execute(); - } - - Grouping tableGrouping; - parseGroupingTable(m_uiForm, tableGrouping); - - // Retrieve input workspace - Workspace_sptr inputWs = AnalysisDataService::Instance().retrieve(inputWsName); - - Workspace_sptr outputWs; - - try // ... to group - { - // Single workspace - if(MatrixWorkspace_sptr ws = boost::dynamic_pointer_cast(inputWs)) - { - outputWs = groupWorkspace(ws, tableGrouping); - } - // Workspace group - else if(WorkspaceGroup_sptr group = boost::dynamic_pointer_cast(inputWs)) - { - // Create output group - WorkspaceGroup_sptr outputGroup = boost::make_shared(); - - for(size_t i = 0; i < group->size(); i++) - { - if(MatrixWorkspace_sptr member = boost::dynamic_pointer_cast(group->getItem(i))) - { - MatrixWorkspace_sptr groupedMember = groupWorkspace(member, tableGrouping); - - outputGroup->addWorkspace(groupedMember); - } - else - throw std::invalid_argument("Group contains unsupported workspace type"); - } - - outputWs = outputGroup; - } - else - throw std::invalid_argument("Unsupported workspace type"); - } - catch(std::exception& e) - { - m_optionTab->noDataAvailable(); - g_log.error(e.what()); - return false; - } - - AnalysisDataService::Instance().add(outputWsName, outputWs); - - return true; -} - /** * Calculate number of detectors from string of type 1-3, 5, 10-15 * @@ -2767,167 +2684,6 @@ void MuonAnalysis::startUpLook() } } -/** -* set grouping in table from information from nexus raw file -*/ -void MuonAnalysis::setGroupingFromNexus(const QString& nexusFile) -{ - if ( isGroupingSet() ) - return; - - std::string groupedWS = m_workspace_name+"Grouped"; - - // Setup Load Nexus Algorithm - Mantid::API::IAlgorithm_sptr loadMuonAlg = Mantid::API::AlgorithmManager::Instance().create("LoadMuonNexus"); - loadMuonAlg->setPropertyValue("Filename", nexusFile.toStdString()); - loadMuonAlg->setPropertyValue("OutputWorkspace", groupedWS); - loadMuonAlg->setProperty("AutoGroup", true); - if (! (loadMuonAlg->execute() ) ) - { - QMessageBox::warning(this,"Mantid - MuonAnalysis", "Problem when executing LoadMuonNexus algorithm."); - } - - // get hold of a matrix-workspace. If period data assume each period has - // the same grouping - Workspace_sptr ws_ptr = AnalysisDataService::Instance().retrieve(groupedWS); - WorkspaceGroup_sptr wsPeriods = boost::dynamic_pointer_cast(ws_ptr); - MatrixWorkspace_sptr matrix_workspace; - if (wsPeriods) - { - Workspace_sptr ws_ptr1 = AnalysisDataService::Instance().retrieve(groupedWS + "_1"); - matrix_workspace = boost::dynamic_pointer_cast(ws_ptr1); - } - else - { - matrix_workspace = boost::dynamic_pointer_cast(ws_ptr); - } - - // check if there is any grouping in file - bool thereIsGrouping = false; - int numOfHist = static_cast(matrix_workspace->getNumberHistograms()); //Qt has no size_t understanding - for (int wsIndex = 0; wsIndex < numOfHist; wsIndex++) - { - IDetector_const_sptr det; - try // for some bizarry reason when reading EMUautorun_A.tmp this - // underlying nexus file think there are more histogram than there is - // hence the reason for this try/catch here - { - det = matrix_workspace->getDetector(wsIndex); - } - catch (...) - { - break; - } - - if( boost::dynamic_pointer_cast(det) ) - { - // prepare IDs string - - boost::shared_ptr detG = boost::dynamic_pointer_cast(det); - std::vector detIDs = detG->getDetectorIDs(); - if (detIDs.size() > 1) - { - thereIsGrouping = true; - break; - } - } - } - - // if no grouping in nexus then return - if ( thereIsGrouping == false ) - { - return; - } - - // Add info about grouping from Nexus file to group table - for (int wsIndex = 0; wsIndex < numOfHist; wsIndex++) - { - IDetector_const_sptr det = matrix_workspace->getDetector(wsIndex); - - if( boost::dynamic_pointer_cast(det) ) - { - // prepare IDs string - - boost::shared_ptr detG = boost::dynamic_pointer_cast(det); - std::vector detIDs = detG->getDetectorIDs(); - std::stringstream idstr; - int leftInt = detIDs[0]; // meaning left as in the left number of the range 8-18 for instance - int numIDs = static_cast(detIDs.size()); - idstr << detIDs[0]; - for (int i = 1; i < numIDs; i++) - { - if (detIDs[i] != detIDs[i-1]+1 ) - { - if (detIDs[i-1] == leftInt) - { - idstr << ", " << detIDs[i]; - leftInt = detIDs[i]; - } - else - { - idstr << "-" << detIDs[i-1] << ", " << detIDs[i]; - leftInt = detIDs[i]; - } - } - else if ( i == numIDs-1 ) - { - idstr << "-" << detIDs[i]; - } - } - - // prepare group name string - - std::stringstream gName; - gName << wsIndex; - - // create table row - QTableWidgetItem* it = m_uiForm.groupTable->item(wsIndex, 0); - if (it) - it->setText(gName.str().c_str()); - else - { - m_uiForm.groupTable->setItem(wsIndex, 0, new QTableWidgetItem(gName.str().c_str())); - } - - it = m_uiForm.groupTable->item(wsIndex, 1); - if (it) - it->setText(idstr.str().c_str()); - else - m_uiForm.groupTable->setItem(wsIndex, 1, new QTableWidgetItem(idstr.str().c_str())); - } - } // end loop over wsIndex - - // check if exactly two groups added in which case assume these are forward/backward groups - // and automatically then create a pair from which, where the first group is assumed to be - // the forward group - - updatePairTable(); - if ( numGroups() == 2 && numPairs() <= 0 ) - { - QTableWidgetItem* it = m_uiForm.pairTable->item(0, 0); - if (it) - it->setText("pair"); - else - { - m_uiForm.pairTable->setItem(0, 0, new QTableWidgetItem("long")); - } - it = m_uiForm.pairTable->item(0, 3); - if (it) - it->setText("1.0"); - else - { - m_uiForm.pairTable->setItem(0, 3, new QTableWidgetItem("1.0")); - } - updatePairTable(); - updateFrontAndCombo(); - m_uiForm.frontGroupGroupPairComboBox->setCurrentIndex(2); - runFrontGroupGroupPairComboBox(2); - } - updatePairTable(); - updateFrontAndCombo(); -} - - /** * If nothing else work set dummy grouping and display comment to user */