Skip to content

Commit

Permalink
refs #7082. Port to new api.
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenArnold committed May 14, 2013
1 parent 3e6f9d7 commit 0ebca5d
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Code/Mantid/Framework/PythonAPI/PythonAlgorithms/MergeCalFiles.py
Expand Up @@ -4,7 +4,8 @@
*WIKI*"""

from MantidFramework import *
from mantid.api import *
from mantid.kernel import *

class MergeCalFiles(PythonAlgorithm):

Expand All @@ -17,22 +18,22 @@ def name(self):

def PyInit(self):
self.setWikiSummary("Combines the data from two [[CalFile| Cal Files]].")
self.declareFileProperty("UpdateFile","", FileAction.Load, ['cal'],Description="The cal file containing the updates to merge into another file.")
self.declareFileProperty("MasterFile","", FileAction.Load, ['cal'],Description="The master file to be altered, the file must be sorted by UDET")
self.declareFileProperty("OutputFile","", FileAction.Save, ['cal'],Description="The file to contain the results")
self.declareProperty(FileProperty("UpdateFile","", FileAction.Load, ['cal']), doc="The cal file containing the updates to merge into another file.")
self.declareProperty(FileProperty("MasterFile","", FileAction.Load, ['cal']), doc="The master file to be altered, the file must be sorted by UDET")
self.declareProperty(FileProperty("OutputFile","", FileAction.Save, ['cal']), doc="The file to contain the results")

self.declareProperty("MergeOffsets", False, Description="If True, the offsets from file1 will be merged to the master file. Default: False")
self.declareProperty("MergeSelections", False, Description="If True, the selections from file1 will be merged to the master file. Default: False")
self.declareProperty("MergeGroups", False, Description="If True, the Groups from file1 will be merged to the master file. Default: False")
self.declareProperty("MergeOffsets", False, doc="If True, the offsets from file1 will be merged to the master file. Default: False")
self.declareProperty("MergeSelections", False, doc="If True, the selections from file1 will be merged to the master file. Default: False")
self.declareProperty("MergeGroups", False, doc="If True, the Groups from file1 will be merged to the master file. Default: False")

def PyExec(self):
#extract settings
mergeOffsets = self.getProperty("MergeOffsets")
mergeSelections = self.getProperty("MergeSelections")
mergeGroups = self.getProperty("MergeGroups")
updateFileName = self.getProperty("UpdateFile")
masterFileName = self.getProperty("MasterFile")
outputFileName = self.getProperty("OutputFile")
updateFileName = self.getPropertyValue("UpdateFile")
masterFileName = self.getPropertyValue("MasterFile")
outputFileName = self.getPropertyValue("OutputFile")

if (mergeOffsets == False) and (mergeSelections == False) and (mergeGroups == False):
raise RuntimeError('Nothing set to merge, please set one of the properties to merge, otherwise I have nothing to do')
Expand Down Expand Up @@ -137,5 +138,4 @@ def FormatLine(self,number,UDET,offset,select,group):
return line

#############################################################################################

mtd.registerPyAlgorithm(MergeCalFiles())
AlgorithmFactory.subscribe(MergeCalFiles())

0 comments on commit 0ebca5d

Please sign in to comment.