Changeset b3f6bc3 in sasmodels for sasmodels/generate.py
- Timestamp:
- Feb 15, 2015 4:07:00 PM (9 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:
- f786ff3
- Parents:
- cb6ecf4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/generate.py
rcb6ecf4 rb3f6bc3 354 354 """ 355 355 356 357 358 ########################################################## 359 # # 360 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # 361 # !! !! # 362 # !! KEEP THIS CODE CONSISTENT WITH PYKERNEL.PY !! # 363 # !! !! # 364 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # 365 # # 366 ########################################################## 367 368 356 369 # Polydispersity loop body. 357 370 # This computes the weight, and if it is sufficient, calls the scattering … … 387 400 # to call the form_volume function from the user supplied kernel, and accumulate 388 401 # a normalized weight. 389 VOLUME_NORM="""const double vol_weight = %( weight)s;390 vol += vol_weight*form_volume(%( pars)s);402 VOLUME_NORM="""const double vol_weight = %(vol_weight)s; 403 vol += vol_weight*form_volume(%(vol_pars)s); 391 404 norm_vol += vol_weight;\ 392 405 """ … … 490 503 if vol_pars: 491 504 subst = { 492 ' weight': "*".join(p+"_w" for p in vol_pars),493 ' pars': ", ".join(vol_pars),505 'vol_weight': "*".join(p+"_w" for p in vol_pars), 506 'vol_pars': ", ".join(vol_pars), 494 507 } 495 508 volume_norm = VOLUME_NORM%subst … … 637 650 } 638 651 source.append(WORK_FUNCTION%subst) 639 kernel_Iq = make_kernel(info, is_2D=False) 640 kernel_Iqxy = make_kernel(info, is_2D=True) 652 kernel_Iq = make_kernel(info, is_2D=False) if not callable(info['Iq']) else "" 653 kernel_Iqxy = make_kernel(info, is_2D=True) if not callable(info['Iqxy']) else "" 641 654 kernel = "\n\n".join([KERNEL_HEADER]+source+[kernel_Iq, kernel_Iqxy]) 642 655 return kernel … … 718 731 def demo_time(): 719 732 import datetime 733 from .models import cylinder 734 toc = lambda: (datetime.datetime.now()-tic).total_seconds() 720 735 tic = datetime.datetime.now() 721 toc = lambda: (datetime.datetime.now()-tic).total_seconds() 722 path = os.path.dirname("__file__") 723 doc, c = make_model(os.path.join(path, "models", "cylinder.c")) 736 source, info = make(cylinder) 724 737 print "time:",toc() 725 738 726 739 def demo(): 727 from os.path import join as joinpath, dirname728 c, info, doc = make_model(joinpath(dirname(__file__), "models", "cylinder.c"))729 #print doc 730 #print c740 from .models import cylinder 741 source, info = make(cylinder) 742 #print doc(cylinder) 743 print source 731 744 732 745 if __name__ == "__main__":
Note: See TracChangeset
for help on using the changeset viewer.