Changeset 51f14603 in sasview for src/sans/models
- Timestamp:
- Apr 3, 2014 11:37:53 AM (11 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:
- 2f2d9d0
- Parents:
- eea3ffa
- Location:
- src/sans/models
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/models/BaseComponent.py
r5777106 r51f14603 96 96 Evaluate a distribution of q-values. 97 97 98 * For 1D, a numpy array is expected as input: 98 * For 1D, a numpy array is expected as input: :: 99 99 100 100 evalDistribution(q) 101 101 102 where q is a numpy array. 103 104 105 * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], 106 where 1D arrays, :: 107 108 qx_prime = [ qx[0], qx[1], qx[2], ....] 109 110 and :: 111 112 qy_prime = [ qy[0], qy[1], qy[2], ....] 113 114 Then get :: 115 116 q = numpy.sqrt(qx_prime^2+qy_prime^2) 117 118 that is a qr in 1D array; :: 119 120 q = [q[0], q[1], q[2], ....] 121 122 ..note:: 123 Due to 2D speed issue, no anisotropic scattering 124 is supported for python models, thus C-models should have 125 their own evalDistribution methods. 126 127 The method is then called the following way: :: 128 129 evalDistribution(q) 130 102 131 where q is a numpy array. 103 132 104 105 * For 2D, a list of numpy arrays are expected: [qx_prime,qy_prime], 106 where 1D arrays, 107 108 qx_prime = [ qx[0], qx[1], qx[2], ....] 109 and 110 qy_prime = [ qy[0], qy[1], qy[2], ....] 111 112 Then get 113 q = numpy.sqrt(qx_prime^2+qy_prime^2) 114 115 that is a qr in 1D array; 116 q = [q[0], q[1], q[2], ....] 117 118 :Note: Due to 2D speed issue, no anisotropic scattering 119 is supported for python models, thus C-models should have 120 their own evalDistribution methods. 121 122 The method is then called the following way: 123 124 evalDistribution(q) 125 where q is a numpy array. 126 127 :param qdist: ndarray of scalar q-values or list [qx,qy] 128 where qx,qy are 1D ndarrays 129 133 :param qdist: ndarray of scalar q-values or list [qx,qy] where qx,qy are 1D ndarrays 130 134 """ 131 135 if qdist.__class__.__name__ == 'list': -
src/sans/models/Constant.py
r5777106 r51f14603 7 7 8 8 class Constant(BaseComponent): 9 """ Class that evaluates a constant model. 10 List of default parameters: 11 value = 1.0 9 """ 10 Class that evaluates a constant model. 11 List of default parameters: 12 13 * value = 1.0 12 14 """ 13 15 -
src/sans/models/PolymerExclVolume.py
r5777106 r51f14603 25 25 Refer to that file and the structure it contains 26 26 for details of the model. 27 27 28 List of default parameters: 28 scale = 0.01 29 rg = 100.0 [A] 30 m = 3.0 31 background = 0.0 [1/cm] 29 30 * scale = 0.01 31 * rg = 100.0 [A] 32 * m = 3.0 33 * background = 0.0 [1/cm] 32 34 33 35 """ -
src/sans/models/PowerLawAbsModel.py
r5777106 r51f14603 1 1 """ 2 Provide F(x) = scale* ( |x|)^(-m) + bkd2 Provide F(x) = scale* (\|x\|)^(-m) + bkd 3 3 Power law function as a BaseComponent model 4 4 """ … … 8 8 class PowerLawAbsModel(PowerLawModel): 9 9 """ 10 Class that evaluates a absolute Power_Law model.11 10 Class that evaluates a absolute Power_Law model. :: 11 12 12 F(x) = scale* (|x|)^(-m) + bkd 13 14 The model has three parameters: 15 m = power 16 scale = scale factor 17 bkd = incoherent background 13 14 The model has three parameters: 15 16 * m = power 17 * scale = scale factor 18 * bkd = incoherent background 18 19 """ 19 20 -
src/sans/models/TwoPowerLawModel.py
r5777106 r51f14603 17 17 =C*pow(qval,-1.0*power2) for q>qc 18 18 where C=coef_A*pow(qc,-1.0*power1)/pow(qc,-1.0*power2). 19 19 20 List of default parameters: 20 coef_A = coefficient 21 power1 = (-) Power @ low Q 22 power2 = (-) Power @ high Q 23 qc = crossover Q-value 24 background = incoherent background 21 22 * coef_A = coefficient 23 * power1 = (-) Power @ low Q 24 * power2 = (-) Power @ high Q 25 * qc = crossover Q-value 26 * background = incoherent background 25 27 """ 26 28 -
src/sans/models/c_extension/python_wrapper/WrapperGenerator.py
r230f479 r51f14603 126 126 buf = f.read() 127 127 128 self.default_list = " List of default parameters:\n"128 self.default_list = "\n List of default parameters:\n\n" 129 129 #lines = string.split(buf,'\n') 130 130 lines = buf.split('\n') … … 293 293 if len(toks2) >= 2: 294 294 units = toks2[1] 295 self.default_list += " 295 self.default_list += " * %-15s = %s %s\n" % \ 296 296 (toks[1], val, units) 297 297 -
src/sans/models/c_extension/python_wrapper/modelTemplate.txt
r230f479 r51f14603 16 16 Provide functionality for a C extension model 17 17 18 :WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 19 DO NOT MODIFY THIS FILE, MODIFY 20 [INCLUDE_FILE] 21 AND RE-RUN THE GENERATOR SCRIPT 18 .. WARNING:: 19 20 THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 21 DO NOT MODIFY THIS FILE, MODIFY 22 [INCLUDE_FILE] 23 AND RE-RUN THE GENERATOR SCRIPT 22 24 """ 23 25 -
src/sans/models/qsmearing.py
r5777106 r51f14603 500 500 Make fake data_x points extrapolated outside of the data_x points 501 501 502 : param width: array of std of q resolution 503 : param Data1D.x: Data1D.x array 504 505 : return new_width, data_x_ext: extrapolated width array and x array 506 507 : assumption1: data_x is ordered from lower q to higher q 508 : assumption2: len(data) = len(width) 509 : assumption3: the distance between the data points is more compact 510 than the size of width 511 : Todo1: Make sure that the assumptions are correct for Data1D 512 : Todo2: This fixes the edge problem in Qsmearer but still needs to make 513 smearer interface 502 :param width: array of std of q resolution 503 :param Data1D.x: Data1D.x array 504 505 :return new_width, data_x_ext: extrapolated width array and x array 506 507 :assumption1: data_x is ordered from lower q to higher q 508 :assumption2: len(data) = len(width) 509 :assumption3: the distance between the data points is more compact than the size of width 510 :Todo1: Make sure that the assumptions are correct for Data1D 511 :Todo2: This fixes the edge problem in Qsmearer but still needs to make smearer interface 514 512 """ 515 513 # Length of the width
Note: See TracChangeset
for help on using the changeset viewer.