Changeset 1e96a66 in sasview for calculatorview/test
- Timestamp:
- Dec 7, 2010 5:43:12 PM (14 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:
- 1aaa579
- Parents:
- a1f2002
- Location:
- calculatorview/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/test/utest_gui_sld.py
r66bfacf r1e96a66 92 92 self.sld_frame.panel.wavelength_ctl.SetValue("") 93 93 self.sld_frame.panel.ProcessEvent(clickEvent) 94 bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 94 cp_bkg = self.sld_frame.panel.compound_ctl.GetBackgroundColour() 95 self.assert_(cp_bkg.GetAsString() == 'white') 96 ds_bkg = self.sld_frame.panel.density_ctl.GetBackgroundColour() 97 self.assert_(ds_bkg.GetAsString() == 'white') 98 wv_bkg = self.sld_frame.panel.wavelength_ctl.GetBackgroundColour() 95 99 value = self.sld_frame.panel.wavelength_ctl.GetValue() 96 self.assert_( bkg.GetAsString() == 'white')100 self.assert_(wv_bkg.GetAsString() == 'white') 97 101 self.assert_(float(value) == WAVELENGTH) 102 sld_real = self.sld_frame.panel.neutron_sld_real_ctl.GetValue() 103 sld_im = self.sld_frame.panel.neutron_sld_im_ctl.GetValue() 104 mo_real = self.sld_frame.panel.mo_ka_sld_real_ctl.GetValue() 105 mo_im = self.sld_frame.panel.mo_ka_sld_im_ctl.GetValue() 106 cu_real = self.sld_frame.panel.cu_ka_sld_real_ctl.GetValue() 107 cu_im = self.sld_frame.panel.cu_ka_sld_im_ctl.GetValue() 108 abs = self.sld_frame.panel.neutron_abs_ctl.GetValue() 109 incoh = self.sld_frame.panel.neutron_inc_ctl.GetValue() 110 length = self.sld_frame.panel.neutron_length_ctl.GetValue() 111 112 self.assertAlmostEquals(float(sld_real), 1.04e-6, 1) 113 self.assertAlmostEquals(float(sld_im), -1.5e-7, 1) 114 #test absorption value 115 self.assertAlmostEquals(float(abs) , 0.0741, 2) 116 self.assertAlmostEquals(float(incoh), 5.62, 2) 117 #Test length 118 self.assertAlmostEquals(float(length), 0.1755, 2) 119 #test Cu sld 120 self.assertAlmostEquals(float(cu_real), 9.46e-6, 1) 121 self.assertAlmostEquals(float(cu_im), 3.01e-8) 122 # test Mo sld 123 self.assertAlmostEquals(float(mo_real), 9.43e-6) 124 self.assertAlmostEquals(float(mo_im), 5.65e-7, 1) 98 125 #compute invariant with all correct inputs value 99 126 self.sld_frame.panel.compound_ctl.SetValue("H2O") -
calculatorview/test/utest_sld.py
r66bfacf r1e96a66 46 46 (sld_real,sld_im,sld_inc), (coh,abs,incoh), length = neutron_scattering(self.compound, 47 47 density=self.density, wavelength=self.wavelength) 48 cu_re el, cu_im = calculate_xray_sld(element="Cu", density=self.density,48 cu_real, cu_im = calculate_xray_sld(element="Cu", density=self.density, 49 49 molecule_formula=self.sld_formula) 50 mo_re el, mo_im = calculate_xray_sld(element="Mo", density=self.density,50 mo_real, mo_im = calculate_xray_sld(element="Mo", density=self.density, 51 51 molecule_formula=self.sld_formula) 52 52 #test sld … … 59 59 self.assertAlmostEquals(length, 0.1755, 3) 60 60 #test Cu sld 61 self.assertAlmostEquals(cu_re el * _SCALE, 9.46e-6, 1)61 self.assertAlmostEquals(cu_real * _SCALE, 9.46e-6, 1) 62 62 self.assertAlmostEquals(cu_im * _SCALE, 3.01e-8) 63 63 # test Mo sld 64 self.assertAlmostEquals(mo_re el * _SCALE, 9.43e-6)64 self.assertAlmostEquals(mo_real * _SCALE, 9.43e-6) 65 65 self.assertAlmostEquals(mo_im * _SCALE, 5.65e-7,1) 66 66 … … 86 86 (sld_real,sld_im,sld_inc), (coh,abs,incoh), length = neutron_scattering(self.compound, 87 87 density=self.density, wavelength=self.wavelength) 88 cu_re el, cu_im = calculate_xray_sld(element="Cu", density=self.density,88 cu_real, cu_im = calculate_xray_sld(element="Cu", density=self.density, 89 89 molecule_formula=self.sld_formula) 90 mo_re el, mo_im = calculate_xray_sld(element="Mo", density=self.density,90 mo_real, mo_im = calculate_xray_sld(element="Mo", density=self.density, 91 91 molecule_formula=self.sld_formula) 92 92 #test sld … … 99 99 self.assertAlmostEquals(length, 1.549, 3) 100 100 #test Cu sld 101 self.assertAlmostEquals(cu_re el * _SCALE, 9.36e-6, 1)101 self.assertAlmostEquals(cu_real * _SCALE, 9.36e-6, 1) 102 102 self.assertAlmostEquals(cu_im * _SCALE, 2.98e-8) 103 103 # test Mo sld 104 self.assertAlmostEquals(mo_re el * _SCALE, 9.33e-6)104 self.assertAlmostEquals(mo_real * _SCALE, 9.33e-6) 105 105 self.assertAlmostEquals(mo_im * _SCALE, 5.59e-9,1) 106 106 … … 126 126 (sld_real,sld_im,sld_inc), (coh,abs,incoh), length = neutron_scattering(self.compound, 127 127 density=self.density, wavelength=self.wavelength) 128 cu_re el, cu_im = calculate_xray_sld(element="Cu", density=self.density,128 cu_real, cu_im = calculate_xray_sld(element="Cu", density=self.density, 129 129 molecule_formula=self.sld_formula) 130 mo_re el, mo_im = calculate_xray_sld(element="Mo", density=self.density,130 mo_real, mo_im = calculate_xray_sld(element="Mo", density=self.density, 131 131 molecule_formula=self.sld_formula) 132 132 #test sld … … 139 139 self.assertAlmostEquals(length, 0.005551, 4) 140 140 #test Cu sld 141 self.assertAlmostEquals(cu_re el * _SCALE, 2.89e-5, 1)141 self.assertAlmostEquals(cu_real * _SCALE, 2.89e-5, 1) 142 142 self.assertAlmostEquals(cu_im * _SCALE, 2.81e-6) 143 143 # test Mo sld 144 self.assertAlmostEquals(mo_re el * _SCALE, 2.84e-5, 1)144 self.assertAlmostEquals(mo_real * _SCALE, 2.84e-5, 1) 145 145 self.assertAlmostEquals(mo_im * _SCALE, 7.26e-7,1) 146 146
Note: See TracChangeset
for help on using the changeset viewer.