Changeset 279e371 in sasview for sansmodels/src/sans/models/GuinierPorodModel.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/GuinierPorodModel.py
r8f20419d r279e371 1 #!/usr/bin/env python2 1 """ 3 I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql4 = scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql5 Guinier function as a BaseComponent model2 I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql 3 = scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql 4 Guinier function as a BaseComponent model 6 5 """ 7 8 6 from sans.models.BaseComponent import BaseComponent 9 7 from math import sqrt,exp … … 24 22 ## Name of the model 25 23 self.name = "GuinierPorod" 26 self.description=""" I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql 24 self.description = """ 25 I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql 27 26 = scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql 28 27 where ql = sqrt((m-s)(3-s)/2)/Rg. … … 49 48 50 49 #list of parameter that cannot be fitted 51 self.fixed = []50 self.fixed = [] 52 51 53 52 def _guinier_porod(self, x): … … 65 64 66 65 #do the calculation and return the function value 67 q1 =sqrt((n-3.0+m)*n/2.0)/Rg66 q1 = sqrt((n-3.0+m)*n/2.0)/Rg 68 67 if qval < q1: 69 68 F = (G/pow(qval,(3.0-n)))*exp((-qval*qval*Rg*Rg)/n) 70 69 else: 71 F = (G/pow(qval, m))*exp(-(n-3.0+m)/2.0)*pow(((n-3.0+m)*n/2.0),70 F = (G/pow(qval, m))*exp(-(n-3.0+m)/2.0)*pow(((n-3.0+m)*n/2.0), 72 71 ((n-3.0+m)/2.0))/pow(Rg,(n-3.0+m)) 73 72 inten = F + bgd … … 83 82 return self._guinier_porod(x[0]) 84 83 elif x.__class__.__name__ == 'tuple': 85 raise ValueError, "Tuples are not allowed as input to BaseComponentmodels"84 raise ValueError, "Tuples are not allowed as input to models" 86 85 else: 87 86 return self._guinier_porod(x) … … 96 95 return self._guinier_porod(q) 97 96 elif x.__class__.__name__ == 'tuple': 98 raise ValueError, "Tuples are not allowed as input to BaseComponentmodels"97 raise ValueError, "Tuples are not allowed as input to models" 99 98 else: 100 99 return self._guinier_porod(x)
Note: See TracChangeset
for help on using the changeset viewer.