Changeset 96b59384 in sasview
- Timestamp:
- Aug 4, 2009 4:02:28 PM (15 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:
- 8dc0b746
- Parents:
- b341b16
- Location:
- sansmodels/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/libigor/libCylinder.c
r8e91f01 r96b59384 972 972 973 973 Euler = 0.5772156649; // Euler's constant 974 dQDefault = 0 .0025; //[=] 1/A, q-resolution, default value974 dQDefault = 0; //0.0025; //[=] 1/A, q-resolution, default value 975 975 dQ = dQDefault; 976 976 -
sansmodels/src/sans/models/c_extensions/lamellarPS.h
rb4679de r96b59384 8 8 * [PYTHONCLASS] = LamellarPSModel 9 9 * [DISP_PARAMS] = spacing 10 [DESCRIPTION] = <text>Calculates the scattered intensity from a lyotropic lamellar phase. 11 The intensity (form factor and structure factor) 12 calculated is for lamellae of uniform scattering 13 length density that are randomly distributed in 14 solution (a powder average). The lamellae 15 thickness is polydisperse. The model can also 10 [DESCRIPTION] = <text>[Concentrated Lamellar Form Factor] Calculates the scattered 11 intensity from a lyotropic lamellar phase. 12 The intensity (form factor and structure 13 factor)calculated is for lamellae of 14 uniform scattering length density that 15 are randomly distributed in solution 16 (a powder average). The lamellae thickness 17 is polydisperse. The model can also 16 18 be applied to large, multi-lamellar vesicles. 17 19 No resolution smeared version is included … … 26 28 scale = scale factor 27 29 </text> 28 [FIXED]= spacing.wi th30 [FIXED]= spacing.width 29 31 [ORIENTATION_PARAMS]= 30 32 -
sansmodels/src/sans/models/c_extensions/lamellarPS_HG.c
r27a0771 r96b59384 19 19 double lamellarPS_HG_analytical_1D(LamellarPSHGParameters *pars, double q) { 20 20 double dp[10]; 21 21 22 22 // Fill paramater array 23 23 dp[0] = pars->scale; … … 33 33 34 34 // Call library function to evaluate model 35 return LamellarPS_HG(dp, q); 35 return LamellarPS_HG(dp, q); 36 36 } 37 37 /** … … 42 42 */ 43 43 double lamellarPS_HG_analytical_2DXY(LamellarPSHGParameters *pars, double qx, double qy) { 44 double q; 45 q = sqrt(qx*qx+qy*qy); 46 return lamellarPS_HG_analytical_2D_scaled(pars, q, qx/q, qy/q); 47 } 44 return lamellarPS_HG_analytical_1D(pars, sqrt(qx*qx+qy*qy)); 45 } 48 46 49 47 … … 56 54 */ 57 55 double lamellarPS_HG_analytical_2D(LamellarPSHGParameters *pars, double q, double phi) { 58 return lamellarPS_HG_analytical_2D_scaled(pars, q, cos(phi), sin(phi)); 59 } 60 61 /** 62 * Function to evaluate 2D scattering function 63 * @param pars: parameters of the lamellar 64 * @param q: q-value 65 * @param q_x: q_x / q 66 * @param q_y: q_y / q 67 * @return: function value 68 */ 69 double lamellarPS_HG_analytical_2D_scaled(LamellarPSHGParameters *pars, double q, double q_x, double q_y) { 70 return 1.0; 56 return lamellarPS_HG_analytical_1D(pars, q); 71 57 } 72 73 58 -
sansmodels/src/sans/models/c_extensions/lamellarPS_HG.h
r27a0771 r96b59384 7 7 /** Structure definition for concentrated lamellar form factor parameters 8 8 * [PYTHONCLASS] = LamellarPSHGModel 9 * [DISP_PARAMS] = deltaT,deltaH 10 [DESCRIPTION] = <text> Calculates the scattered intensity from a concentrated lamellar phase</text> 11 [FIXED]= deltaT.with;deltaH.with 12 [ORIENTATION_PARAMS]= 9 * [DISP_PARAMS] = deltaT,deltaH,spacing 10 [DESCRIPTION] = <text>[Concentrated Lamellar (head+tail) Form Factor]: Calculates the 11 intensity from a lyotropic lamellar phase. 12 The intensity (form factor and structure factor) 13 calculated is for lamellae of two-layer scattering 14 length density that are randomly distributed in 15 solution (a powder average). The scattering 16 length density of the tail region, headgroup 17 region, and solvent are taken to be different. 18 The model can also be applied to large, 19 multi-lamellar vesicles. 20 No resolution smeared version is included 21 in the structure factor of this model. 22 *Parameters: spacing = repeat spacing, 23 deltaT = tail length, 24 deltaH = headgroup thickness, 25 n_plates = # of Lamellar plates 26 caille = Caille parameter (<0.8 or <1) 27 background = incoherent bgd 28 scale = scale factor ... 29 </text> 30 [FIXED]= deltaT.width;deltaH.width;spacing.width 31 [ORIENTATION_PARAMS]= 13 32 14 33 **/ … … 27 46 double deltaH; 28 47 /// scattering density length of tails [1/A²] 29 // [DEFAULT]=sld_tail= 4e-7[1/A²]48 // [DEFAULT]=sld_tail=0.4e-6 [1/A²] 30 49 double sld_tail; 31 50 /// scattering density length of head [1/A²] … … 41 60 // [DEFAULT]=caille=0.001 42 61 double caille; 43 /// Incoherent Background [1/cm] 62 /// Incoherent Background [1/cm] 44 63 // [DEFAULT]=background=0.001 [1/cm] 45 64 double background; 46 65 47 66 } LamellarPSHGParameters; 48 67 … … 55 74 double lamellarPS_HG_analytical_2D(LamellarPSHGParameters *pars, double q, double phi); 56 75 double lamellarPS_HG_analytical_2DXY(LamellarPSHGParameters *pars, double qx, double qy); 57 double lamellarPS_HG_analytical_2D_scaled(LamellarPSHGParameters *pars, double q, double q_x, double q_y);58 76 59 77 #endif -
sansmodels/src/sans/models/c_extensions/oblate.c
r27a0771 r96b59384 1 1 /** 2 * Scattering model for a oblate 2 * Scattering model for a oblate core shell 3 3 * @author: Gervaise B Alina/ UTK 4 4 */ … … 18 18 */ 19 19 double oblate_analytical_1D(OblateParameters *pars, double q) { 20 double dp[ 10];21 20 double dp[8]; 21 22 22 // Fill paramater array 23 23 dp[0] = pars->scale; … … 29 29 dp[6] = pars->sld_solvent; 30 30 dp[7] = pars->background; 31 dp[8] = pars->axis_theta; 32 dp[9] = pars->axis_phi; 33 31 34 32 // Call library function to evaluate model 35 return OblateForm(dp, q); 33 return OblateForm(dp, q); 36 34 } 37 35 … … 45 43 double q; 46 44 q = sqrt(qx*qx+qy*qy); 47 return oblate_analytical_ 2D_scaled(pars, q, qx/q, qy/q);48 } 45 return oblate_analytical_1D(pars, q); 46 } 49 47 50 48 … … 57 55 */ 58 56 double oblate_analytical_2D(OblateParameters *pars, double q, double phi) { 59 return oblate_analytical_ 2D_scaled(pars, q, cos(phi), sin(phi));60 } 61 57 return oblate_analytical_1D(pars, q); 58 } 59 62 60 /** 63 61 * Function to evaluate 2D scattering function … … 68 66 * @return: function value 69 67 */ 68 /* 70 69 double oblate_analytical_2D_scaled(OblateParameters *pars, double q, double q_x, double q_y) { 71 70 72 71 return 1.0; 73 72 } 74 73 */ -
sansmodels/src/sans/models/c_extensions/oblate.h
r27a0771 r96b59384 3 3 /** Structure definition for oblate parameters 4 4 * [PYTHONCLASS] = OblateModel 5 * [DISP_PARAMS] = major_core, minor_core, major_shell,minor_shell, axis_theta, axis_phi 6 [DESCRIPTION] = <text> Calculates the form factor for an oblate ellipsoid particle with a core/shell structure. 7 Note:It is the users' responsibility to ensure that shell radii are larger than core radii, and 8 that major radii are larger than minor radii.</text> 5 * [DISP_PARAMS] = major_core, minor_core, major_shell,minor_shell 6 [DESCRIPTION] = <text>[OblateCoreShellModel] Calculates the form factor for an oblate 7 ellipsoid particle with a core_shell structure. 8 The form factor is averaged over all possible 9 orientations of the ellipsoid such that P(q) 10 = scale*<f^2>/Vol + bkg, where f is the 11 single particle scattering amplitude. 12 [Parameters]: 13 major_core = radius of major_core, 14 minor_core = radius of minor_core, 15 major_shell = radius of major_shell, 16 minor_shell = radius of minor_shell, 17 contrast = SLD_core - SLD_shell 18 sld_solvent = SLD_solvent 19 background = Incoherent bkg 20 scale =scale 21 Note:It is the users' responsibility to ensure 22 that shell radii are larger than core radii. 23 </text> 9 24 10 [FIXED] = <text> axis_phi.width; axis_theta.width; major_core.width;minor_core.width; major_shell; minor_shell</text>11 [ORIENTATION_PARAMS] = <text>axis_phi; axis_theta; axis_phi.width; axis_theta.width</text>25 [FIXED] = <text>major_core.width;minor_core.width; major_shell.width; minor_shell.width</text> 26 [ORIENTATION_PARAMS] = 12 27 13 28 **/ … … 37 52 // [DEFAULT]=background=0.001 [1/cm] 38 53 double background; 54 /*//Disable for now 39 55 /// Orientation of the oblate axis w/respect incoming beam [rad] 40 56 // [DEFAULT]=axis_theta=1.0 [rad] … … 43 59 // [DEFAULT]=axis_phi=1.0 [rad] 44 60 double axis_phi; 45 61 */ 46 62 } OblateParameters; 47 63 … … 54 70 double oblate_analytical_2D(OblateParameters *pars, double q, double phi); 55 71 double oblate_analytical_2DXY(OblateParameters *pars, double qx, double qy); 56 double oblate_analytical_2D_scaled(OblateParameters *pars, double q, double q_x, double q_y);72 //double oblate_analytical_2D_scaled(OblateParameters *pars, double q, double q_x, double q_y); 57 73 58 74 #endif -
sansmodels/src/sans/models/c_models/CLamellarPSHGModel.cpp
r27a0771 r96b59384 102 102 self->model->deltaH.dispersion->accept_as_source(visitor, self->model->deltaH.dispersion, disp_dict); 103 103 PyDict_SetItemString(self->dispersion, "deltaH", disp_dict); 104 disp_dict = PyDict_New(); 105 self->model->spacing.dispersion->accept_as_source(visitor, self->model->spacing.dispersion, disp_dict); 106 PyDict_SetItemString(self->dispersion, "spacing", disp_dict); 104 107 105 108 … … 171 174 disp_dict = PyDict_GetItemString(self->dispersion, "deltaH"); 172 175 self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict); 176 disp_dict = PyDict_GetItemString(self->dispersion, "spacing"); 177 self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 173 178 174 179 … … 239 244 disp_dict = PyDict_GetItemString(self->dispersion, "deltaH"); 240 245 self->model->deltaH.dispersion->accept_as_destination(visitor, self->model->deltaH.dispersion, disp_dict); 246 disp_dict = PyDict_GetItemString(self->dispersion, "spacing"); 247 self->model->spacing.dispersion->accept_as_destination(visitor, self->model->spacing.dispersion, disp_dict); 241 248 242 249 … … 298 305 } else if (!strcmp(par_name, "deltaH")) { 299 306 self->model->deltaH.dispersion = dispersion; 307 } else if (!strcmp(par_name, "spacing")) { 308 self->model->spacing.dispersion = dispersion; 300 309 } else { 301 310 PyErr_SetString(CLamellarPSHGModelError, -
sansmodels/src/sans/models/c_models/lamellarPS_HG.cpp
r27a0771 r96b59384 35 35 LamellarPSHGModel :: LamellarPSHGModel() { 36 36 scale = Parameter(1.0); 37 spacing = Parameter(40.0); 37 spacing = Parameter(40.0, true); 38 spacing.set_min(0.0); 38 39 deltaT = Parameter(10.0, true); 39 40 deltaT.set_min(0.0); … … 69 70 dp[7] = n_plates(); 70 71 dp[8] = caille(); 71 dp[9] = background();72 72 dp[9] = 0.0; 73 73 74 74 75 // Get the dispersion points for (deltaT) thickness of the tail 75 76 vector<WeightPoint> weights_deltaT; 76 77 deltaT.get_weights(weights_deltaT); 77 78 78 79 // Get the dispersion points for (deltaH) thickness of the head 79 80 vector<WeightPoint> weights_deltaH; 80 81 deltaH.get_weights(weights_deltaH); 81 82 83 // Get the dispersion points for spacing 84 vector<WeightPoint> weights_spacing; 85 spacing.get_weights(weights_spacing); 86 82 87 // Perform the computation, with all weight points 83 88 double sum = 0.0; 84 89 double norm = 0.0; 85 90 86 91 // Loop over deltaT weight points 87 92 for(int i=0; i< (int)weights_deltaT.size(); i++) { … … 91 96 for(int j=0; j< (int)weights_deltaH.size(); j++) { 92 97 dp[3] = weights_deltaH[j].value; 98 // Loop over spacing weight points 99 for(int k=0; k< (int)weights_spacing.size(); k++) { 100 dp[1] = weights_spacing[k].value; 93 101 94 sum += weights_deltaT[i].weight * weights_deltaH[j].weight *LamellarPS_HG(dp, q); 95 norm += weights_deltaT[i].weight * weights_deltaH[j].weight; 102 sum += weights_deltaT[i].weight * weights_deltaH[j].weight *weights_spacing[k].weight 103 *LamellarPS_HG(dp, q); 104 norm += weights_deltaT[i].weight * weights_deltaH[j].weight * weights_spacing[k].weight; 105 } 96 106 } 97 98 107 } 99 108 return sum/norm + background(); … … 105 114 * @return: function value 106 115 */ 116 double LamellarPSHGModel :: operator()(double qx, double qy) { 117 double q = sqrt(qx*qx + qy*qy); 118 return (*this).operator()(q); 119 } 120 121 /** 122 * Function to evaluate 2D scattering function 123 * @param pars: parameters of the lamellarPS_HG 124 * @param q: q-value 125 * @param phi: angle phi 126 * @return: function value 127 */ 128 double LamellarPSHGModel :: evaluate_rphi(double q, double phi) { 129 return (*this).operator()(q); 130 } 131 132 /* 107 133 double LamellarPSHGModel :: operator()(double qx, double qy) { 108 134 LamellarPSHGParameters dp; … … 118 144 dp.caille = caille(); 119 145 dp.background = background(); 120 146 121 147 // Get the dispersion points for the deltaT 122 148 vector<WeightPoint> weights_deltaT; … … 134 160 for(int i=0; i< (int)weights_deltaT.size(); i++) { 135 161 dp.deltaT = weights_deltaT[i].value; 136 162 137 163 // Loop over deltaH weight points 138 164 for(int j=0; j< (int)weights_deltaH.size(); j++) { 139 165 dp.deltaH = weights_deltaH[j].value; 140 166 141 sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy); 142 norm += weights_deltaT[i].weight * weights_deltaH[j].weight; 167 sum += weights_deltaT[i].weight *weights_deltaH[j].weight *lamellarPS_HG_analytical_2DXY(&dp, qx, qy); 168 norm += weights_deltaT[i].weight * weights_deltaH[j].weight; 143 169 } 144 170 } 145 171 return sum/norm + background(); 146 172 } 173 */ 147 174 148 175 149 /**150 * Function to evaluate 2D scattering function151 * @param pars: parameters of the lamellar152 * @param q: q-value153 * @param phi: angle phi154 * @return: function value155 */156 double LamellarPSHGModel :: evaluate_rphi(double q, double phi) {157 double qx = q*cos(phi);158 double qy = q*sin(phi);159 return (*this).operator()(qx, qy);160 } -
sansmodels/src/sans/models/c_models/oblate.cpp
r27a0771 r96b59384 45 45 sld_solvent = Parameter(6.3e-6); 46 46 background = Parameter(0.0); 47 axis_theta = Parameter(0.0, true);48 axis_phi = Parameter(0.0, true);49 47 } 50 48 … … 67 65 dp[5] = contrast(); 68 66 dp[6] = sld_solvent(); 69 dp[7] = background();70 67 dp[7] = 0.0; 68 71 69 // Get the dispersion points for the major core 72 70 vector<WeightPoint> weights_major_core; … … 106 104 dp[4] = weights_minor_shell[l].value; 107 105 108 sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 106 sum += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 109 107 * weights_minor_shell[l].weight * OblateForm(dp, q); 110 norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 108 norm += weights_major_core[i].weight* weights_minor_core[j].weight * weights_major_shell[k].weight 111 109 * weights_minor_shell[l].weight; 112 110 } … … 123 121 * @return: function value 124 122 */ 123 125 124 double OblateModel :: operator()(double qx, double qy) { 125 double q = sqrt(qx*qx + qy*qy); 126 127 return (*this).operator()(q); 128 } 129 130 131 /** 132 * Function to evaluate 2D scattering function 133 * @param pars: parameters of the oblate 134 * @param q: q-value 135 * @param phi: angle phi 136 * @return: function value 137 */ 138 double OblateModel :: evaluate_rphi(double q, double phi) { 139 return (*this).operator()(q); 140 } 141 142 /* disable below for now 143 double OblateShellModel :: operator()(double qx, double qy) { 126 144 OblateParameters dp; 127 145 // Fill parameter array … … 215 233 return sum/norm + background(); 216 234 } 217 218 /** 219 * Function to evaluate 2D scattering function 220 * @param pars: parameters of the oblate 221 * @param q: q-value 222 * @param phi: angle phi 223 * @return: function value 224 */ 225 double OblateModel :: evaluate_rphi(double q, double phi) { 226 double qx = q*cos(phi); 227 double qy = q*sin(phi); 228 return (*this).operator()(qx, qy); 229 } 235 *///
Note: See TracChangeset
for help on using the changeset viewer.