Changeset 36948c92 in sasview for sansmodels/src/sans/models/FractalModel.py
- Timestamp:
- Apr 15, 2008 8:08:40 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:
- 3de85b8
- Parents:
- 5aa3bbd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/FractalModel.py
rf629e346 r36948c92 49 49 ## Parameter details [units, min, max] 50 50 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] 57 57 self.details['background'] = ['cm-1', None, None] 58 58 … … 63 63 F(x) = p(x) * s(x) + bkd 64 64 """ 65 if x<0 and self.params['fractal_dim']>0: 66 raise ValueError, "negative number cannot be raised to a fractional power" 67 65 68 return self.params['background']+ self._scatterRanDom(x)* self._Block(x) 69 66 70 67 71 def _Block(self,x): 68 69 70 71 72 return 1.0 + (math.sin((self.params['fractal_dim']-1.0) * math.atan(x * self.params['corr_length']))\ 72 73 * self.params['fractal_dim'] * gamma(self.params['fractal_dim']-1.0))\ … … 96 97 """ 97 98 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) 99 105 elif x.__class__.__name__ == 'tuple': 100 106 raise ValueError, "Tuples are not allowed as input to BaseComponent models"
Note: See TracChangeset
for help on using the changeset viewer.