Changeset 18f2ca1 in sasview for sansmodels/src/sans/models
- Timestamp:
- Oct 15, 2010 6:43:06 PM (14 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:
- 2e862a0
- Parents:
- 495c377
- Location:
- sansmodels/src/sans/models
- Files:
-
- 5 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sansmodels/src/sans/models/CappedCylinderModel.py
r339ce67 r18f2ca1 58 58 self.name = "CappedCylinderModel" 59 59 ## Model description 60 self.description ="""Calculates the scattering from a cylinder with spherical 61 section end-caps.That is, a sphereocylinder60 self.description ="""Calculates the scattering from a cylinder with spherical section end-caps. 61 That is, a sphereocylinder 62 62 with end caps that have a radius larger than 63 63 that of the cylinder and the center of the -
sansmodels/src/sans/models/c_extensions/bcc.c
r8f20419d r18f2ca1 110 110 // Compute the angle btw vector q and the a3 axis 111 111 cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z; 112 //alpha = acos(cos_val_a3);112 alpha = acos(cos_val_a3); 113 113 a3_dot_q = aa*q*cos_val_a3; 114 114 115 115 // a1 axis 116 116 cos_val_a1 = a1_x*q_x + a1_y*q_y; 117 a1_dot_q = aa*q*cos_val_a1 ;117 a1_dot_q = aa*q*cos_val_a1*sin(alpha); 118 118 119 119 // a2 axis 120 cos_val_a2 = a2_x*q_x + a2_y*q_y; //sin(acos(cos_val_a1));121 a2_dot_q = aa*q*cos_val_a2 ;120 cos_val_a2 = sin(acos(cos_val_a1));//a2_x*q_x + a2_y*q_y; 121 a2_dot_q = aa*q*cos_val_a2*sin(alpha); //aa*q*cos_val_a2 122 122 123 123 // The following test should always pass -
sansmodels/src/sans/models/c_extensions/capcyl.h
r339ce67 r18f2ca1 7 7 //[PYTHONCLASS] = CappedCylinderModel 8 8 //[DISP_PARAMS] = rad_cyl,len_cyl,rad_cap,phi, theta 9 //[DESCRIPTION] =<text>Calculates the scattering from a cylinder with spherical 10 // section end-caps.That is, a sphereocylinder9 //[DESCRIPTION] =<text>Calculates the scattering from a cylinder with spherical section end-caps. 10 // That is, a sphereocylinder 11 11 // with end caps that have a radius larger than 12 12 // that of the cylinder and the center of the -
sansmodels/src/sans/models/c_extensions/fcc.c
r8f20419d r18f2ca1 77 77 Da = pars->d_factor*aa; 78 78 qDa_2 = pow(q*Da,2.0); 79 contrast = pars->sldSph - pars->sldSolv;79 //contrast = pars->sldSph - pars->sldSolv; 80 80 81 81 latticeScale = 4.0*(4.0/3.0)*Pi*(dp[1]*dp[1]*dp[1])/pow(aa*sqrt(2.0),3.0); … … 109 109 110 110 // Compute the angle btw vector q and the a3 axis 111 cos_val_a3 = a3_x*q_x + a3_y*q_y;// + a3_z*q_z; 111 cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z; 112 alpha = acos(cos_val_a3); 112 113 a3_dot_q = aa*q*cos_val_a3; 113 114 114 115 // a1 axis 115 116 cos_val_a1 = a1_x*q_x + a1_y*q_y; 116 a1_dot_q = aa*q*cos_val_a1 ;117 a1_dot_q = aa*q*cos_val_a1*sin(alpha); 117 118 118 119 // a2 axis 119 cos_val_a2 = a2_x*q_x + a2_y*q_y; //sin(acos(cos_val_a1));120 a2_dot_q = aa*q*cos_val_a2 ;120 cos_val_a2 = sin(acos(cos_val_a1));//a2_x*q_x + a2_y*q_y; 121 a2_dot_q = aa*q*cos_val_a2*sin(alpha); 121 122 122 123 // The following test should always pass … … 134 135 135 136 // Use SphereForm directly from libigor 136 answer = SphereForm _Paracrystal(pars->radius,contrast,q)*Zq;137 answer = SphereForm(dp,q)*Zq; 137 138 138 139 //consider scales -
sansmodels/src/sans/models/c_extensions/sc.c
r8f20419d r18f2ca1 89 89 // Compute the angle btw vector q and the a3 axis 90 90 cos_val_a3 = a3_x*q_x + a3_y*q_y + a3_z*q_z; 91 alpha = acos(cos_val_a3); 91 92 //alpha = acos(cos_val_a3); 92 93 a3_dot_q = aa*q*cos_val_a3; … … 96 97 97 98 cos_val_a1 = a1_x*q_x + a1_y*q_y; 98 a1_dot_q = aa*q*cos_val_a1 ;99 a1_dot_q = aa*q*cos_val_a1*sin(alpha); 99 100 100 101 // a2 axis orientation … … 102 103 a2_y = sqrt(1.0-sin(pars->theta)*cos(pars->phi))*sin(pars->psi); 103 104 // a2 axis 104 cos_val_a2 = a2_x*q_x + a2_y*q_y;//sin(acos(cos_val_a1));105 a2_dot_q = aa*q*cos_val_a2 ;105 cos_val_a2 = sin(acos(cos_val_a1));//a2_x*q_x + a2_y*q_y; 106 a2_dot_q = aa*q*cos_val_a2*sin(alpha); 106 107 107 108 // The following test should always pass -
sansmodels/src/sans/models/c_models/c_models.cpp
rfbd09fa0 r18f2ca1 16 16 void addCTriaxialEllipsoidModel(PyObject *module); 17 17 void addCParallelepipedModel(PyObject *module); 18 void addCCSParallelepipedModel(PyObject *module); 18 19 void addCSphereModel(PyObject *module); 19 20 void addCOnionModel(PyObject *module); … … 227 228 addCCappedCylinderModel(m); 228 229 addCParallelepipedModel(m); 230 addCCSParallelepipedModel(m); 229 231 addCCoreShellCylinderModel(m); 230 232 addCCoreShellModel(m); -
sansmodels/src/sans/models/c_models/models.hh
r339ce67 r18f2ca1 98 98 class ParallelepipedModel{ 99 99 public: 100 // TODO: add 2D101 100 // Model parameters 102 101 Parameter scale; … … 121 120 }; 122 121 122 123 class CSParallelepipedModel{ 124 public: 125 // Model parameters 126 Parameter scale; 127 Parameter shortA; 128 Parameter midB; 129 Parameter longC; 130 Parameter rimA; 131 Parameter rimB; 132 Parameter rimC; 133 Parameter sld_rimA; 134 Parameter sld_rimB; 135 Parameter sld_rimC; 136 Parameter sld_pcore; 137 Parameter sld_solv; 138 Parameter background; 139 Parameter parallel_theta; 140 Parameter parallel_phi; 141 Parameter parallel_psi; 142 143 // Constructor 144 CSParallelepipedModel(); 145 146 // Operators to get I(Q) 147 double operator()(double q); 148 double operator()(double qx, double qy); 149 double calculate_ER(); 150 double evaluate_rphi(double q, double phi); 151 }; 123 152 124 153 class OnionModel{ -
sansmodels/src/sans/models/test/utest_extra_models.py
r495c377 r18f2ca1 346 346 self.assertAlmostEqual(self.model4.runXY(0.4425284), 0.00306386, 8) 347 347 348 348 349 class TestCSPP(unittest.TestCase): 350 """ 351 Unit tests for CSParallelepiped Model function 352 """ 353 def setUp(self): 354 from sans.models.CSParallelepipedModel import CSParallelepipedModel 355 self.model= CSParallelepipedModel() 356 357 def test1D(self): 358 # the values are from Igor pro calculation 359 # the different digits are due to precision of q values 360 self.assertAlmostEqual(self.model.run(0.001), 1383.96, 2) 361 self.assertAlmostEqual(self.model.run(0.1501412), 2.51932, 4) 362 self.assertAlmostEqual(self.model.runXY(0.4425284), 0.0736735, 6) 363 349 364 if __name__ == '__main__': 350 365 unittest.main()
Note: See TracChangeset
for help on using the changeset viewer.