Skip to content

Commit

Permalink
Re #10532 Formally started to run.
Browse files Browse the repository at this point in the history
system tests are still failing
  • Loading branch information
abuts committed Nov 28, 2014
1 parent 4d4352c commit b7e120f
Show file tree
Hide file tree
Showing 8 changed files with 818 additions and 763 deletions.
6 changes: 3 additions & 3 deletions Code/Mantid/scripts/Inelastic/CommonFunctions.py
Expand Up @@ -29,15 +29,15 @@ def create_resultname(run_number, prefix='', suffix=''):
if type(run_number) == list:
name = create_resultname(run_number[0], prefix, suffix)
elif type(run_number) == int:
name = prefix + str(run_number) + '.spe' + suffix
name = prefix + '{0:0>#8d}.spe{1}'.format(run_number,suffix)
else:
name = os.path.basename(str(run_number))
# Hack any instrument name off the front so the output is the same as if you give it a run number
name = name.lstrip(string.ascii_letters)
if (suffix is None):
name = os.path.splitext(name)[0] + '.spe'
name = prefix + os.path.splitext(name)[0] + '.spe'
else:
name = os.path.splitext(name)[0] + '.spe' + suffix
name = prefix + os.path.splitext(name)[0] + '.spe' + suffix

return name

Expand Down
703 changes: 516 additions & 187 deletions Code/Mantid/scripts/Inelastic/DirectEnergyConversion.py

Large diffs are not rendered by default.

391 changes: 254 additions & 137 deletions Code/Mantid/scripts/Inelastic/DirectPropertyManager.py

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions Code/Mantid/scripts/Inelastic/DirectReductionHelpers.py
@@ -1,3 +1,5 @@
from mantid import config

"""
Set of functions to assist with processing instrument parameters relevant to reduction.
"""
Expand Down
429 changes: 14 additions & 415 deletions Code/Mantid/scripts/Inelastic/dgreduce.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Code/Mantid/scripts/Inelastic/diagnostics.py
Expand Up @@ -67,7 +67,7 @@ def diagnose(white_int, **kwargs):
# Hard mask
hardmask_file = kwargs.get('hard_mask_file', None)
if hardmask_file is not None:
LoadMask(Instrument=kwargs.get('instrument_name',''),InputFile=parser.hard_mask_file,
LoadMask(Instrument=kwargs.get('instr_name',''),InputFile=parser.hard_mask_file,
OutputWorkspace='hard_mask_ws')
MaskDetectors(Workspace=white_int, MaskedWorkspace='hard_mask_ws')
# Find out how many detectors we hard masked
Expand Down
24 changes: 4 additions & 20 deletions Code/Mantid/scripts/test/DgreduceTest.py
Expand Up @@ -17,9 +17,10 @@ def setUp(self):
def tearDown(self):
pass

def test_run_help(self):
self.assertRaises(ValueError,help,'rubbish')
help("monovan_lo_bound")
#TODO: write help
#def test_run_help(self):
# self.assertRaises(ValueError,help,'rubbish')
# help("monovan_lo_bound")
def test_process_legacy_parameters(self):
kw=dict();
kw["hardmaskOnly"]="someFileName"
Expand Down Expand Up @@ -77,23 +78,6 @@ def test_process_leg_par_harmaskPlus(self):
self.assertEqual(params["hard_mask_file"],'SomeFileName');
self.assertEqual(params['use_hard_mask_only'],False)

def test_setup(self):


setup('mari')
Reducer = getReducer()
self.assertTrue(not (Reducer is None))

self.assertEqual(Reducer.instr_name,'MAR')

Reducer.save_format = ''
self.assertTrue(Reducer.save_format is None)

Reducer.save_format = 'none'
self.assertTrue(Reducer.save_format is None)

Reducer.save_format = []
self.assertTrue(Reducer.save_format is None)

def test_setup_empty(self):
# clear up singleton
Expand Down
24 changes: 24 additions & 0 deletions Code/Mantid/scripts/test/DirectEnergyConversionTest.py
Expand Up @@ -136,6 +136,30 @@ def test_do_white_wb(self) :
white_ws = tReducer.do_white(wb_ws, None, None,None)
self.assertTrue(white_ws)

def test_get_abs_normalization_factor(self) :
mono_ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=4, NumEvents=10000,XUnit='DeltaE',XMin=-5,XMax=15,BinWidth=0.1)
LoadInstrument(mono_ws,InstrumentName='MARI')

tReducer = DirectEnergyConversion(mono_ws.getInstrument())
tReducer.prop_man.incident_energy = 5.

(nf1,nf2,nf3,nf4) = tReducer.get_abs_normalization_factor(mono_ws.getName(),5.)
self.assertAlmostEqual(nf1,0.139349147,7)
self.assertAlmostEqual(nf1,nf2)
self.assertAlmostEqual(nf2,nf3)
self.assertAlmostEqual(nf3,nf4)

# check warning. WB spectra with 0 signal indicate troubles.
mono_ws = CreateSampleWorkspace(NumBanks=1, BankPixelWidth=4, NumEvents=10000,XUnit='DeltaE',XMin=-5,XMax=15,BinWidth=0.1)
LoadInstrument(mono_ws,InstrumentName='MARI')
sig = mono_ws.dataY(0);
sig[:]=0;

(nf1,nf2,nf3,nf4) = tReducer.get_abs_normalization_factor(mono_ws.getName(),5.)
self.assertAlmostEqual(nf1,0.139349147,7)
self.assertAlmostEqual(nf1,nf2)
self.assertAlmostEqual(nf2,nf3)
self.assertAlmostEqual(nf3,nf4)



Expand Down

0 comments on commit b7e120f

Please sign in to comment.