Changeset 14a15a3 in sasmodels for sasmodels/kernelpy.py


Ignore:
Timestamp:
Aug 30, 2016 12:09:58 PM (8 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:
f54fb70
Parents:
3cd1001
Message:

treat normalization volume of 0. as 1., which mitigates n_shells=0 problem for spherical sld. Refs #635.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelpy.py

    rbde38b5 r14a15a3  
    187187    n_pars = len(parameters) 
    188188    parameters[:] = values[2:n_pars+2] 
    189     scale, background = values[0], values[1] 
    190189    if call_details.num_active == 0: 
    191         norm = float(form_volume()) 
    192         if norm > 0.0: 
    193             return (scale/norm)*form() + background 
    194         else: 
    195             return np.ones(nq, 'd')*background 
     190        pd_norm = float(form_volume()) 
     191        scale = values[0]/(pd_norm if pd_norm != 0.0 else 1.0) 
     192        background = values[1] 
     193        return scale*form() + background 
    196194 
    197195    pd_value = values[2+n_pars:2+n_pars + call_details.num_weights] 
     
    245243            pd_norm += weight * form_volume() 
    246244 
    247     if pd_norm > 0.0: 
    248         return (scale/pd_norm)*total + background 
    249     else: 
    250         return np.ones(nq, 'd')*background 
     245    scale = values[0]/(pd_norm if pd_norm != 0.0 else 1.0) 
     246    background = values[1] 
     247    return scale*total + background 
    251248 
    252249 
Note: See TracChangeset for help on using the changeset viewer.