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 36948c92 was
ae3ce4e,
checked in by Mathieu Doucet <doucetm@…>, 17 years ago
|
Moving sansmodels to trunk
|
-
Property mode set to
100644
|
File size:
961 bytes
|
Rev | Line | |
---|
[ae3ce4e] | 1 | try: |
---|
| 2 | from sans.models.prototypes.SimSphereF import SimSphereF |
---|
| 3 | except: |
---|
| 4 | print "This test uses the prototypes module." |
---|
| 5 | from sans.models.SphereModel import SphereModel |
---|
| 6 | import math, time |
---|
| 7 | |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | sim = SimSphereF() |
---|
| 11 | sph = SphereModel() |
---|
| 12 | |
---|
| 13 | sim.setParam('radius', 60) |
---|
| 14 | sim.setParam('npoints', 50000) |
---|
| 15 | |
---|
| 16 | sph.setParam('radius', 60) |
---|
| 17 | sph.setParam('scale', 1) |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | f = open('sim_iq.txt', 'w') |
---|
| 21 | f.write("<q> <ana> <sim> <err>\n") |
---|
| 22 | |
---|
| 23 | t_0 = time.time() |
---|
| 24 | |
---|
| 25 | #for i in range(60): |
---|
| 26 | for 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 | |
---|
| 40 | t_f = time.time() |
---|
| 41 | print "Time = ", t_f-t_0 |
---|
| 42 | f.close() |
---|
| 43 | |
---|
Note: See
TracBrowser
for help on using the repository browser.