Changeset 279e371 in sasview for sansmodels/src/sans/models/GuinierModel.py
- Timestamp:
- Apr 18, 2012 1:26:13 PM (12 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:
- 499fe7a
- Parents:
- 3ee4d96
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/GuinierModel.py
r1ed3834 r279e371 1 #!/usr/bin/env python2 1 """ 3 2 Provide I(q) = I_0 exp ( - R_g^2 q^2 / 3.0) 4 3 Guinier function as a BaseComponent model 5 4 """ 6 7 5 from sans.models.BaseComponent import BaseComponent 8 6 import math … … 28 26 ## Name of the model 29 27 self.name = "Guinier" 30 self.description =""" I(q) = I_0 exp ( - R_g^2 q^2 / 3.0 )28 self.description = """ I(q) = I_0 exp ( - R_g^2 q^2 / 3.0 ) 31 29 32 30 List of default parameters: … … 43 41 self.details['rg'] = ['[A]', None, None] 44 42 #list of parameter that cannot be fitted 45 self.fixed= [] 43 self.fixed = [] 44 46 45 def _guinier(self, x): 47 return self.params['scale'] * math.exp( -(self.params['rg']*x)**2 / 3.0 ) 46 """ 47 Evaluate guinier function 48 :param x: q-value 49 """ 50 return self.params['scale']*math.exp( -(self.params['rg']*x)**2/3.0 ) 48 51 49 52 def run(self, x = 0.0): 50 """ Evaluate the model 53 """ 54 Evaluate the model 51 55 @param x: input q-value (float or [float, float] as [r, theta]) 52 56 @return: (guinier value) … … 55 59 return self._guinier(x[0]) 56 60 elif x.__class__.__name__ == 'tuple': 57 raise ValueError, "Tuples are not allowed as input to BaseComponentmodels"61 raise ValueError, "Tuples are not allowed as input to models" 58 62 else: 59 63 return self._guinier(x) … … 68 72 return self._guinier(q) 69 73 elif x.__class__.__name__ == 'tuple': 70 raise ValueError, "Tuples are not allowed as input to BaseComponentmodels"74 raise ValueError, "Tuples are not allowed as input to models" 71 75 else: 72 76 return self._guinier(x)
Note: See TracChangeset
for help on using the changeset viewer.