Пример #1
0
 def test_crop_before(self):
     x = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
     y = [0, 0, 10, 30, 2000, 80, 50, 40, 30, 25, 30]
     test_ws = mantid.CreateWorkspace(DataX=x, DataY=y)
     test_ws = focus._crop_spline_to_percent_of_max(test_ws, test_ws)
     y_compare = [30, 2000, 80, 50, 40, 30, 25, 30]
     result = test_ws.readY(0)
     for compare, val in zip(y_compare, result):
         self.assertEqual(compare, val)
 def test_crop_subrange(self):
     x = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
     y = [1, 50, 2000, 30, 20, 80, 50, 40, 20, 10, 1]
     test_ws = mantid.CreateWorkspace(DataX=x, DataY=y)
     # search from 0 to 30 x for max
     test_ws = focus._crop_spline_to_percent_of_max(test_ws, test_ws, test_ws, 0, 30)
     y_compare = [50, 2000, 30, 20, 80, 50, 40]
     result = test_ws.readY(0)
     for compare, val in zip(y_compare, result):
         self.assertEqual(compare, val)
Пример #3
0
 def test_crop_subrange(self):
     x = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
     y = [1, 50, 2000, 30, 20, 80, 50, 40, 20, 10, 1]
     test_ws = mantid.CreateWorkspace(DataX=x, DataY=y)
     # search from 0 to 30 x for max
     test_ws = focus._crop_spline_to_percent_of_max(test_ws, test_ws,
                                                    test_ws, 0, 30)
     y_compare = [50, 2000, 30, 20, 80, 50, 40]
     result = test_ws.readY(0)
     for compare, val in zip(y_compare, result):
         self.assertEqual(compare, val)