Changeset 473183c in sasmodels for Models/code_lamellar.py
- Timestamp:
- Jul 24, 2014 9:59:02 AM (10 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- ca6c007
- Parents:
- dbb0048
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Models/code_lamellar.py
rdbb0048 r473183c 61 61 return sum/norm + pars['background'] 62 62 63 def demo():64 65 from time import time66 import matplotlib.pyplot as plt67 68 #create qx and qy evenly spaces69 qx = np.linspace(-.01, .01, 128)70 qy = np.linspace(-.01, .01, 128)71 qx, qy = np.meshgrid(qx, qy)72 73 #saved shape of qx74 r_shape = qx.shape75 76 #reshape for calculation; resize as float3277 qx = qx.flatten()78 qy = qy.flatten()79 80 pars = LamellarParameters(scale=1, bi_thick=100, sld_bi=.291e-6, sld_sol=5.77e-6, background=0)81 t = time()82 result = GpuLamellar(qx, qy)83 result.x = result.lamellar_fit(pars, b_n=35, b_w=.1, sigma=3)84 result.x = np.reshape(result.x, r_shape)85 tt = time()86 87 print("Time taken: %f" % (tt - t))88 89 f = open("r.txt", "w")90 for x in xrange(len(r_shape)):91 f.write(str(result.x[x]))92 f.write("\n")93 94 plt.pcolormesh(np.log10(result.x))95 plt.show()96 97 98 if __name__ == "__main__":99 demo()100 63 101 64 … … 126 89 127 90 128 129 130 131
Note: See TracChangeset
for help on using the changeset viewer.