Changeset 66ebdd6 in sasmodels
- Timestamp:
- Nov 19, 2015 12:47:50 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 5d80bbf
- Parents:
- 8fe0b9b
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
rd6adfbe r66ebdd6 14 14 /coverage.xml 15 15 /.coverage 16 /.project 17 /.pydevproject -
sasmodels/models/guinier.py
reff3d66 r66ebdd6 26 26 description = """ 27 27 I(q) = scale exp ( - rg^2 q^2 / 3.0 ) 28 28 29 29 List of default parameters: 30 30 scale = scale … … 34 34 35 35 # ["name", "units", default, [lower, upper], "type","description"], 36 parameters = [["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"],] 36 parameters = [ 37 ["rg", "Ang", 60.0, [0, inf], "", "Radius of Gyration"], 38 ] 37 39 38 40 Iq = """ 39 double value = rg*rg*q*q/3.0; 40 return exp(-value); 41 double exponent = rg*rg*q*q/3.0; 42 double value = exp(-exponent); 43 return value; 41 44 """ 42 45 … … 52 55 oldname = 'GuinierModel' 53 56 oldpars = dict(rg='rg') 57 58 # parameters for unit tests 59 tests = [ 60 [{'rg' : 31.5}, 0.005, 0.991756] 61 ] -
sasmodels/models/hollow_cylinder.c
r6cf1cb3 r66ebdd6 1 double _hollow_cylinder_kernel(double q, double core_radius, double radius,1 static double _hollow_cylinder_kernel(double q, double core_radius, double radius, 2 2 double length, double dum); 3 static double hollow_cylinder_analytical_2D_scaled(double q, double q_x, double q_y, double radius, double core_radius, double length, double sld, 4 double solvent_sld, double theta, double phi); 5 static double hollow_cylinder_scaling(double integrand, double delrho, double volume); 6 7 double form_volume(double radius, double core_radius, double length); 3 8 4 double form_volume(double radius, double core_radius, double length);5 9 double Iq(double q, double radius, double core_radius, double length, double sld, 6 10 double solvent_sld); … … 9 13 10 14 // From Igor library 11 double _hollow_cylinder_kernel(double q, double core_radius, double radius,15 static double _hollow_cylinder_kernel(double q, double core_radius, double radius, 12 16 double length, double dum) 13 17 { … … 40 44 return(retval); 41 45 } 46 static double hollow_cylinder_analytical_2D_scaled(double q, double q_x, double q_y, double radius, double core_radius, double length, double sld, 47 double solvent_sld, double theta, double phi) { 48 double cyl_x, cyl_y; //, cyl_z 49 //double q_z; 50 double vol, cos_val, delrho; 51 double answer; 52 //convert angle degree to radian 53 double pi = 4.0*atan(1.0); 54 theta = theta * pi/180.0; 55 phi = phi * pi/180.0; 56 delrho = solvent_sld - sld; 57 58 // Cylinder orientation 59 cyl_x = cos(theta) * cos(phi); 60 cyl_y = sin(theta); 61 //cyl_z = -cos(theta) * sin(phi); 62 63 // q vector 64 //q_z = 0; 65 66 // Compute the angle btw vector q and the 67 // axis of the cylinder 68 cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z; 69 70 // The following test should always pass 71 if (fabs(cos_val)>1.0) { 72 printf("core_shell_cylinder_analytical_2D: Unexpected error: cos(alpha)=%g\n", cos_val); 73 return 0; 74 } 75 76 answer = _hollow_cylinder_kernel(q, core_radius, radius, length, cos_val); 77 78 vol = form_volume(radius, core_radius, length); 79 answer = hollow_cylinder_scaling(answer, delrho, vol); 80 81 return answer; 82 } 83 static double hollow_cylinder_scaling(double integrand, double delrho, double volume) 84 { 85 double answer; 86 // Multiply by contrast^2 87 answer = integrand*delrho*delrho; 88 89 //normalize by cylinder volume 90 answer *= volume*volume; 91 92 //convert to [cm-1] 93 answer *= 1.0e-4; 94 95 return answer; 96 } 97 42 98 43 99 double form_volume(double radius, double core_radius, double length) … … 48 104 } 49 105 106 50 107 double Iq(double q, double radius, double core_radius, double length, double sld, 51 108 double solvent_sld) … … 55 112 double lower,upper,zi, inter; //upper and lower integration limits 56 113 double summ,answer,delrho; //running tally of integration 57 double norm, scale,volume,convert; //final calculation variables114 double norm,volume; //final calculation variables 58 115 59 116 delrho = solvent_sld - sld; … … 69 126 70 127 norm = summ*(upper-lower)/2.0; 71 // Multiply by contrast^272 scale = delrho*delrho;73 //normalize by volume74 128 volume = form_volume(radius, core_radius, length); 75 //convert to [cm-1] given sld*1e6 76 convert = 1.0e-4; 77 answer = norm*scale*convert*volume*volume; 129 answer = hollow_cylinder_scaling(norm, delrho, volume); 78 130 79 131 return(answer); 80 132 } 81 133 82 // TODO: Add this in134 //FIXME: Factor of two difference 83 135 double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld, 84 136 double solvent_sld, double theta, double phi) 85 137 { 86 return(0.0); 138 double q; 139 q = sqrt(qx*qx+qy*qy); 140 return hollow_cylinder_analytical_2D_scaled(q, qx/q, qy/q, radius, core_radius, length, sld, solvent_sld, theta, phi); 87 141 } -
sasmodels/models/hollow_cylinder.py
r6cf1cb3 r66ebdd6 49 49 .. image:: img/image061.jpg 50 50 51 *Figure. Definition of the angles for the oriented HollowCylinderModel.*51 *Figure. Definition of the angles for the oriented hollow_cylinder model.* 52 52 53 53 .. image:: img/image062.jpg … … 103 103 core_radius='core_radius',sld='sldCyl',length='length', 104 104 solvent_sld='sldSolv',phi='axis_phi',theta='axis_theta') 105 106 # Parameters for unit tests 107 tests = [ 108 [{"radius" : 30.0},0.00005,1764.926] 109 ] -
sasmodels/models/lorentz.py
r77ad412 r66ebdd6 60 60 oldname = 'LorentzModel' 61 61 oldpars = dict(cor_length='length') 62 63 # parameters for unit tests 64 tests = [ 65 [{'cor_length' : 250},0.01,0.137931] 66 ]
Note: See TracChangeset
for help on using the changeset viewer.