Changeset 062c56d in sasmodels


Ignore:
Timestamp:
Nov 24, 2015 1:41:47 PM (9 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:
b514adf
Parents:
5753e4e
git-author:
Paul Kienzle <pkienzle@…> (11/24/15 13:38:56)
git-committer:
Paul Kienzle <pkienzle@…> (11/24/15 13:41:47)
Message:

allow negative I(q) in models

Location:
sasmodels
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernel_template.c

    r6ee9d39 r062c56d  
    125125    if (weight > cutoff) { 
    126126      const double scattering = Iq(qi, IQ_PARAMETERS); 
    127       if (scattering >= 0.0) { // scattering cannot be negative 
     127      //if (scattering >= 0.0) { // scattering cannot be negative 
    128128        ret += weight*scattering; 
    129129        norm += weight; 
     
    133133        norm_vol += vol_weight; 
    134134      #endif 
    135       } 
     135      //} 
    136136    //else { printf("exclude qx,qy,I:%%g,%%g,%%g\n",qi,scattering); } 
    137137    } 
     
    198198 
    199199      const double scattering = Iqxy(qxi, qyi, IQXY_PARAMETERS); 
    200       if (scattering >= 0.0) { // scattering cannot be negative 
     200      //if (scattering >= 0.0) { // scattering cannot be negative 
    201201        // TODO: use correct angle for spherical correction 
    202202        // Definition of theta and phi are probably reversed relative to the 
     
    219219      #endif 
    220220        norm_vol += vol_weight; 
    221       } 
     221      //} 
    222222      //else { printf("exclude qx,qy,I:%%g,%%g,%%g\n",qi,scattering); } 
    223223    } 
  • sasmodels/kernelpy.py

    r750ffa5 r062c56d  
    211211        if w > cutoff: 
    212212            I = form(*args) 
    213             positive = (I >= 0.0) 
     213            #positive = (I >= 0.0) 
    214214 
    215215            # Note: can precompute spherical correction if theta_index is not 
     
    219219                                    if theta_index >= 0 else 1.0) 
    220220            #spherical_correction = 1.0 
    221             ret += w * I * spherical_correction * positive 
    222             norm += w * positive 
     221            ret += w * I * spherical_correction #* positive 
     222            norm += w #* positive 
    223223 
    224224            # Volume normalization. 
     
    230230                vol_args = [args[index] for index in vol_index] 
    231231                vol_weight = np.prod(weight[vol_weight_index]) 
    232                 vol += vol_weight * form_volume(*vol_args) * positive 
    233                 vol_norm += vol_weight * positive 
     232                vol += vol_weight * form_volume(*vol_args) #* positive 
     233                vol_norm += vol_weight #* positive 
    234234 
    235235    positive = (vol * vol_norm != 0.0) 
Note: See TracChangeset for help on using the changeset viewer.