Changeset ef908db in sasview for test/sascalculator
- Timestamp:
- Mar 19, 2016 10:42:09 AM (9 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.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 66f21cd
- Parents:
- 05fb3d6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/sascalculator/test/utest_sas_gen.py
rb699768 ref908db 7 7 import unittest 8 8 from sas.sascalc.calculator import sas_gen 9 from sas.models.SphereModel import SphereModel10 9 11 10 import numpy … … 18 17 self.sldloader = sas_gen.SLDReader() 19 18 self.pdbloader = sas_gen.PDBReader() 20 self.omfloader = sas_gen.OMFReader() 21 self.comp = SphereModel() 19 self.omfloader = sas_gen.OMFReader() 22 20 23 21 def test_sldreader(self): … … 53 51 self.assertEqual(output.pos_z[0], 0.0) 54 52 55 """56 def test_slda_and_run(self): # Works when sld reader uses loadtxt57 sld_data = self.sldloader.read("sphere697_r30.sld")58 # Generic computation59 model = sas_gen.GenSAS()60 model.setParam('background', 0.0)61 model.setParam('scale', 1.0)62 model.setParam('Up_frac_in', 0.5)63 model.setParam('Up_frac_out', 0.5)64 model.setParam('Up_theta', 0.0)65 x = numpy.array([0.01])66 y = numpy.array([0.01])67 model.set_sld_data(sld_data)68 out_gen = model.runXY([x, y])69 # Analytic computation70 analy_model = self.comp71 analy_model.setParam('background', 0.0)72 analy_model.setParam('scale', 1.0)73 analy_model.setParam('radius', 30.0)74 analy_model.setParam('sldSolv', 0.0)75 analy_model.setParam('sldSph', 6.97e-06)76 out_analy = analy_model.runXY([0.01, 0.01])77 # Comparison78 self.assertAlmostEqual(out_gen[0], out_analy, 1)79 """80 53 if __name__ == '__main__': 81 54 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.