Skip to content
Snippets Groups Projects
Commit 8f9facd7 authored by Dan Nixon's avatar Dan Nixon
Browse files

Refactoring in SofQWMoments

Refs #10340
parent 109123fb
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,11 @@
using namespace Mantid::Kernel;
using namespace Mantid::API;
namespace
{
Mantid::Kernel::Logger g_log("GeneratePythonScript");
}
namespace Mantid
{
namespace Algorithms
......@@ -61,6 +66,7 @@ void GeneratePythonScript::exec()
// Get the algorithm histories of the workspace.
const WorkspaceHistory wsHistory = ws->getHistory();
g_log.information() << "Number of history items: " << wsHistory.size() << std::endl;
auto view = wsHistory.createView();
......
# Algorithm to start Bayes programs
from mantid.simpleapi import *
from mantid.api import PythonAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceGroupProperty
from mantid.api import DataProcessorAlgorithm, AlgorithmFactory, MatrixWorkspaceProperty, WorkspaceGroupProperty
from mantid.kernel import Direction
from mantid import logger
import os.path
import numpy as np
class SofQWMoments(PythonAlgorithm):
class SofQWMoments(DataProcessorAlgorithm):
def category(self):
return "Workflow\\MIDAS;PythonAlgorithms"
......@@ -104,9 +104,9 @@ class SofQWMoments(PythonAlgorithm):
AddSampleLog(Workspace=ws_name, LogName="energy_max", LogType="Number", LogText=str(emax))
AddSampleLog(Workspace=ws_name, LogName="scale_factor", LogType="Number", LogText=str(factor))
#group ouput workspace
# Group output workspace
group_workspaces = ','.join([output_workspace+ext for ext in extensions])
GroupWorkspaces(InputWorkspaces=group_workspaces,OutputWorkspace=output_workspace)
GroupWorkspaces(InputWorkspaces=group_workspaces, OutputWorkspace=output_workspace)
if Save:
workdir = getDefaultWorkingDirectory()
......@@ -126,8 +126,8 @@ class SofQWMoments(PythonAlgorithm):
from IndirectImport import import_mantidplot
mp = import_mantidplot()
mp.plotSpectrum(inputWS+'_M0',0)
mp.plotSpectrum([inputWS+'_M2',inputWS+'_M4'],0)
mp.plotSpectrum(inputWS+'_M0', 0)
mp.plotSpectrum([inputWS+'_M2', inputWS+'_M4'], 0)
# Register algorithm with Mantid
AlgorithmFactory.subscribe(SofQWMoments)
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