Skip to content

Commit 56df85b

Browse files
committed
Refs #35 Added backwards compatibility for sets module
1 parent c416301 commit 56df85b

File tree

6 files changed

+7
-9
lines changed

6 files changed

+7
-9
lines changed

simulation/src/beamline/assemblemodel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def lowTResolution(model, simulated, resolution, convolved, expdata=None,
400400
if __name__ == "__main__":
401401
import argparse
402402
import sys
403-
from sets import Set
403+
if sys.version_info < (2,6): from sets import Set as set
404404
from mantidhelper.algorithm import getDictFromArgparse
405405
p=argparse.ArgumentParser(description='Provider for services involving convolution of simulated S(Q,E) with a model beamline. Available services are: lowTresolution, modelBEC, modelB_EC_C, modelB_freeE_C.')
406406
p.add_argument('service', help='name of the service to invoke')

simulation/src/beamline/convolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def convolution(simulated, resolution, expdata, convolved, dak=None, norm2one=Fa
104104
if __name__ == "__main__":
105105
import argparse
106106
import sys
107-
from sets import Set
107+
if sys.version_info < (2,6): from sets import Set as set
108108
p=argparse.ArgumentParser(description='Provider for services involving convolution of simulated S(Q,E) with a model beamline. Available services are: lowTresolution.')
109109
p.add_argument('service', help='name of the service to invoke')
110110
p.add_argument('-explain', action='store_true', help='print message explaining the arguments to pass for the particular service')

simulation/src/beamline/initparams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def modelB_freeE_C(modeltpl, elastic, convolved, expdata, initparfile=None):
7979

8080
import argparse
8181
import sys
82-
from sets import Set
82+
if sys.version_info < (2,6): from sets import Set as set
8383

8484
p=argparse.ArgumentParser(description='Provider for services involving initialization of model beamline parameters. Available models are: modelB_freeE_C')
8585
p.add_argument('service', help='name of the service to invoke')

simulation/src/beamline/interpX.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def itp_simple(workspace,shift,newWorkspace=None):
3434
import argparse
3535
import sys
3636
import re
37-
from sets import Set
37+
if sys.version_info < (2,6): from sets import Set as set
3838
p=argparse.ArgumentParser(description='Provider for services involving shift of calculated S(Q,E) model Available services are: itp_simple')
3939
p.add_argument('service', help='name of the service to invoke')
4040
p.add_argument('-explain', action='store_true', help='print message explaining the arguments to pass for the particular service')

simulation/src/beamline/resolution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def elasticLineLowTemp(insqe, outres=None):
3333
if __name__ == "__main__":
3434
import argparse
3535
import sys
36-
from sets import Set
36+
if sys.version_info < (2,6): from sets import Set as set
3737
p=argparse.ArgumentParser(description='Provider for services involving the production of a resolution function. Available services are: elasticLineLowTemp')
3838
p.add_argument('service', help='name of the service to invoke')
3939
p.add_argument('-explain', action='store_true', help='print message explaining the arguments to pass for the particular service')

simulation/src/scattering/sassenatasks.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ def sortQvectors(hdfile, args):
141141
Returns:
142142
ws1 (mantid group workspace) Workspace holding the contents of the HDF5 file
143143
"""
144-
trace()
145144
from sys import version_info # python version
146145
if version_info < (2,7):
147146
ws1 = mti.LoadSassena( Filename=hdfile, **args )
@@ -357,7 +356,6 @@ def genSQE(hdfname,nxsname,wsname=None,indexes=[],rebinQ=None,scale=1.0, **kwarg
357356
wsname=wsname or splitext(basename(nxsname))[0]
358357
algs_opt=locals()['kwargs']
359358
hdfs=hdfname.split() # list of sassena output files serving as input
360-
#trace()
361359
ws = sortQvectors( hdfs[0], findopts('LoadSassena',algs_opt) )
362360

363361
if len(hdfs)>1: # add remaining sassena output files
@@ -395,11 +393,11 @@ def genSQE(hdfname,nxsname,wsname=None,indexes=[],rebinQ=None,scale=1.0, **kwarg
395393
import argparse
396394
import sys
397395
from mantidhelper.algorithm import getDictFromArgparse
398-
from sets import Set
396+
if sys.version_info < (2,6): from sets import Set as set
399397
p=argparse.ArgumentParser(description='Provider for services involving Sassena IO. Available services are: genSQE, SassenaVersion ')
400398
p.add_argument('service', help='name of the function in this module to call')
401399
p.add_argument('-explain', action='store_true', help='print message explaining the arguments to pass for the particular service')
402-
if Set(['-h', '-help', '--help']).intersection(Set(sys.argv)): args=p.parse_args() # check if help message is requested
400+
if set(['-h', '-help', '--help']).intersection(set(sys.argv)): args=p.parse_args() # check if help message is requested
403401
if 'SassenaVersion' in sys.argv:
404402
p.description='Loads Sassena output (HDF5 file) and adds Sassena Version number.' # update help message
405403
for action in p._actions:

0 commit comments

Comments
 (0)