Changes between Initial Version and Version 1 of Ticket #1121, comment 1


Ignore:
Timestamp:
Jul 5, 2018 7:33:12 PM (6 years ago)
Author:
pkienzle
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1121, comment 1

    initial v1  
    55# integrate over polydispersity in shape 
    66F1 = F2 = 0 
    7 F_norm = 0 
     7total_weight = total_volume = 0 
    88for wk, pk in distribution: 
    99    # integrate over angles with u = cos(theta) substitution and z = 2*u - 1  
     
    1717 
    1818    # accumulate 1D patterns over polydispersity 
    19     if sasfit: 
    20         F1 += wk * F1k 
    21         F2 += wk * F2k  
    22         F_norm += wk 
    23     elif sasview or yun: 
    24         F1 += wk * volume * F1k/volume 
    25         F2 += wk * volume * F2k/volume 
    26         F_norm += wk * volume 
     19    F1 += wk * F1k 
     20    F2 += wk * F2k  
     21    total_weight += wk 
     22    total_volume += wk * volume 
    2723 
    28 F1 = F1/F_norm 
    29 F2 = F2/F_norm 
     24F1 = F1/total_weight 
     25F2 = F2/total_weight 
    3026Sq = S(q) 
    3127beta = F1**2/F2 
     28Sq_eff = 1 + beta * (Sq - 1) 
     29average_volume = total_volume/total_weight 
    3230 
    3331if sasfit: 
    34     Sq_eff = 1 + beta * (Sq - 1) 
    3532    Pq = F2 
    3633elif sasview: 
    37     Sq_eff = undefined 
    38     Pq = F2*1e-4*volfraction 
     34    Pq = F2/average_volume*1e-4*volfraction 
    3935elif yun: 
    40     Sq_eff = 1 + F_norm*beta * (Sq - 1) 
    41     Pq = F2/volume 
     36    Pq = F2/average_volume*1e8*volfraction  # slds not scaled by 1e-6 
    4237 
    4338Iq = Pq*Sq 
     
    4742The match to sasfit is not very good (in the order of 1% relative error), but probably good enough that we know what calculation is being performed even though we are using different numeric procedures to perform it. 
    4843 
    49 Still haven't seen Yun's results for gaussian dispersion of radii; may need to adapt the algorithm a bit once these are available. 
    50