Changeset 8e36cdd in sasview
- Timestamp:
- Aug 20, 2009 1:24:23 PM (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:
- 1d67243
- Parents:
- 191b369
- Location:
- sansmodels/src
- Files:
-
- 3 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/libigor/libCylinder.c
r7d11b81 r8e36cdd 83 83 84 84 Pi = 4.0*atan(1.0); 85 va = 0 ;86 vb = 1 ; //orintational average, outer integral87 vaj=0 ;85 va = 0.0; 86 vb = 1.0; //orintational average, outer integral 87 vaj=0.0; 88 88 vbj=Pi; //endpoints of inner integral 89 89 … … 163 163 164 164 Pi = 4.0*atan(1.0); 165 va = 0 ;166 vb = 1 ; //orintational average, outer integral167 vaj=0 ;165 va = 0.0; 166 vb = 1.0; //orintational average, outer integral 167 vaj=0.0; 168 168 vbj=Pi; //endpoints of inner integral 169 169 … … 243 243 244 244 Pi = 4.0*atan(1.0); 245 va = 0 ;246 vb = 1 ; //orintational average, outer integral247 vaj = 0 ;248 vbj = 1 ; //endpoints of inner integral245 va = 0.0; 246 vb = 1.0; //orintational average, outer integral 247 vaj = 0.0; 248 vbj = 1.0; //endpoints of inner integral 249 249 250 250 summ = 0.0; //initialize intergral … … 314 314 315 315 // Pi = 4.0*atan(1.0); 316 va = 0 ;317 vb = 1 ; //orintational average, outer integral318 vaj = 0 ;319 vbj = 1 ; //endpoints of inner integral316 va = 0.0; 317 vb = 1.0; //orintational average, outer integral 318 vaj = 0.0; 319 vbj = 1.0; //endpoints of inner integral 320 320 321 321 summ = 0.0; //initialize intergral … … 349 349 answer = (vbj-vaj)/2.0*summj; 350 350 351 arg = mu*cc*sigma/2 ;352 if ( arg == 0 ) {353 answer *= 1 ;351 arg = mu*cc*sigma/2.0; 352 if ( arg == 0.0 ) { 353 answer *= 1.0; 354 354 } else { 355 355 answer *= sin(arg)*sin(arg)/arg/arg; … … 397 397 398 398 pi = 4.0*atan(1.0); 399 va = 0 ;400 vb = 1 ; //limits of numerical integral399 va = 0.0; 400 vb = 1.0; //limits of numerical integral 401 401 402 402 summ = 0.0; //initialize intergral … … 450 450 451 451 pi = 4.0*atan(1.0); 452 va = 0 ;453 vb = 1 ; //limits of numerical integral452 va = 0.0; 453 vb = 1.0; //limits of numerical integral 454 454 455 455 summ = 0.0; //initialize intergral … … 470 470 answer *= delrho*delrho; 471 471 //normalize by volume 472 answer *= 4 *pi/3*a*a*nua;472 answer *= 4.0*pi/3.0*a*a*nua; 473 473 //convert to [cm-1] 474 474 answer *= 1.0e8; … … 804 804 answer = (uplim-lolim)/2.0*summ; 805 805 // normalize by particle volume 806 prolatevol = 4 *Pi/3*trmaj*trmin*trmin;806 prolatevol = 4.0*Pi/3.0*trmaj*trmin*trmin; 807 807 answer /= prolatevol; 808 808 … … 1009 1009 1010 1010 Euler = 0.5772156649; // Euler's constant 1011 dQDefault = 0 ; //0.0025; //[=] 1/A, q-resolution, default value1011 dQDefault = 0.0; //0.0025; //[=] 1/A, q-resolution, default value 1012 1012 dQ = dQDefault; 1013 1013 … … 1602 1602 t1 = (1.0/(b* p1*pow(q0,((-1.0) - p1 - p2)) - b*p2*pow(q0,((-1.0) - p1 - p2)) )); 1603 1603 1604 t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14 *b3*pow(E,(-((q02*Rg2)/b2))))/(15*q03*Rg2) + (2*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15*q02*Rg2)))*Rg2)/b)))/L;1605 1606 t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3 )/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(2*C5);1607 1608 t4 = (b4*sqrt(Rg2)*(((-1 ) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22);1609 1610 t5 = (2 *b4*(((2*q0*Rg2)/b - (2*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1611 1612 t6 = (8 *b4*b*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1+ 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22);1613 1614 t7 = (((-((3 *C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 3/miu)))/miu)) - (2*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 2/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1) - 1/miu)))/miu));1615 1616 t8 = ((1 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)));1617 1618 t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7 *b2)/(15*q02*Rg2))) + (7*b2)/(15*q02*Rg2))))/L;1619 1620 t10 = (2 *b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1+ 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22);1621 1622 1623 yy = ((-1 *(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1)/miu))))*((1+ tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))))));1604 t2 = (b*C*(((-1.0*((14.0*b3)/(15.0*q03*Rg2))) + (14.0*b3*pow(E,(-((q02*Rg2)/b2))))/(15.0*q03*Rg2) + (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*((11.0/15.0 + (7*b2)/(15.0*q02*Rg2)))*Rg2)/b)))/L; 1605 1606 t3 = (sqrt(Rg2)*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2.0))/(2.0*C5); 1607 1608 t4 = (b4*sqrt(Rg2)*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*pow(sech_WR(((-C4) + (sqrt(Rg2)*q0)/b)/C5),2))/(C5*q04*Rg22); 1609 1610 t5 = (2.0*b4*(((2*q0*Rg2)/b - (2.0*pow(E,(-((q02*Rg2)/b2)))*q0*Rg2)/b))*((1.0 + 1.0/2.0*(((-1.0) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22); 1611 1612 t6 = (8.0*b4*b*(((-1.0) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q05*Rg22); 1613 1614 t7 = (((-((3.0*C3*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 3.0/miu)))/miu)) - (2.0*C2*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 2.0/miu)))/miu - (C1*sqrt(Rg2)*pow((((sqrt(Rg2)*q0)/b)),((-1.0) - 1.0/miu)))/miu)); 1615 1616 t8 = ((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))); 1617 1618 t9 = (b*C*((4.0/15.0 - pow(E,(-((q02*Rg2)/b2)))*((11.0/15.0 + (7.0*b2)/(15*q02*Rg2))) + (7.0*b2)/(15.0*q02*Rg2))))/L; 1619 1620 t10 = (2.0*b4*(((-1) + pow(E,(-((q02*Rg2)/b2))) + (q02*Rg2)/b2))*((1.0 + 1.0/2.0*(((-1) - tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5))))))/(q04*Rg22); 1621 1622 1623 yy = ((-1.0*(t1* ((-pow(q0,-p1)*(((b2*pi)/(L*q02) + t2 + t3 - t4 + t5 - t6 + 1.0/2.0*t7*t8)) - b*p1*pow(q0,((-1.0) - p1))*(((-((b*pi)/(L*q0))) + t9 + t10 + 1.0/2.0*((C3*pow((((sqrt(Rg2)*q0)/b)),((-3.0)/miu)) + C2*pow((((sqrt(Rg2)*q0)/b)),((-2.0)/miu)) + C1*pow((((sqrt(Rg2)*q0)/b)),((-1.0)/miu))))*((1.0 + tanh(((-C4) + (sqrt(Rg2)*q0)/b)/C5)))))))))); 1624 1624 1625 1625 return (yy); … … 1845 1845 nord = 76; 1846 1846 lolim = 0; 1847 uplim = Pi/2 ;1847 uplim = Pi/2.0; 1848 1848 halfheight = length/2.0; 1849 1849 … … 2191 2191 2192 2192 //handle arg=0 separately, as sin(t)/t -> 1 as t->0 2193 arg1 = (mu/2 )*cos(Pi*uu/2);2194 arg2 = (mu*aa/2 )*sin(Pi*uu/2);2193 arg1 = (mu/2.0)*cos(Pi*uu/2.0); 2194 arg2 = (mu*aa/2.0)*sin(Pi*uu/2.0); 2195 2195 if(arg1==0.0) { 2196 2196 tmp1 = 1.0; -
sansmodels/src/sans/models/ParallelepipedModel.py
r2cb89e7 r8e36cdd 34 34 scale = 1.0 35 35 short_a = 35.0 [A] 36 long_b= 75.0 [A]37 long er_c= 400.0 [A]36 short_b = 75.0 [A] 37 long_c = 400.0 [A] 38 38 contrast = 5.3e-006 [1/A²] 39 39 background = 0.0 [1/cm] … … 57 57 58 58 scale:Scale factor 59 short_a: length of short side of the parallelepiped[A]60 long_b: length of long side of the parallelepiped[A]61 long er_c: length of longer sideof the parallelepiped [A]59 short_a: length of short edge [A] 60 short_b: length of another short edge [A] 61 long_c: length of long edge of the parallelepiped [A] 62 62 contrast: particle_sld - solvent_sld 63 63 background:Incoherent Background [1/cm]""" … … 67 67 self.details['scale'] = ['', None, None] 68 68 self.details['short_a'] = ['[A]', None, None] 69 self.details[' long_b'] = ['[A]', None, None]70 self.details['long er_c'] = ['[A]', None, None]69 self.details['short_b'] = ['[A]', None, None] 70 self.details['long_c'] = ['[A]', None, None] 71 71 self.details['contrast'] = ['[1/A²]', None, None] 72 72 self.details['background'] = ['[1/cm]', None, None] … … 76 76 77 77 ## fittable parameters 78 self.fixed=['short_a.width', ' long_b.width', 'longer_c.width', 'parallel_phi.width', 'parallel_psi.width', 'parallel_theta.width']78 self.fixed=['short_a.width', 'short_b.width', 'long_c.width', 'parallel_phi.width', 'parallel_psi.width', 'parallel_theta.width'] 79 79 80 80 ## parameters with orientation -
sansmodels/src/sans/models/c_extensions/parallelepiped.c
r3c102d4 r8e36cdd 23 23 dp[0] = pars->scale; 24 24 dp[1] = pars->short_a; 25 dp[2] = pars-> long_b;26 dp[3] = pars->long er_c;25 dp[2] = pars->short_b; 26 dp[3] = pars->long_c; 27 27 dp[4] = pars->contrast; 28 28 dp[5] = pars->background; … … 98 98 */ 99 99 double parallelepiped_analytical_2D_scaled(ParallelepipedParameters *pars, double q, double q_x, double q_y) { 100 double parallel_x, parallel_y, parallel_z;100 double cparallel_x, cparallel_y, cparallel_z, bparallel_x, bparallel_y, parallel_x, parallel_y, parallel_z; 101 101 double q_z; 102 102 double alpha, vol, cos_val_c, cos_val_b, cos_val_a, edgeA, edgeB, edgeC; … … 106 106 107 107 edgeA = pars->short_a; 108 edgeB = pars-> long_b;109 edgeC = pars->long er_c;108 edgeB = pars->short_b; 109 edgeC = pars->long_c; 110 110 111 111 112 112 // parallelepiped c axis orientation 113 parallel_x = sin(pars->parallel_theta) * cos(pars->parallel_phi);114 parallel_y = sin(pars->parallel_theta) * sin(pars->parallel_phi);115 parallel_z = cos(pars->parallel_theta);113 cparallel_x = sin(pars->parallel_theta) * cos(pars->parallel_phi); 114 cparallel_y = sin(pars->parallel_theta) * sin(pars->parallel_phi); 115 cparallel_z = cos(pars->parallel_theta); 116 116 117 117 // q vector … … 120 120 // Compute the angle btw vector q and the 121 121 // axis of the parallelepiped 122 cos_val_c = parallel_x*q_x + parallel_y*q_y +parallel_z*q_z;122 cos_val_c = cparallel_x*q_x + cparallel_y*q_y + cparallel_z*q_z; 123 123 alpha = acos(cos_val_c); 124 124 125 125 // parallelepiped a axis orientation 126 parallel_x = -(1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi);127 parallel_y = (1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi);126 parallel_x = sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi); 127 parallel_y = cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi); 128 128 129 //parallel_x = -(1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)*sin(pars->parallel_psi); 130 //parallel_y = (1-sin(pars->parallel_theta)*sin(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)*cos(pars->parallel_psi); 131 cos_val_a = (parallel_x*q_x + parallel_y*q_y); 129 cos_val_a = parallel_x*q_x + parallel_y*q_y; 132 130 133 131 134 132 135 133 // parallelepiped b axis orientation 136 parallel_x =(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi);137 parallel_y =(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi);134 bparallel_x = sqrt(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*cos(pars->parallel_psi);//cos(pars->parallel_theta) * cos(pars->parallel_phi)* cos(pars->parallel_psi); 135 bparallel_y = sqrt(1-sin(pars->parallel_theta)*cos(pars->parallel_phi))*sin(pars->parallel_psi);//cos(pars->parallel_theta) * sin(pars->parallel_phi)* sin(pars->parallel_psi); 138 136 // axis of the parallelepiped 139 cos_val_b = (parallel_x*q_x + parallel_y*q_y) ;137 cos_val_b = sin(acos(cos_val_a)) ; 140 138 141 139 … … 148 146 149 147 // Call the IGOR library function to get the kernel 150 answer = pkernel( q*edgeA, q*edgeB, q*edgeC, cos_val_a,cos_val_b,cos_val_c);148 answer = pkernel( q*edgeA, q*edgeB, q*edgeC, sin(alpha)*cos_val_a,sin(alpha)*cos_val_b,cos_val_c); 151 149 152 150 // Multiply by contrast^2 -
sansmodels/src/sans/models/c_extensions/parallelepiped.h
r2cb89e7 r8e36cdd 7 7 /** Structure definition for Parallelepiped parameters 8 8 * [PYTHONCLASS] = ParallelepipedModel 9 * [DISP_PARAMS] = short_a, long_b, longer_c,parallel_phi,parallel_psi, parallel_theta9 * [DISP_PARAMS] = short_a, short_b, long_c,parallel_phi,parallel_psi, parallel_theta 10 10 [DESCRIPTION] = <text> Form factor for a rectangular solid with uniform scattering length density. 11 11 12 12 scale:Scale factor 13 short_a: length of short side of the parallelepiped[A]14 long_b: length of long side of the parallelepiped[A]15 long er_c: length of longer sideof the parallelepiped [A]13 short_a: length of short edge [A] 14 short_b: length of another short edge [A] 15 long_c: length of long edge of the parallelepiped [A] 16 16 contrast: particle_sld - solvent_sld 17 17 background:Incoherent Background [1/cm] 18 18 </text> 19 [FIXED]= <text>short_a.width; long_b.width; longer_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text>19 [FIXED]= <text>short_a.width; short_b.width; long_c.width;parallel_phi.width;parallel_psi.width; parallel_theta.width</text> 20 20 [ORIENTATION_PARAMS]= <text>parallel_phi;parallel_psi; parallel_theta; parallel_phi.width;parallel_psi.width; parallel_theta.width</text> 21 21 … … 26 26 // [DEFAULT]=scale=1.0 27 27 double scale; 28 /// Length of short side of the parallelepiped [A]28 /// Length of short edge of the parallelepiped [A] 29 29 // [DEFAULT]=short_a=35 [A] 30 30 double short_a; 31 /// Length of long side edge of the parallelepiped [A]32 // [DEFAULT]= long_b=75 [A]33 double long_b;34 /// Length of long er side of the parallelepiped [A]35 // [DEFAULT]=long er_c=400 [A]36 double long er_c;31 /// Length of short edge edge of the parallelepiped [A] 32 // [DEFAULT]=short_b=75 [A] 33 double short_b; 34 /// Length of long edge of the parallelepiped [A] 35 // [DEFAULT]=long_c=400 [A] 36 double long_c; 37 37 /// Contrast [1/A²] 38 38 // [DEFAULT]=contrast=5.3e-6 [1/A²] -
sansmodels/src/sans/models/c_models/CParallelepipedModel.cpp
r2cb89e7 r8e36cdd 87 87 // Initialize parameter dictionary 88 88 PyDict_SetItemString(self->params,"short_a",Py_BuildValue("d",35.000000)); 89 PyDict_SetItemString(self->params,"short_b",Py_BuildValue("d",75.000000)); 89 90 PyDict_SetItemString(self->params,"scale",Py_BuildValue("d",1.000000)); 90 PyDict_SetItemString(self->params,"long_b",Py_BuildValue("d",75.000000)); 91 PyDict_SetItemString(self->params,"longer_c",Py_BuildValue("d",400.000000)); 91 PyDict_SetItemString(self->params,"long_c",Py_BuildValue("d",400.000000)); 92 92 PyDict_SetItemString(self->params,"parallel_psi",Py_BuildValue("d",0.000000)); 93 93 PyDict_SetItemString(self->params,"parallel_phi",Py_BuildValue("d",0.000000)); … … 102 102 PyDict_SetItemString(self->dispersion, "short_a", disp_dict); 103 103 disp_dict = PyDict_New(); 104 self->model-> long_b.dispersion->accept_as_source(visitor, self->model->long_b.dispersion, disp_dict);105 PyDict_SetItemString(self->dispersion, " long_b", disp_dict);104 self->model->short_b.dispersion->accept_as_source(visitor, self->model->short_b.dispersion, disp_dict); 105 PyDict_SetItemString(self->dispersion, "short_b", disp_dict); 106 106 disp_dict = PyDict_New(); 107 self->model->long er_c.dispersion->accept_as_source(visitor, self->model->longer_c.dispersion, disp_dict);108 PyDict_SetItemString(self->dispersion, "long er_c", disp_dict);107 self->model->long_c.dispersion->accept_as_source(visitor, self->model->long_c.dispersion, disp_dict); 108 PyDict_SetItemString(self->dispersion, "long_c", disp_dict); 109 109 disp_dict = PyDict_New(); 110 110 self->model->parallel_phi.dispersion->accept_as_source(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 247 247 // Reader parameter dictionary 248 248 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 249 self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 249 250 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 250 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 251 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 251 self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 252 252 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 253 253 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); … … 260 260 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 261 261 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 262 disp_dict = PyDict_GetItemString(self->dispersion, " long_b");263 self->model-> long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict);264 disp_dict = PyDict_GetItemString(self->dispersion, "long er_c");265 self->model->long er_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict);262 disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 263 self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 264 disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 265 self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 266 266 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 267 267 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 333 333 // Reader parameter dictionary 334 334 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 335 self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 335 336 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 336 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 337 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 337 self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 338 338 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 339 339 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); … … 346 346 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 347 347 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 348 disp_dict = PyDict_GetItemString(self->dispersion, " long_b");349 self->model-> long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict);350 disp_dict = PyDict_GetItemString(self->dispersion, "long er_c");351 self->model->long er_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict);348 disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 349 self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 350 disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 351 self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 352 352 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 353 353 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 408 408 // Reader parameter dictionary 409 409 self->model->short_a = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_a") ); 410 self->model->short_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "short_b") ); 410 411 self->model->scale = PyFloat_AsDouble( PyDict_GetItemString(self->params, "scale") ); 411 self->model->long_b = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_b") ); 412 self->model->longer_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "longer_c") ); 412 self->model->long_c = PyFloat_AsDouble( PyDict_GetItemString(self->params, "long_c") ); 413 413 self->model->parallel_psi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_psi") ); 414 414 self->model->parallel_phi = PyFloat_AsDouble( PyDict_GetItemString(self->params, "parallel_phi") ); … … 421 421 disp_dict = PyDict_GetItemString(self->dispersion, "short_a"); 422 422 self->model->short_a.dispersion->accept_as_destination(visitor, self->model->short_a.dispersion, disp_dict); 423 disp_dict = PyDict_GetItemString(self->dispersion, " long_b");424 self->model-> long_b.dispersion->accept_as_destination(visitor, self->model->long_b.dispersion, disp_dict);425 disp_dict = PyDict_GetItemString(self->dispersion, "long er_c");426 self->model->long er_c.dispersion->accept_as_destination(visitor, self->model->longer_c.dispersion, disp_dict);423 disp_dict = PyDict_GetItemString(self->dispersion, "short_b"); 424 self->model->short_b.dispersion->accept_as_destination(visitor, self->model->short_b.dispersion, disp_dict); 425 disp_dict = PyDict_GetItemString(self->dispersion, "long_c"); 426 self->model->long_c.dispersion->accept_as_destination(visitor, self->model->long_c.dispersion, disp_dict); 427 427 disp_dict = PyDict_GetItemString(self->dispersion, "parallel_phi"); 428 428 self->model->parallel_phi.dispersion->accept_as_destination(visitor, self->model->parallel_phi.dispersion, disp_dict); … … 488 488 if (!strcmp(par_name, "short_a")) { 489 489 self->model->short_a.dispersion = dispersion; 490 } else if (!strcmp(par_name, " long_b")) {491 self->model-> long_b.dispersion = dispersion;492 } else if (!strcmp(par_name, "long er_c")) {493 self->model->long er_c.dispersion = dispersion;490 } else if (!strcmp(par_name, "short_b")) { 491 self->model->short_b.dispersion = dispersion; 492 } else if (!strcmp(par_name, "long_c")) { 493 self->model->long_c.dispersion = dispersion; 494 494 } else if (!strcmp(par_name, "parallel_phi")) { 495 495 self->model->parallel_phi.dispersion = dispersion; -
sansmodels/src/sans/models/c_models/models.hh
reddff027 r8e36cdd 50 50 Parameter scale; 51 51 Parameter short_a; 52 Parameter long_b;53 Parameter long er_c;52 Parameter short_b; 53 Parameter long_c; 54 54 Parameter contrast; 55 55 Parameter background; -
sansmodels/src/sans/models/c_models/parallelepiped.cpp
r3c102d4 r8e36cdd 37 37 short_a = Parameter(35.0, true); 38 38 short_a.set_max(1.0); 39 long_b = Parameter(75.0, true);40 long_b.set_min(1.0);41 long er_c = Parameter(400.0, true);42 long er_c.set_min(1.0);39 short_b = Parameter(75.0, true); 40 short_b.set_min(1.0); 41 long_c = Parameter(400.0, true); 42 long_c.set_min(1.0); 43 43 contrast = Parameter(53.e-7); 44 44 background = Parameter(0.0); … … 61 61 dp[0] = scale(); 62 62 dp[1] = short_a(); 63 dp[2] = long_b();64 dp[3] = long er_c();63 dp[2] = short_b(); 64 dp[3] = long_c(); 65 65 dp[4] = contrast(); 66 66 dp[5] = 0.0; … … 71 71 72 72 // Get the dispersion points for the longer_edgeB 73 vector<WeightPoint> weights_ long_b;74 long_b.get_weights(weights_long_b);73 vector<WeightPoint> weights_short_b; 74 short_b.get_weights(weights_short_b); 75 75 76 76 // Get the dispersion points for the longuest_edgeC 77 vector<WeightPoint> weights_long er_c;78 long er_c.get_weights(weights_longer_c);77 vector<WeightPoint> weights_long_c; 78 long_c.get_weights(weights_long_c); 79 79 80 80 … … 89 89 90 90 // Loop over longer_edgeB weight points 91 for(int j=0; j< (int)weights_ long_b.size(); j++) {92 dp[2] = weights_ long_b[j].value;91 for(int j=0; j< (int)weights_short_b.size(); j++) { 92 dp[2] = weights_short_b[j].value; 93 93 94 94 // Loop over longuest_edgeC weight points 95 for(int k=0; k< (int)weights_long er_c.size(); k++) {96 dp[3] = weights_long er_c[k].value;97 98 sum += weights_short_a[i].weight * weights_ long_b[j].weight99 * weights_long er_c[k].weight * Parallelepiped(dp, q);95 for(int k=0; k< (int)weights_long_c.size(); k++) { 96 dp[3] = weights_long_c[k].value; 97 98 sum += weights_short_a[i].weight * weights_short_b[j].weight 99 * weights_long_c[k].weight * Parallelepiped(dp, q); 100 100 101 101 norm += weights_short_a[i].weight 102 * weights_ long_b[j].weight * weights_longer_c[k].weight;102 * weights_short_b[j].weight * weights_long_c[k].weight; 103 103 } 104 104 } … … 117 117 dp.scale = scale(); 118 118 dp.short_a = short_a(); 119 dp. long_b = long_b();120 dp.long er_c = longer_c();119 dp.short_b = short_b(); 120 dp.long_c = long_c(); 121 121 dp.contrast = contrast(); 122 122 dp.background = 0.0; … … 132 132 133 133 // Get the dispersion points for the longer_edgeB 134 vector<WeightPoint> weights_ long_b;135 long_b.get_weights(weights_long_b);134 vector<WeightPoint> weights_short_b; 135 short_b.get_weights(weights_short_b); 136 136 137 137 // Get angular averaging for the longuest_edgeC 138 vector<WeightPoint> weights_long er_c;139 long er_c.get_weights(weights_longer_c);138 vector<WeightPoint> weights_long_c; 139 long_c.get_weights(weights_long_c); 140 140 141 141 // Get angular averaging for theta … … 160 160 161 161 // Loop over longer_edgeB weight points 162 for(int j=0; j< (int)weights_ long_b.size(); j++) {163 dp. long_b = weights_long_b[j].value;162 for(int j=0; j< (int)weights_short_b.size(); j++) { 163 dp.short_b = weights_short_b[j].value; 164 164 165 165 // Average over longuest_edgeC distribution 166 for(int k=0; k< (int)weights_long er_c.size(); k++) {167 dp.long er_c = weights_longer_c[k].value;166 for(int k=0; k< (int)weights_long_c.size(); k++) { 167 dp.long_c = weights_long_c[k].value; 168 168 169 169 // Average over theta distribution … … 180 180 181 181 double _ptvalue = weights_short_a[i].weight 182 * weights_ long_b[j].weight183 * weights_long er_c[k].weight182 * weights_short_b[j].weight 183 * weights_long_c[k].weight 184 184 * weights_parallel_theta[l].weight 185 185 * weights_parallel_phi[m].weight … … 192 192 193 193 norm += weights_short_a[i].weight 194 * weights_ long_b[j].weight195 * weights_long er_c[k].weight194 * weights_short_b[j].weight 195 * weights_long_c[k].weight 196 196 * weights_parallel_theta[l].weight 197 197 * weights_parallel_phi[m].weight -
sansmodels/src/sans/models/test/validate_2D_3axes_shape_model.py
r27953d1 r8e36cdd 25 25 Averaging the 3-axes 2D scattering intensity give a slightly 26 26 different output than the 1D function 27 at hight Q (Q>~0. 1). This is due(?) to the way the IGOR library27 at hight Q (Q>~0.2). This is due(?) to the way the IGOR library 28 28 averages, taking only 76 points in alpha, the angle between 29 29 the axis of the ellipsoid and the q vector. … … 81 81 psi_label = 'axis_psi' 82 82 83 output_f = open("%s_avg 1.txt" % model.__class__.__name__,'w')83 output_f = open("%s_avg.txt" % model.__class__.__name__,'w') 84 84 output_f.write("<q_average> <2d_average> <1d_average>\n") 85 85 86 for i_q in range(1, 30):86 for i_q in range(1, 40): 87 87 q = 0.01*i_q 88 88 sum = 0.0 … … 114 114 if __name__ == '__main__': 115 115 validator = Validate2D() 116 116 117 #te was not passed. 117 118 te_passed =validator(TriaxialEllipsoidModel, points=76) 118 119 pp_passed = validator(ParallelepipedModel, points=76) … … 122 123 print "Model Passed" 123 124 print "TriaxialEllipsoid %s" % te_passed 125 print "ParallelepipedModel %s" % pp_passed 124 126 print "EllipticalCylinder %s" % ell_passed 125 print "ParallelepipedModel %s" % pp_passed126 127 127 128 -
sansmodels/src/setup.py
r975ec8e r8e36cdd 180 180 srcdir+"/lamellarPS_HG.c", 181 181 #srcdir+"/COblateModel.c", 182 "sans/models/c_models/CCoreShell SpheroidModel.cpp",182 "sans/models/c_models/CCoreShellEllipsoidModel.cpp", 183 183 "sans/models/c_models/spheroid.cpp", 184 184 srcdir+"/spheroid.c",
Note: See TracChangeset
for help on using the changeset viewer.