Changeset cfbcb6a in sasview


Ignore:
Timestamp:
Oct 8, 2009 4:47:31 PM (15 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
515cc389
Parents:
a99a29ac
Message:

change check for volume

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DataLoader/invariant.py

    ra99a29ac rcfbcb6a  
    130130             
    131131                q_star= 2*(pi*contrast)**2* volume( 1- volume) 
    132                 for k = q_star/(2*(pi*|contrast|)**2) 
     132                for k = 10^(8)*q_star/(2*(pi*|contrast|)**2) 
    133133                we get 2 values of volume: 
    134134                     volume1 = (1- sqrt(1- 4*k))/2 
    135135                     volume2 = (1+ sqrt(1- 4*k))/2 
    136                      
     136                contrast unit is 1/A^(2)= 10^(16)cm^(2) 
     137                q_star unit  1/A^(3)*1/cm 
     138                 
    137139            the result returned will be 0<= volume <= 1 or None 
    138140             
     
    140142            @return None : if the invariant Calculator does not a computed 
    141143            q_star already  stored 
     144            @note: volume fraction must have no unit 
    142145        """ 
    143146        if contrast ==None: 
     
    154157        
    155158        #compute intermediate constant 
    156         k =  self.q_star /(2*(math.pi* math.fabs(float(contrast)))**2) 
     159        k =  1.e-8*self.q_star /(2*(math.pi* math.fabs(float(contrast)))**2) 
    157160        #check discriminant value 
    158161        discrim= 1 - 4*k 
     
    168171            print "volume1",volume1 
    169172            print "volume2",volume2 
    170             if 0<= volume1<= 1: 
     173            
     174            if 0<= volume1 and volume1 <= 1: 
    171175                return volume1 
    172             elif 0<= volume2<= 1:  
     176            elif 0<= volume2 and volume2<= 1:  
    173177                return volume2  
    174178            return  
Note: See TracChangeset for help on using the changeset viewer.