Changeset f4cf580 in sasmodels for sasmodels/gen.py


Ignore:
Timestamp:
Sep 2, 2014 1:15:40 PM (10 years ago)
Author:
Paul Kienzle <pkienzle@…>
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
Message:

resolve remaining differences between sasview and sasmodels

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/gen.py

    r5d4777d rf4cf580  
    352352  const real I = %(fn)s(%(qcall)s, %(pcall)s); 
    353353  if (I>=REAL(0.0)) { // scattering cannot be negative 
    354     ret += weight*I; 
     354    ret += weight*I%(sasview_spherical)s; 
    355355    norm += weight; 
    356356    %(volume_norm)s 
     
    364364SPHERICAL_CORRECTION="""\ 
    365365// 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));\ 
     366real spherical_correction = (Ntheta>1 ? fabs(sin(M_PI_180*theta)) : REAL(1.0));\ 
     367""" 
     368# Use this to reproduce sasview behaviour 
     369SASVIEW_SPHERICAL_CORRECTION="""\ 
     370// Correction factor for spherical integration p(theta) I(q) sin(theta) dtheta 
     371real spherical_correction = (Ntheta>1 ? fabs(cos(M_PI_180*theta))*M_PI_2 : REAL(1.0));\ 
    367372""" 
    368373 
     
    472477    fq_pars = [p[0] for p in info['parameters'][len(COMMON_PARAMETERS):] 
    473478               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: 
    475480        spherical_correction = [indent(SPHERICAL_CORRECTION, depth)] 
    476481        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" 
    477487    else: 
    478488        spherical_correction = [] 
    479489        weights = [p+"_w" for p in pd_pars] 
     490        sasview_spherical = "" 
    480491    subst = { 
    481492        'weight_product': "*".join(weights), 
     
    484495        'qcall': q_pars['qcall'], 
    485496        'pcall': ", ".join(fq_pars), # skip scale and background 
     497        'sasview_spherical': sasview_spherical, 
    486498        } 
    487499    loop_body = [indent(LOOP_BODY%subst, depth)] 
Note: See TracChangeset for help on using the changeset viewer.