Changeset b09095a in sasview for test/sascalculator
- Timestamp:
- Apr 17, 2017 12:39:50 PM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 8ffafd1
- Parents:
- beba407
- git-author:
- Jeff Krzywon <krzywon@…> (04/17/17 12:39:50)
- git-committer:
- krzywon <krzywon@…> (04/17/17 12:39:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sascalculator/test/utest_slit_length_calculator.py
r959eb01 rb09095a 5 5 import unittest 6 6 from sas.sascalc.dataloader.readers.ascii_reader import Reader 7 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator as calculator 7 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator \ 8 as calculator 8 9 9 import os.path10 10 11 class slit_calculator(unittest.TestCase):11 class SlitCalculator(unittest.TestCase): 12 12 13 13 def setUp(self): … … 15 15 self.reader = Reader() 16 16 17 def test_slit length_calculation(self):17 def test_slit_length_calculation(self): 18 18 """ 19 19 Test slit_length_calculator" 20 20 """ 21 f = self.reader.read("beam profile.DAT") 21 list = self.reader.read("beam profile.DAT") 22 self.assertTrue(len(list) == 1) 23 f = list[0] 22 24 cal = calculator() 23 25 cal.set_data(f.x,f.y) 24 slit length = cal.calculate_slit_length()26 slit_length = cal.calculate_slit_length() 25 27 26 28 # The value "5.5858" was obtained by manual calculation. 27 29 # It turns out our slit length is FWHM/2 28 self.assertAlmostEqual(slit length,5.5858/2, 3)30 self.assertAlmostEqual(slit_length, 5.5858/2, 3) 29 31 30 32
Note: See TracChangeset
for help on using the changeset viewer.