Changeset f4cf580 in sasmodels for sasmodels/gen.py
- Timestamp:
- Sep 2, 2014 1:15:40 PM (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:
- 87985ca
- Parents:
- 5d4777d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/gen.py
r5d4777d rf4cf580 352 352 const real I = %(fn)s(%(qcall)s, %(pcall)s); 353 353 if (I>=REAL(0.0)) { // scattering cannot be negative 354 ret += weight*I ;354 ret += weight*I%(sasview_spherical)s; 355 355 norm += weight; 356 356 %(volume_norm)s … … 364 364 SPHERICAL_CORRECTION="""\ 365 365 // Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta 366 real spherical_correction = (Ntheta>1 ? fabs(cos(M_PI_180*phi)) : REAL(1.0));\ 366 real spherical_correction = (Ntheta>1 ? fabs(sin(M_PI_180*theta)) : REAL(1.0));\ 367 """ 368 # Use this to reproduce sasview behaviour 369 SASVIEW_SPHERICAL_CORRECTION="""\ 370 // Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta 371 real spherical_correction = (Ntheta>1 ? fabs(cos(M_PI_180*theta))*M_PI_2 : REAL(1.0));\ 367 372 """ 368 373 … … 472 477 fq_pars = [p[0] for p in info['parameters'][len(COMMON_PARAMETERS):] 473 478 if p[0] in set(fixed_pars+pd_pars)] 474 if False and " phi" in pd_pars:479 if False and "theta" in pd_pars: 475 480 spherical_correction = [indent(SPHERICAL_CORRECTION, depth)] 476 481 weights = [p+"_w" for p in pd_pars]+['spherical_correction'] 482 sasview_spherical = "" 483 elif "theta" in pd_pars: 484 spherical_correction = [indent(SASVIEW_SPHERICAL_CORRECTION,depth)] 485 weights = [p+"_w" for p in pd_pars] 486 sasview_spherical = "*spherical_correction" 477 487 else: 478 488 spherical_correction = [] 479 489 weights = [p+"_w" for p in pd_pars] 490 sasview_spherical = "" 480 491 subst = { 481 492 'weight_product': "*".join(weights), … … 484 495 'qcall': q_pars['qcall'], 485 496 'pcall': ", ".join(fq_pars), # skip scale and background 497 'sasview_spherical': sasview_spherical, 486 498 } 487 499 loop_body = [indent(LOOP_BODY%subst, depth)]
Note: See TracChangeset
for help on using the changeset viewer.