Ignore:
Timestamp:
Apr 15, 2008 8:08:40 AM (16 years ago)
Author:
Mathieu Doucet <doucetm@…>
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:
3de85b8
Parents:
5aa3bbd
Message:

Modified to testing and modified according to testing results

File:
1 edited

Legend:

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

    rf629e346 r36948c92  
    4949        ## Parameter details [units, min, max] 
    5050        self.details = {} 
    51         self.details['scale']       = ['', None, None] 
    52         self.details['radius']      = ['A', None, None] 
    53         self.details['fractal_dim'] = ['', None, None] 
    54         self.details['corr_length'] = ['A', None, None] 
    55         self.details['block_sld']   = ['A-2', None, None] 
    56         self.details['solvent_sld'] = ['A-2', None, None] 
     51        self.details['scale']       = ['',     None, None] 
     52        self.details['radius']      = ['A',    None, None] 
     53        self.details['fractal_dim'] = ['',       0, None] 
     54        self.details['corr_length'] = ['A',    None, None] 
     55        self.details['block_sld']   = ['A-2',  None, None] 
     56        self.details['solvent_sld'] = ['A-2',  None, None] 
    5757        self.details['background']  = ['cm-1', None, None] 
    5858        
     
    6363            F(x) = p(x) * s(x) + bkd   
    6464        """ 
     65        if x<0 and self.params['fractal_dim']>0: 
     66            raise ValueError, "negative number cannot be raised to a fractional power" 
     67 
    6568        return self.params['background']+ self._scatterRanDom(x)* self._Block(x) 
     69 
    6670     
    6771    def _Block(self,x): 
    68          
    69          
    70          
    7172        return 1.0 + (math.sin((self.params['fractal_dim']-1.0) * math.atan(x * self.params['corr_length']))\ 
    7273             * self.params['fractal_dim'] * gamma(self.params['fractal_dim']-1.0))\ 
     
    9697        """ 
    9798        if x.__class__.__name__ == 'list': 
    98             return self._Fractal(x[0]*math.cos(x[1]))*self._Fractal(x[0]*math.sin(x[1])) 
     99            # Take absolute value of Q, since this model is really meant to 
     100            # be defined in 1D for a given length of Q 
     101            qx = math.fabs(x[0]*math.cos(x[1])) 
     102            qy = math.fabs(x[0]*math.sin(x[1])) 
     103             
     104            return self._Fractal(qx)*self._Fractal(qy) 
    99105        elif x.__class__.__name__ == 'tuple': 
    100106            raise ValueError, "Tuples are not allowed as input to BaseComponent models" 
Note: See TracChangeset for help on using the changeset viewer.