Changeset 2c74c11 in sasmodels for sasmodels/models/broad_peak.py


Ignore:
Timestamp:
Jul 24, 2016 8:56:45 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:
a4280bd
Parents:
f1765a2
Message:

implicit Iqxy; fix divide by 0 for q=0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/broad_peak.py

    r65279d8 r2c74c11  
    4141""" 
    4242 
    43 from numpy import inf, sqrt 
     43from numpy import inf, errstate 
    4444 
    4545name = "broad_peak" 
     
    8787    :return:               Calculated intensity 
    8888    """ 
    89  
    90     inten = (porod_scale / q ** porod_exp + lorentz_scale 
    91              / (1.0 + (abs(q - peak_pos) * lorentz_length) ** lorentz_exp)) 
     89    z = abs(q - peak_pos) * lorentz_length 
     90    with errstate(divide='ignore'): 
     91        inten = (porod_scale / q ** porod_exp 
     92                 + lorentz_scale / (1 + z ** lorentz_exp)) 
    9293    return inten 
    9394Iq.vectorized = True  # Iq accepts an array of q values 
    94  
    95 def Iqxy(qx, qy, *args): 
    96     """ 
    97     :param qx:   Input q_x-value 
    98     :param qy:   Input q_y-value 
    99     :param args: Remaining arguments 
    100     :return:     2D-Intensity 
    101     """ 
    102     return Iq(sqrt(qx ** 2 + qy ** 2), *args) 
    103 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values 
    10495 
    10596demo = dict(scale=1, background=0, 
Note: See TracChangeset for help on using the changeset viewer.