Skip to content

Commit

Permalink
Fix for SuggestTibCNCS. Refs #10979
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiSavici committed Jan 27, 2015
1 parent 767161d commit 05474b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Expand Up @@ -93,7 +93,7 @@ def PyExec(self):
if itpulse.overlap(Interval(tinf,tinf)):
#if the prompt pulse overlaps with t_inf move the upper part one frame down
intervalList.append(Interval(itpulse.min,tinf))
intervalList.append(Interval(tinf-frame,itpulse.max+tinf-frame))
intervalList.append(Interval(tinf-frame,itpulse.max-frame))
else:
if tinf<itpulse.min:
itpulse=Interval(itpulse.min-frame,itpulse.max-frame)
Expand Down
@@ -1,15 +1,24 @@
import unittest,os
import mantid
import numpy


class SuggestTibCNCSTest(unittest.TestCase):
def test_simple(self):
result=mantid.simpleapi.SuggestTibCNCS(3.)
self.assertAlmostEqual(result[0]*0.1,4491.5,0)
self.assertAlmostEqual(result[1]*0.1,4731.5,0)
result=mantid.simpleapi.SuggestTibCNCS(1.)
self.assertAlmostEqual(result[0]*0.1,9562.1,0)
self.assertAlmostEqual(result[1]*0.1,9902.1,0)
result=mantid.simpleapi.SuggestTibCNCS(3.)
self.assertAlmostEqual(result[0]*0.1,4491.5,0)
self.assertAlmostEqual(result[1]*0.1,4731.5,0)
result=mantid.simpleapi.SuggestTibCNCS(1.)
self.assertAlmostEqual(result[0]*0.1,9562.1,0)
self.assertAlmostEqual(result[1]*0.1,9902.1,0)
result=mantid.simpleapi.SuggestTibCNCS(6.)
self.assertAlmostEqual(result[0]*0.1,2983.3,0)
self.assertAlmostEqual(result[1]*0.1,3323.3,0)

def test_someresult(self):
for en in numpy.arange(1.,30.,0.1):
result=mantid.simpleapi.SuggestTibCNCS(en)
self.assertGreater(result[1]-result[0],1000.)

if __name__=="__main__":
unittest.main()

0 comments on commit 05474b6

Please sign in to comment.