Changeset 3db3895 in sasview for sansmodels/src/sans/models/DABModel.py
- Timestamp:
- Mar 25, 2008 11:05:04 AM (16 years ago)
- 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:
- f629e346
- Parents:
- 829eee9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/DABModel.py
r829eee9 r3db3895 1 1 #!/usr/bin/env python 2 2 """ 3 Provide F(x) = scale/( 1 + (x*L)^2 )^(2) 3 Provide F(x) = scale/( 1 + (x*L)^2 )^(2) + background 4 4 DAB (Debye Anderson Brumberger) function as a BaseComponent model 5 5 """ … … 13 13 Class that evaluates a DAB model. 14 14 15 F(x) = scale/( 1 + (x*L)^2 )^(2) + bkd15 F(x) = scale/( 1 + (x*L)^2 )^(2) + background 16 16 17 17 The model has three parameters: 18 L = Correlation Length19 scale = scale factor20 b kd = incoherent background18 L = Correlation Length 19 scale = scale factor 20 background = incoherent background 21 21 """ 22 22 … … 28 28 29 29 ## Name of the model 30 self.name = " DAB_Model"30 self.name = "DAB_Model" 31 31 32 32 ## Define parameters 33 33 self.params = {} 34 self.params[' L'] = 40.035 self.params['scale'] = 10.036 self.params['b kd']= 0.034 self.params['length'] = 50.0 35 self.params['scale'] = 1.0 36 self.params['background'] = 0.0 37 37 38 38 ## Parameter details [units, min, max] 39 39 self.details = {} 40 self.details[' L'] = ['A', None, None]41 self.details['scale'] = ['', None, None]42 self.details['b kd'] = ['cm^{-1}', None, None]40 self.details['length'] = ['', None, None] 41 self.details['scale'] = ['', None, None] 42 self.details['background'] = ['', None, None] 43 43 44 44 def _DAB(self, x): 45 45 """ 46 Evaluate F(x) = scale/( 1 + (x*L)^2 )^(2) + b kd46 Evaluate F(x) = scale/( 1 + (x*L)^2 )^(2) + background 47 47 48 48 """ 49 return self.params['scale']/math.pow(( 1 + math.pow(x * self.params[' L'],2)),2) \50 + self.params['b kd']49 return self.params['scale']/math.pow(( 1 + math.pow(x * self.params['length'],2)),2) \ 50 + self.params['background'] 51 51 52 52 53 53 def run(self, x = 0.0): 54 54 """ Evaluate the model 55 @param x: simple value55 @param x: input q-value (float or [float, float] as [r, theta]) 56 56 @return: (DAB value) 57 57 """ … … 65 65 def runXY(self, x = 0.0): 66 66 """ Evaluate the model 67 @param x: simple value67 @param x: input q-value (float or [float, float] as [qx, qy]) 68 68 @return: DAB value 69 69 """
Note: See TracChangeset
for help on using the changeset viewer.