Changeset e45a565 in sasview for sansmodels


Ignore:
Timestamp:
Apr 28, 2009 10:59:21 AM (16 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
cdbe88e
Parents:
9be7432
Message:

removed singulars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/models/BEPolyelectrolyte.py

    r1ed3834 re45a565  
    8888        """ 
    8989        Ca = self.params['c'] * 6.022136e-4 
    90          
    91         K2 = 4.0 * math.pi * self.params['lb'] * (2*self.params['cs'] + \ 
    92                  self.params['alpha'] * Ca) 
    93          
    94         r02 = 1.0/self.params['alpha']/math.sqrt(Ca) * \ 
    95                 (self.params['b']/math.sqrt((48.0*math.pi *self.params['lb']))) 
    96          
    97         return self.params['k']/( 4.0 * math.pi * self.params['lb'] * self.params['alpha']**2 ) \ 
    98                * ( x**2 + K2 ) / ( 1.0 + r02**2 * ( x**2 + K2 ) \ 
    99                     * (x**2 - ( 12.0 * self.params['h'] \ 
    100                     * Ca/(self.params['b']**2) ))) \ 
    101                     + self.params['background'] 
    102          
     90        #remove singulars 
     91        if self.params['alpha']<=0 or self.params['c']<=0 or self.params['b']==0 or self.params['lb']<=0: 
     92            return 0 
     93        else: 
     94             
     95            K2 = 4.0 * math.pi * self.params['lb'] * (2*self.params['cs'] + \ 
     96                     self.params['alpha'] * Ca) 
     97             
     98            r02 = 1.0/self.params['alpha']/math.sqrt(Ca) * \ 
     99                    (self.params['b']/math.sqrt((48.0*math.pi *self.params['lb']))) 
     100             
     101            return self.params['k']/( 4.0 * math.pi * self.params['lb'] * self.params['alpha']**2 ) \ 
     102                   * ( x**2 + K2 ) / ( 1.0 + r02**2 * ( x**2 + K2 ) \ 
     103                        * (x**2 - ( 12.0 * self.params['h'] \ 
     104                        * Ca/(self.params['b']**2) ))) \ 
     105                        + self.params['background'] 
     106             
    103107    
    104108    def run(self, x = 0.0): 
Note: See TracChangeset for help on using the changeset viewer.