source: sasview/sansmodels/src/sans/models/test/prototypes/test_sphere_iq.py @ ae3ce4e

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since ae3ce4e was ae3ce4e, checked in by Mathieu Doucet <doucetm@…>, 17 years ago

Moving sansmodels to trunk

  • Property mode set to 100644
File size: 961 bytes
Line 
1try:
2    from sans.models.prototypes.SimSphereF import SimSphereF
3except:
4    print "This test uses the prototypes module."
5from sans.models.SphereModel import SphereModel
6import math, time
7
8
9
10sim = SimSphereF()
11sph = SphereModel()
12
13sim.setParam('radius', 60)
14sim.setParam('npoints', 50000)
15
16sph.setParam('radius', 60)
17sph.setParam('scale', 1)
18
19
20f = open('sim_iq.txt', 'w')
21f.write("<q>  <ana>  <sim> <err>\n")
22
23t_0 = time.time()
24
25#for i in range(60):
26for i in range(100):
27    #q = 0.01 * (i+1) /3.0
28    q = 0.05 + 0.20*(i+1) /100
29   
30    ana_value = sph.run([q,0])
31    sim_value = sim.run([q,0])
32#    ana_value = sph.run(q)
33#    sim_value = sim.run(q)
34    ratio = 0
35    if sim_value>0:
36        ratio = sim_value/ana_value
37    print q, ana_value, sim_value, ratio
38    f.write("%10g %10g %10g %10g\n" % (q, ana_value, sim_value, (sim_value-ana_value)/ana_value))
39
40t_f = time.time()
41print "Time = ", t_f-t_0
42f.close()
43
Note: See TracBrowser for help on using the repository browser.