Changeset f1e0c1eb in sasview
- Timestamp:
- Jul 26, 2012 6:53:20 AM (12 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:
- 7fdb332
- Parents:
- 32ea318
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pr_inversion/test/test_output.txt
r7578961 rf1e0c1eb 3 3 #alpha=0.0007 4 4 #chi2=836.797 5 #elapsed=0 5 #elapsed=0.000865936 6 6 #qmin=None 7 7 #qmax=None … … 10 10 #background=0 11 11 #has_bck=0 12 #alpha_estimate=4.58991e-0 0612 #alpha_estimate=4.58991e-06 13 13 #C_0=217.876478953+-2522.42314999 14 14 #C_1=0.30164617344+-226.644556603 -
sansdataloader/test/write_test.xml
r62dc94b rf1e0c1eb 2 2 <SASroot version="1.0" xmlns="cansas1d/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="cansas1d/1.0 http://svn.smallangles.net/svn/canSAS/1dwg/trunk/cansas1d.xsd"> 3 3 <SASentry> 4 <Title> 5 Test title 6 </Title> 7 <Run name="run name"> 8 1234 9 </Run> 4 <Title>Test title</Title> 5 <Run name="run name">1234</Run> 10 6 <SASdata> 11 7 <Idata> 12 <Q unit="1/A"> 13 0.02 14 </Q> 15 <I unit="1/cm"> 16 1000.0 17 </I> 18 <Qdev unit="1/A"> 19 0.01 20 </Qdev> 21 <dQl unit="1/A"> 22 0.0 23 </dQl> 24 <dQw unit="1/A"> 25 0.0 26 </dQw> 27 <Idev unit="1/cm"> 28 3.0 29 </Idev> 8 <Q unit="1/A">0.02</Q> 9 <I unit="1/cm">1000.0</I> 10 <Qdev unit="1/A">0.01</Qdev> 11 <dQl unit="1/A">0.0</dQl> 12 <dQw unit="1/A">0.0</dQw> 13 <Idev unit="1/cm">3.0</Idev> 30 14 </Idata> 31 15 <Idata> 32 <Q unit="1/A"> 33 0.03 34 </Q> 35 <I unit="1/cm"> 36 1001.0 37 </I> 38 <Qdev unit="1/A"> 39 0.02 40 </Qdev> 41 <dQl unit="1/A"> 42 0.0 43 </dQl> 44 <dQw unit="1/A"> 45 0.0 46 </dQw> 47 <Idev unit="1/cm"> 48 4.0 49 </Idev> 16 <Q unit="1/A">0.03</Q> 17 <I unit="1/cm">1001.0</I> 18 <Qdev unit="1/A">0.02</Qdev> 19 <dQl unit="1/A">0.0</dQl> 20 <dQw unit="1/A">0.0</dQw> 21 <Idev unit="1/cm">4.0</Idev> 50 22 </Idata> 51 23 </SASdata> 52 24 <SASsample name="my sample"> 53 <ID> 54 SI600-new-long 55 </ID> 56 <thickness unit="mm"> 57 1.03 58 </thickness> 59 <transmission> 60 0.327 61 </transmission> 62 <temperature unit="C"> 63 0.0 64 </temperature> 65 <details> 66 http://chemtools.chem.soton.ac.uk/projects/blog/blogs.php/bit_id/2720 67 </details> 68 <details> 69 Some text here 70 </details> 25 <ID>SI600-new-long</ID> 26 <thickness unit="mm">1.03</thickness> 27 <transmission>0.327</transmission> 28 <temperature unit="C">0.0</temperature> 29 <details>http://chemtools.chem.soton.ac.uk/projects/blog/blogs.php/bit_id/2720</details> 30 <details>Some text here</details> 71 31 <position> 72 <x unit="mm"> 73 10.0 74 </x> 75 <y unit="mm"> 76 0.0 77 </y> 32 <x unit="mm">10.0</x> 33 <y unit="mm">0.0</y> 78 34 </position> 79 35 <orientation> 80 <roll unit="degree"> 81 22.5 82 </roll> 83 <pitch unit="degree"> 84 0.02 85 </pitch> 36 <roll unit="degree">22.5</roll> 37 <pitch unit="degree">0.02</pitch> 86 38 </orientation> 87 39 </SASsample> 88 40 <SASinstrument> 89 <name> 90 canSAS instrument 91 </name> 41 <name>canSAS instrument</name> 92 42 <SASsource name="source name"> 93 <radiation> 94 neutron 95 </radiation> 96 <beam_shape> 97 disc 98 </beam_shape> 43 <radiation>neutron</radiation> 44 <beam_shape>disc</beam_shape> 99 45 <beam_size name="bm"> 100 <x unit="mm"> 101 12.0 102 </x> 103 <y unit="mm"> 104 13.0 105 </y> 46 <x unit="mm">12.0</x> 47 <y unit="mm">13.0</y> 106 48 </beam_size> 107 <wavelength unit="A"> 108 6.0 109 </wavelength> 110 <wavelength_min unit="nm"> 111 0.22 112 </wavelength_min> 113 <wavelength_max unit="nm"> 114 1.0 115 </wavelength_max> 116 <wavelength_spread unit="percent"> 117 14.3 118 </wavelength_spread> 49 <wavelength unit="A">6.0</wavelength> 50 <wavelength_min unit="nm">0.22</wavelength_min> 51 <wavelength_max unit="nm">1.0</wavelength_max> 52 <wavelength_spread unit="percent">14.3</wavelength_spread> 119 53 </SASsource> 120 54 <SAScollimation name="test coll name"> 121 <length unit="mm"> 122 123.0 123 </length> 55 <length unit="mm">123.0</length> 124 56 <aperture name="source" type="radius"> 125 <distance unit="mm"> 126 11000 127 </distance> 57 <distance unit="mm">11000</distance> 128 58 <size> 129 <x unit="mm"> 130 50.0 131 </x> 59 <x unit="mm">50.0</x> 132 60 </size> 133 61 </aperture> 134 62 <aperture name="sample" type="radius"> 135 63 <size name="size name"> 136 <x unit="mm"> 137 1.0 138 </x> 64 <x unit="mm">1.0</x> 139 65 </size> 140 66 </aperture> 141 67 </SAScollimation> 142 68 <SASdetector> 143 <name> 144 fictional hybrid 145 </name> 146 <SDD unit="mm"> 147 4150 148 </SDD> 69 <name>fictional hybrid</name> 70 <SDD unit="mm">4150</SDD> 149 71 <offset> 150 <x unit="m"> 151 0.001 152 </x> 153 <y unit="m"> 154 0.002 155 </y> 72 <x unit="m">0.001</x> 73 <y unit="m">0.002</y> 156 74 </offset> 157 75 <beam_center> 158 <x unit="mm"> 159 322.64 160 </x> 161 <y unit="mm"> 162 327.68 163 </y> 76 <x unit="mm">322.64</x> 77 <y unit="mm">327.68</y> 164 78 </beam_center> 165 79 <pixel_size> 166 <x unit="mm"> 167 5.0 168 </x> 169 <y unit="mm"> 170 5.0 171 </y> 80 <x unit="mm">5.0</x> 81 <y unit="mm">5.0</y> 172 82 </pixel_size> 173 83 <orientation> 174 <roll unit="degree"> 175 1.0 176 </roll> 177 <pitch unit="degree"> 178 0.0 179 </pitch> 180 <yaw unit="degree"> 181 0.0 182 </yaw> 84 <roll unit="degree">1.0</roll> 85 <pitch unit="degree">0.0</pitch> 86 <yaw unit="degree">0.0</yaw> 183 87 </orientation> 184 88 </SASdetector> 185 89 </SASinstrument> 186 90 <SASprocess> 187 <name> 188 spol 189 </name> 190 <date> 191 04-Sep-2007 18:35:02 192 </date> 193 <description> 194 195 </description> 196 <term name="radialstep" unit="mm"> 197 10.000 198 </term> 199 <term name="sector_width" unit="degree"> 200 180.0 201 </term> 202 <term name="sector_orient" unit="degree"> 203 0.0 204 </term> 205 <term name="MASK_file"> 206 USER:MASK.COM 207 </term> 208 <SASprocessnote> 209 AvA1 0.0000E+00 AsA2 1.0000E+00 XvA3 1.0526E+03 XsA4 210 5.2200E-02 XfA5 0.0000E+00 211 </SASprocessnote> 212 <SASprocessnote> 213 S... 13597 0 2.26E+02 2A 5mM 0%D2O Sbak 13594 0 1.13E+02 214 H2O Buffer 215 </SASprocessnote> 216 <SASprocessnote> 217 V... 13552 3 1.00E+00 H2O5m 218 </SASprocessnote> 91 <name>spol</name> 92 <date>04-Sep-2007 18:35:02</date> 93 <description></description> 94 <term name="radialstep" unit="mm">10.000</term> 95 <term name="sector_width" unit="degree">180.0</term> 96 <term name="sector_orient" unit="degree">0.0</term> 97 <term name="MASK_file">USER:MASK.COM</term> 98 <SASprocessnote>AvA1 0.0000E+00 AsA2 1.0000E+00 XvA3 1.0526E+03 XsA4 99 5.2200E-02 XfA5 0.0000E+00</SASprocessnote> 100 <SASprocessnote>S... 13597 0 2.26E+02 2A 5mM 0%D2O Sbak 13594 0 1.13E+02 101 H2O Buffer</SASprocessnote> 102 <SASprocessnote>V... 13552 3 1.00E+00 H2O5m</SASprocessnote> 219 103 </SASprocess> 220 104 <SASprocess> 221 <name> 222 NCNR-IGOR 223 </name> 224 <date> 225 03-SEP-2006 11:42:47 226 </date> 227 <description> 228 229 </description> 230 <term name="average_type"> 231 Circular 232 </term> 233 <term name="SAM_file"> 234 SEP06064.SA3_AJJ_L205 235 </term> 236 <term name="BKD_file"> 237 SEP06064.SA3_AJJ_L205 238 </term> 239 <term name="EMP_file"> 240 SEP06064.SA3_AJJ_L205 241 </term> 242 <term name="DIV_file"> 243 SEP06064.SA3_AJJ_L205 244 </term> 245 <term name="MASK_file"> 246 SEP06064.SA3_AJJ_L205 247 </term> 248 <term name="ABS:TSTAND"> 249 1 250 </term> 251 <term name="ABS:DSTAND" unit="mm"> 252 1 253 </term> 254 <term name="ABS:IZERO"> 255 230.09 256 </term> 257 <term name="ABS:XSECT" unit="mm"> 258 1 259 </term> 105 <name>NCNR-IGOR</name> 106 <date>03-SEP-2006 11:42:47</date> 107 <description></description> 108 <term name="average_type">Circular</term> 109 <term name="SAM_file">SEP06064.SA3_AJJ_L205</term> 110 <term name="BKD_file">SEP06064.SA3_AJJ_L205</term> 111 <term name="EMP_file">SEP06064.SA3_AJJ_L205</term> 112 <term name="DIV_file">SEP06064.SA3_AJJ_L205</term> 113 <term name="MASK_file">SEP06064.SA3_AJJ_L205</term> 114 <term name="ABS:TSTAND">1</term> 115 <term name="ABS:DSTAND" unit="mm">1</term> 116 <term name="ABS:IZERO">230.09</term> 117 <term name="ABS:XSECT" unit="mm">1</term> 260 118 </SASprocess> 261 119 </SASentry> -
sansmodels/src/c_models/starpolymer.cpp
ra8d3b4f rf1e0c1eb 6 6 7 7 **/ 8 9 8 10 9 #include <math.h> … … 29 28 30 29 double u = d_R2 * pow(q,2); 31 double v = pow(u,2 ) * d_arms / (3 * d_arms - 2);30 double v = pow(u,2.0) * d_arms / (3.0 * d_arms - 2.0); 32 31 33 double term1 = v - 1 + exp(-v);34 double term2 = ((d_arms - 1 )/2)* pow((1 - exp(-v)),2);32 double term1 = v - 1.0 + exp(-v); 33 double term2 = ((d_arms - 1.0)/2.0)* pow((1.0 - exp(-v)),2.0); 35 34 36 return 2 * d_scale / (d_arms * pow(v,2)) * (term1 + term2) + d_background;35 return 2.0 * d_scale / (d_arms * pow(v,2.0)) * (term1 + term2) + d_background; 37 36 38 37 } -
sansmodels/test/utest_nonshape.py
r18e250c rf1e0c1eb 248 248 value = self._func(self.scale, self.length, self.back, x)*self._func(self.scale, self.length, self.back, y) 249 249 self.assertAlmostEquals(self.model.run([x, y]), value,1) 250 250 251 251 252 class TestPowerLaw(unittest.TestCase): 252 253 """ … … 521 522 if __name__ == '__main__': 522 523 unittest.main() 524 -
sansmodels/test/utest_other_models.py
r279e371 rf1e0c1eb 1233 1233 """ Test DABModel at the critical point""" 1234 1234 self.assert_(numpy.isfinite(self.comp.run(0.0))) 1235 1236 class TestStarPolymer(unittest.TestCase): 1237 """ Unit tests for StarPolymer""" 1238 1239 def setUp(self): 1240 from sans.models.StarPolymer import StarPolymer 1241 self.comp = StarPolymer() 1242 self.comp.setParam('arms',3.0) 1243 self.comp.setParam('scale',5.0) 1244 self.comp.setParam('background',1.0) 1245 self.comp.setParam('R2',100.0) 1246 1247 1248 def test1D(self): 1249 """ Test 1D model for a StarPolymer""" 1250 # our variables 1251 q = 0.001 1252 rg = 100.0 1253 f = 3.0 1254 bkg = 1.0 1255 scale = 5.0 1256 1257 # equation set up 1258 u = rg * q * q 1259 v = u * u * f / (3*f - 2) 1260 p = 2 / (f * v * v) 1261 temp = v - 1 + math.exp(-v) 1262 temp += (f - 1)/2 * math.pow(1 - math.exp(-v), 2) 1263 p *= (temp * scale) 1264 p += bkg 1265 1266 self.assertAlmostEquals(self.comp.run(q), p, 5) 1267 1268 def test1D_2(self): 1269 """ Test 2D model for a StarPolymer""" 1270 qx = 0.001 1271 qy = 1.3 1272 q = math.sqrt(qx*qx + qy*qy) 1273 rg = 100.0 1274 f = 3.0 1275 bkg = 1.0 1276 scale = 5.0 1277 1278 # equation set up 1279 u = rg * q * q 1280 v = u * u * f / (3*f - 2) 1281 p = 2 / (f * v * v) 1282 temp = v - 1 + math.exp(-v) 1283 temp += (f - 1)/2 * math.pow(1 - math.exp(-v), 2) 1284 p *= (temp * scale) 1285 p += bkg 1286 1287 self.assertAlmostEqual(self.comp.runXY([0.001, 1.3]), p, 5) 1235 1288 1236 1289
Note: See TracChangeset
for help on using the changeset viewer.