- Timestamp:
- Dec 13, 2016 8:00:06 AM (8 years ago)
- Branches:
- 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
- Children:
- debf5c3
- Parents:
- 0532d7c1
- Location:
- src/sas/qtgui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/SlitSizeCalculator.py
r0532d7c1 r3a0ce4f 8 8 9 9 import os 10 import sys 10 11 11 12 class SlitSizeCalculator(QtGui.QDialog, Ui_SlitSizeCalculator): … … 92 93 raise RuntimeError, msg 93 94 94 if isinstance(data, Data2D) :95 if isinstance(data, Data2D) or data.__class__.__name__ == 'Data2D': 95 96 msg = "Slit Length cannot be computed for 2D Data" 96 97 raise Exception, msg -
src/sas/qtgui/UnitTesting/SlitSizeCalculatorTest.py
r0532d7c1 r3a0ce4f 10 10 11 11 from SlitSizeCalculator import SlitSizeCalculator 12 from sas.sascalc.calculator.slit_length_calculator import SlitlengthCalculator as calculator13 12 from sas.sascalc.dataloader.loader import Loader 14 13 … … 39 38 self.widget.onHelp() 40 39 41 def testC omputeSlit(self):40 def testCalculateSlitSize(self): 42 41 """ User entered compound calculations and subsequent reset""" 43 42 … … 45 44 loader = Loader() 46 45 data = loader.load(filename) 47 # Push Compute with the left mouse button48 cal = calculator()49 cal.set_data(x = data.x, y = data.y)50 slitlength = cal.calculate_slit_length()51 46 47 self.widget.calculateSlitSize(data) 52 48 # The value "5.5858" was obtained by manual calculation. 53 49 # It turns out our slit length is FWHM/2 54 self.assertAlmostEqual(slitlength,5.5858/2, 3) 50 self.assertAlmostEqual(float(self.widget.slit_length_out.text()), 5.5858/2, 3) 51 52 def testCalculateSlitSize2D(self): 53 """ User entered compound calculations and subsequent reset""" 54 55 #TODO: Test for 2D and check if exception is being raised 56 filename = "beam_profile.DAT" 57 loader = Loader() 58 data = loader.load(filename) 59 60 self.widget.calculateSlitSize(data) 61 # The value "5.5858" was obtained by manual calculation. 62 # It turns out our slit length is FWHM/2 63 self.assertAlmostEqual(float(self.widget.slit_length_out.text()), 5.5858/2, 3) 64 65 # def testDataEntryNumbers(self): 66 # """ User entered compound calculations and subsequent reset""" 67 # 68 # self.widget.data_file.clear() 69 # self.widget.data_file.insert("beam profile.DAT") 70 # # 71 # # Push Compute with the left mouse button 72 # computeButton = self.widget.computeButton 73 # QTest.mouseClick(computeButton, Qt.LeftButton) 74 # self.assertEqual(self.widget.lengthscale_out.text(), '6.283') 55 75 56 76 def testBrowseButton(self):
Note: See TracChangeset
for help on using the changeset viewer.