Changeset 1b49bf8 in sasmodels
- Timestamp:
- Oct 17, 2016 1:20:39 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 8393c74
- Parents:
- 218cdbc
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/conversion_table.py
r68425bf r1b49bf8 143 143 } 144 144 ], 145 "core_shell_ellipsoid ": [145 "core_shell_ellipsoid(nonXT)": [ 146 146 "CoreShellEllipsoidModel", 147 147 { 148 "sld_core": "sld_core", 149 "sld_shell": "sld_shell", 150 "sld_solvent": "sld_solvent", 151 "equat_core": "equat_core", 152 "equat_shell": "equat_shell", 153 "polar_core": "polar_core", 154 "polar_shell": "polar_shell", 155 "theta": "axis_theta", 148 156 "phi": "axis_phi", 149 "sld_core": "sld_core",150 "polar_shell": "polar_shell",151 "sld_solvent": "sld_solvent",152 "equat_shell": "equat_shell",153 "equat_core": "equat_core",154 "theta": "axis_theta",155 "polar_core": "polar_core",156 "sld_shell": "sld_shell"157 157 } 158 158 ], … … 160 160 "CoreShellEllipsoidXTModel", 161 161 { 162 "phi": "axis_phi",163 162 "sld_core": "sld_core", 163 "sld_shell": "sld_shell", 164 "sld_solvent": "sld_solvent", 165 "radius_equat_core": "equat_core", 166 "thick_shell": "T_shell", 164 167 "x_core": "X_core", 165 "sld_solvent": "sld_solvent",166 "thick_shell": "T_shell",167 168 "x_polar_shell": "XpolarShell", 168 169 "theta": "axis_theta", 169 " sld_shell": "sld_shell"170 "phi": "axis_phi", 170 171 } 171 172 ], … … 240 241 "DABModel", 241 242 { 242 " length": "length"243 "cor_length": "length" 243 244 } 244 245 ], … … 300 301 "FractalCoreShellModel", 301 302 { 303 "sld_core": "core_sld", 302 304 "sld_shell": "shell_sld", 303 305 "sld_solvent": "solvent_sld", 304 "sld_core": "core_sld" 306 "radius": "radius", 307 "thickness": "thickness", 308 "fractal_dim": "frac_dim", 309 "cor_length": "cor_length", 310 "volfraction": "volfraction", 305 311 } 306 312 ], … … 327 333 "PeakGaussModel", 328 334 { 329 "sigma": "B" 335 "peak_pos": "q0", 336 "sigma": "B", 330 337 } 331 338 ], … … 335 342 "rg": "radius", 336 343 "lorentz_scale": "lScale", 337 "fractal_dim": "FractalExp", 344 "guinier_scale": "gScale", 345 "fractal_dim": "scale", 338 346 "cor_length": "zeta", 339 "guinier_scale": "gScale"340 347 } 341 348 ], … … 351 358 "s": "dim", 352 359 "rg": "rg", 353 " m": "m",360 "porod_exp": "m", 354 361 "scale": "scale", 355 362 "background": "background" … … 367 374 "HayterMSAStructure", 368 375 { 369 "salt_concentration": "saltconc",370 "radius_effective_pd": "effect_radius_pd",371 376 "radius_effective": "effect_radius", 372 "radius_effective_pd_n": "effect_radius_pd_n" 377 "volfraction": "volfraction", 378 "charge": "charge", 379 "temperature": "temperature", 380 "concentration_salt": "saltconc", 381 "dielectconst": "dielectconst", 382 #"radius_effective_pd_n": "effect_radius_pd_n", 383 #"radius_effective_pd": "effect_radius_pd", 373 384 } 374 385 ], … … 376 387 "HollowCylinderModel", 377 388 { 389 "sld": "sldCyl", 390 "sld_solvent": "sldSolv", 391 "radius": "core_radius", 392 "thickness": "radius", 393 "length": "length", 394 "theta": "axis_theta", 378 395 "phi": "axis_phi", 379 "scale": "scale",380 "radius_core": "core_radius",381 "sld_solvent": "sldSolv",382 "length": "length",383 "radius": "radius",384 "background": "background",385 "sld": "sldCyl",386 "theta": "axis_theta"387 396 } 388 397 ], … … 429 438 "LamellarPSHGModel", 430 439 { 440 "sld": "sld_tail", 441 "sld_head": "sld_head", 442 "sld_solvent": "sld_solvent", 443 "length_tail": "deltaT", 444 "length_head": "deltaH", 445 "d_spacing": "spacing", 431 446 "Caille_parameter": "caille", 432 447 "Nlayers": "n_plates", 433 "sld_head": "sld_head",434 "length_tail": "deltaT",435 "length_head": "deltaH",436 "sld": "sld_tail",437 "sld_solvent": "sld_solvent"438 448 } 439 449 ], … … 442 452 { 443 453 "sld": "sld_bi", 454 "sld_solvent": "sld_sol", 455 "thickness": "delta", 456 "d_spacing": "spacing", 444 457 "Caille_parameter": "caille", 445 458 "Nlayers": "N_plates", 446 "sld_solvent": "sld_sol",447 "thickness": "delta"448 459 } 449 460 ], … … 452 463 { 453 464 "sld": "sld_layer", 465 "sld_solvent": "sld_solvent", 466 "thickness": "thickness", 467 "d_spacing": "spacing", 454 468 "sigma_d": "pd_spacing", 455 " sld_solvent": "sld_solvent"469 "Nlayers": "Nlayers", 456 470 } 457 471 ], … … 562 576 { 563 577 "scale": "scale", 564 " thick_string": "thick_string",578 "string_thickness": "thick_string", 565 579 "sld_string": "sld_string", 566 580 "sld_solvent": "sld_solv", 567 581 "edge_sep": "edge_separation", 568 "num _pearls": "num_pearls",582 "number_of_pearls": "num_pearls", 569 583 "radius": "radius", 570 584 "background": "background", … … 595 609 "sld_corona": "rho_corona", 596 610 "sld_solvent": "rho_solv", 597 "sld_core": "rho_core" 611 "sld_core": "rho_core", 612 "ndensity": "ndensity", 613 "v_core": "v_core", 614 "v_corona": "v_corona", 615 "radius_core": "radius_core", 616 "rg": "radius_gyr", 617 "d_penetration": "d_penetration", 618 "n_aggreg": "n_aggreg", 598 619 } 599 620 ], … … 761 782 "TeubnerStreyModel", 762 783 { 763 "a2": "scale" 784 # Note: parameters are completely rewritten in convert.py 785 "volfraction_a": "volfraction_a", 786 "sld_a": "sld_a", 787 "sld_b": "sld_b", 788 "d": "d", 789 "xi": "xi", 764 790 } 765 791 ], -
sasmodels/convert.py
r51241113 r1b49bf8 2 2 Convert models to and from sasview. 3 3 """ 4 from __future__ import print_function 5 6 from os.path import join as joinpath, abspath, dirname 4 from __future__ import print_function, division 5 7 6 import math 8 7 import warnings … … 17 16 'two_lorentzian', 18 17 "two_power_law", 19 'gel_fit',20 18 'gauss_lorentz_gel', 21 19 'be_polyelectrolyte', … … 215 213 if name in MODELS_WITHOUT_VOLFRACTION: 216 214 del oldpars['volfraction'] 217 if name == 'stacked_disks':218 _remove_pd(oldpars, 'n_stacking', name)219 elif name == 'pearl_necklace':220 _remove_pd(oldpars, 'num_pearls', name)221 _remove_pd(oldpars, 'thick_string', name)222 elif name == 'core_shell_parallelepiped':223 _remove_pd(oldpars, 'rimA', name)224 _remove_pd(oldpars, 'rimB', name)225 _remove_pd(oldpars, 'rimC', name)226 elif name == 'polymer_micelle':227 if 'ndensity' in oldpars:228 oldpars['ndensity'] *= 1e15229 elif name == 'spherical_sld':230 oldpars["CONTROL"] -= 1231 # remove polydispersity from shells232 for k in range(1, 11):233 _remove_pd(oldpars, 'thick_flat'+str(k), 'thickness')234 _remove_pd(oldpars, 'thick_inter'+str(k), 'interface')235 # remove extra shells236 for k in range(int(pars['n_shells']), 11):237 oldpars.pop('sld_flat'+str(k), 0)238 oldpars.pop('thick_flat'+str(k), 0)239 oldpars.pop('thick_inter'+str(k), 0)240 oldpars.pop('func_inter'+str(k), 0)241 oldpars.pop('nu_inter'+str(k), 0)242 215 elif name == 'core_multi_shell': 243 216 # kill extra shells … … 252 225 elif name == 'core_shell_parallelepiped': 253 226 _remove_pd(oldpars, 'rimA', name) 227 _remove_pd(oldpars, 'rimB', name) 228 _remove_pd(oldpars, 'rimC', name) 229 elif name == 'hollow_cylinder': 230 # now uses radius and thickness 231 oldpars['radius'] += oldpars['core_radius'] 254 232 elif name in ['mono_gauss_coil', 'poly_gauss_coil']: 255 233 del oldpars['i_zero'] 256 234 elif name == 'onion': 257 235 oldpars.pop('n_shells', None) 236 elif name == 'pearl_necklace': 237 _remove_pd(oldpars, 'num_pearls', name) 238 _remove_pd(oldpars, 'thick_string', name) 239 elif name == 'polymer_micelle': 240 if 'ndensity' in oldpars: 241 oldpars['ndensity'] *= 1e15 258 242 elif name == 'rpa': 259 243 # convert scattering lengths from femtometers to centimeters … … 272 256 for k in "Kab,Kac,Kad".split(','): 273 257 oldpars.pop(k, None) 258 elif name == 'spherical_sld': 259 oldpars["CONTROL"] -= 1 260 # remove polydispersity from shells 261 for k in range(1, 11): 262 _remove_pd(oldpars, 'thick_flat'+str(k), 'thickness') 263 _remove_pd(oldpars, 'thick_inter'+str(k), 'interface') 264 # remove extra shells 265 for k in range(int(pars['n_shells']), 11): 266 oldpars.pop('sld_flat'+str(k), 0) 267 oldpars.pop('thick_flat'+str(k), 0) 268 oldpars.pop('thick_inter'+str(k), 0) 269 oldpars.pop('func_inter'+str(k), 0) 270 oldpars.pop('nu_inter'+str(k), 0) 271 elif name == 'stacked_disks': 272 _remove_pd(oldpars, 'n_stacking', name) 273 elif name == 'teubner_strey': 274 # basically redoing the entire Teubner-Strey calculations here. 275 volfraction = oldpars.pop('volfraction_a') 276 xi = oldpars.pop('xi') 277 d = oldpars.pop('d') 278 sld_a = oldpars.pop('sld_a') 279 sld_b = oldpars.pop('sld_b') 280 drho = 1e6*(sld_a - sld_b) # conversion autoscaled these 281 k = 2.0*math.pi*xi/d 282 a2 = (1.0 + k**2)**2 283 c1 = 2.0 * xi**2 * (1.0 - k**2) 284 c2 = xi**4 285 prefactor = 8.0*math.pi*volfraction*(1.0-volfraction)*drho**2*c2/xi 286 scale = 1e-4*prefactor 287 oldpars['scale'] = a2/scale 288 oldpars['c1'] = c1/scale 289 oldpars['c2'] = c2/scale 274 290 275 291 #print("convert from",list(sorted(pars))) … … 315 331 if name in MODELS_WITHOUT_VOLFRACTION: 316 332 pars['volfraction'] = 1 317 if name == 'pearl_necklace': 318 pars['string_thickness_pd_n'] = 0 319 pars['number_of_pearls_pd_n'] = 0 333 if name == 'core_multi_shell': 334 pars['n'] = min(math.ceil(pars['n']), 4) 335 elif name == 'gel_fit': 336 pars['scale'] = 1 320 337 elif name == 'line': 321 338 pars['scale'] = 1 322 339 pars['background'] = 0 340 elif name == 'mono_gauss_coil': 341 pars['i_zero'] = 1 342 elif name == 'onion': 343 pars['n_shells'] = math.ceil(pars['n_shells']) 344 elif name == 'pearl_necklace': 345 pars['string_thickness_pd_n'] = 0 346 pars['number_of_pearls_pd_n'] = 0 347 elif name == 'poly_gauss_coil': 348 pars['i_zero'] = 1 323 349 elif name == 'rpa': 324 350 pars['case_num'] = int(pars['case_num']) 325 elif name == 'mono_gauss_coil':326 pars['i_zero'] = 1327 elif name == 'poly_gauss_coil':328 pars['i_zero'] = 1329 elif name == 'core_multi_shell':330 pars['n'] = min(math.ceil(pars['n']), 4)331 elif name == 'onion':332 pars['n_shells'] = math.ceil(pars['n_shells'])333 351 elif name == 'spherical_sld': 334 352 pars['n_shells'] = math.ceil(pars['n_shells']) … … 339 357 pars['thickness%d_pd_n'%k] = 0 340 358 pars['interface%d_pd_n'%k] = 0 341 359 elif name == 'teubner_strey': 360 pars['scale'] = 1 361
Note: See TracChangeset
for help on using the changeset viewer.