Changeset e65c3ba in sasmodels
- Timestamp:
- Nov 28, 2017 6:09:34 PM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 32398dc
- Parents:
- 110f69c
- Location:
- sasmodels
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/__init__.py
r997c9ca re65c3ba 47 47 ] 48 48 return return_list 49 50 -
sasmodels/compare.py
r110f69c re65c3ba 944 944 # work with trimmed data, not the full set 945 945 sorted_err = np.sort(abs(err.compressed())) 946 if len(sorted_err) == 0 .:946 if len(sorted_err) == 0: 947 947 print(label + " no valid values") 948 948 return … … 1081 1081 ] 1082 1082 1083 NAME_OPTIONS = set(k for k in OPTIONS if not k.endswith('='))1084 VALUE_OPTIONS = [k[:-1] for k in OPTIONS if k.endswith('=')]1083 NAME_OPTIONS = (lambda: set(k for k in OPTIONS if not k.endswith('=')))() 1084 VALUE_OPTIONS = (lambda: [k[:-1] for k in OPTIONS if k.endswith('=')])() 1085 1085 1086 1086 … … 1174 1174 name = positional_args[-1] 1175 1175 1176 # pylint: disable=bad-whitespace 1176 # pylint: disable=bad-whitespace,C0321 1177 1177 # Interpret the flags 1178 1178 opts = { … … 1265 1265 elif arg == '-html': opts['html'] = True 1266 1266 elif arg == '-help': opts['html'] = True 1267 # pylint: enable=bad-whitespace 1267 # pylint: enable=bad-whitespace,C0321 1268 1268 1269 1269 # Magnetism forces 2D for now … … 1464 1464 show html docs for the model 1465 1465 """ 1466 import os1467 1466 from .generate import make_html 1468 1467 from . import rst2html … … 1499 1498 signal.update_parameters(problem) 1500 1499 frame.Bind(wx.EVT_TOOL, _reset_parameters, frame.ToolBar.GetToolByPos(1)) 1501 if is_mac: frame.Show() 1500 if is_mac: 1501 frame.Show() 1502 1502 # If running withing an app, start the main loop 1503 1503 if app: -
sasmodels/conversion_table.py
r505d0ad re65c3ba 29 29 30 30 CONVERSION_TABLE = { 31 (3, 1,2) : {32 "adsorbed_layer": [33 "Core2ndMomentModel",34 {35 "scale": "scale",36 "second_moment": "second_moment",37 "density_shell": "density_poly",38 "sld_solvent": "sld_solv",39 "radius": "radius_core",40 "volfraction": "volf_cores",41 "background": "background",42 "adsorbed_amount": "ads_amount",43 "sld_shell": "sld_poly"44 }45 ],46 "barbell": [47 "BarBellModel",48 {49 "sld": "sld_barbell",50 "length": "len_bar",51 "radius_bell": "rad_bell",52 "radius": "rad_bar",53 "sld_solvent": "sld_solv"54 }55 ],56 "bcc_paracrystal": [57 "BCCrystalModel",58 {59 "sld": "sldSph",60 "sld_solvent": "sldSolv"61 }62 ],63 "be_polyelectrolyte": [64 "BEPolyelectrolyte",65 {66 "ionization_degree": "alpha",67 "polymer_concentration": "c",68 "salt_concentration": "cs",69 "virial_param": "h",70 "background": "background",71 "contrast_factor": "k",72 "bjerrum_length": "lb",73 "monomer_length": "b"74 }75 ],76 "binary_hard_sphere": [77 "BinaryHSModel",78 {79 "sld_sm": "ss_sld",80 "sld_lg": "ls_sld",81 "volfraction_sm": "vol_frac_ss",82 "radius_lg": "l_radius",83 "radius_sm": "s_radius",84 "volfraction_lg": "vol_frac_ls",85 "sld_solvent": "solvent_sld"86 }87 ],88 "broad_peak": [89 "BroadPeakModel",90 {91 "peak_pos": "q_peak",92 "scale": None,93 "lorentz_length": "length_l",94 "porod_scale": "scale_p",95 "lorentz_exp": "exponent_l",96 "lorentz_scale": "scale_l",97 "porod_exp": "exponent_p"98 }99 ],100 "capped_cylinder": [101 "CappedCylinderModel",102 {103 "sld": "sld_capcyl",104 "length": "len_cyl",105 "radius_cap": "rad_cap",106 "radius": "rad_cyl",107 "sld_solvent": "sld_solv"108 }109 ],110 "core_multi_shell": [111 "CoreMultiShellModel",112 {113 "thickness": "thick_shell",114 "sld": "sld_shell",115 "radius": "rad_core0",116 "sld_core": "sld_core0",117 "sld_solvent": "sld_solv",118 "n": "n_shells",119 "M0:sld_core": "M0_sld_core0",120 "mtheta:sld_core": "M_theta_core0",121 "mphi:sld_core": "M_phi_core0",122 "M0:sld1": "M0_sld_shell1",123 "mtheta:sld1": "M_theta_shell1",124 "mphi:sld1": "M_phi_shell1",125 "M0:sld2": "M0_sld_shell2",126 "mtheta:sld2": "M_theta_shell2",127 "mphi:sld2": "M_phi_shell2",128 "M0:sld3": "M0_sld_shell3",129 "mtheta:sld3": "M_theta_shell3",130 "mphi:sld3": "M_phi_shell3",131 "M0:sld4": "M0_sld_shell4",132 "mtheta:sld4": "M_theta_shell4",133 "mphi:sld4": "M_phi_shell4",134 "M0:sld_solvent": "M0_sld_solv",135 "mtheta:sld_solvent": "M_theta_solv",136 "mphi:sld_solvent": "M_phi_solv",137 "up:frac_i": "Up_frac_i",138 "up:frac_f": "Up_frac_f",139 "up:angle": "Up_theta",140 }141 ],142 "core_shell_bicelle": [143 "CoreShellBicelleModel",144 {145 "phi": "axis_phi",146 "sld_core": "core_sld",147 "sld_rim": "rim_sld",148 "thick_face": "face_thick",149 "sld_solvent": "solvent_sld",150 "thick_rim": "rim_thick",151 "sld_face": "face_sld",152 "theta": "axis_theta"153 }154 ],155 "core_shell_cylinder": [156 "CoreShellCylinderModel",157 {158 "theta": "axis_theta",159 "phi": "axis_phi",160 "sld_shell": "shell_sld",161 "sld_solvent": "solvent_sld",162 "sld_core": "core_sld"163 }164 ],165 "core_shell_ellipsoid:1": [166 "CoreShellEllipsoidModel",167 {168 "sld_core": "sld_core",169 "sld_shell": "sld_shell",170 "sld_solvent": "sld_solvent",171 "radius_equat_core": "equat_core",172 "x_core": "polar_core",173 "thick_shell": "equat_shell",174 "x_polar_shell": "polar_shell",175 "theta": "axis_theta",176 "phi": "axis_phi",177 }178 ],179 "core_shell_ellipsoid": [180 "CoreShellEllipsoidXTModel",181 {182 "sld_core": "sld_core",183 "sld_shell": "sld_shell",184 "sld_solvent": "sld_solvent",185 "radius_equat_core": "equat_core",186 "thick_shell": "T_shell",187 "x_core": "X_core",188 "x_polar_shell": "XpolarShell",189 "theta": "axis_theta",190 "phi": "axis_phi",191 }192 ],193 "core_shell_parallelepiped": [194 "CSParallelepipedModel",195 {196 "sld_core": "sld_pcore",197 "sld_a": "sld_rimA",198 "sld_b": "sld_rimB",199 "sld_c": "sld_rimC",200 "sld_solvent": "sld_solv",201 "length_a": "shortA",202 "length_b": "midB",203 "length_c": "longC",204 "thick_rim_a": "rimA",205 "thick_rim_c": "rimC",206 "thick_rim_b": "rimB",207 "theta": "parallel_theta",208 "phi": "parallel_phi",209 "psi": "parallel_psi",210 }211 ],212 "core_shell_sphere": [213 "CoreShellModel",214 {215 "sld_core": "core_sld",216 "sld_shell": "shell_sld",217 "sld_solvent": "solvent_sld",218 "M0:sld_core": "M0_sld_core",219 "mtheta:sld_core": "M_theta_core",220 "mphi:sld_core": "M_phi_core",221 "M0:sld_shell": "M0_sld_shell",222 "mtheta:sld_shell": "M_theta_shell",223 "mphi:sld_shell": "M_phi_shell",224 "M0:sld_solvent": "M0_sld_solv",225 "mtheta:sld_solvent": "M_theta_solv",226 "mphi:sld_solvent": "M_phi_solv",227 "up:frac_i": "Up_frac_i",228 "up:frac_f": "Up_frac_f",229 "up:angle": "Up_theta"230 }231 ],232 "correlation_length": [233 "CorrLength",234 {235 "porod_scale": "scale_p",236 "lorentz_scale": "scale_l",237 "porod_exp": "exponent_p",238 "lorentz_exp": "exponent_l",239 "cor_length": "length_l"240 },241 "CorrLengthModel"242 ],243 "cylinder": [244 "CylinderModel",245 {246 "sld": "sldCyl",247 "theta": "cyl_theta",248 "phi": "cyl_phi",249 "sld_solvent": "sldSolv",250 "M0:sld": "M0_sld_cyl",251 "mtheta:sld": "M_theta_cyl",252 "mphi:sld": "M_phi_cyl",253 "M0:sld_solvent": "M0_sld_solv",254 "mtheta:sld_solvent": "M_theta_solv",255 "mphi:sld_solvent": "M_phi_solv",256 "up:frac_i": "Up_frac_i",257 "up:frac_f": "Up_frac_f",258 "up:angle": "Up_theta"259 }260 ],261 "dab": [262 "DABModel",263 {264 "cor_length": "length"265 }266 ],267 "ellipsoid": [268 "EllipsoidModel",269 {270 "phi": "axis_phi",271 "radius_equatorial": "radius_b",272 "sld": "sldEll",273 "theta": "axis_theta",274 "radius_polar": "radius_a",275 "sld_solvent": "sldSolv"276 }277 ],278 "elliptical_cylinder": [279 "EllipticalCylinderModel",280 {281 "axis_ratio": "r_ratio",282 "radius_minor": "r_minor",283 "sld": "sldCyl",284 "sld_solvent": "sldSolv",285 "theta": "cyl_theta",286 "phi": "cyl_phi",287 "psi": "cyl_psi",288 }289 ],290 "fcc_paracrystal": [291 "FCCrystalModel",292 {293 "sld": "sldSph",294 "sld_solvent": "sldSolv"295 }296 ],297 "flexible_cylinder": [298 "FlexibleCylinderModel",299 {300 "sld": "sldCyl",301 "sld_solvent": "sldSolv"302 }303 ],304 "flexible_cylinder_elliptical": [305 "FlexCylEllipXModel",306 {307 "sld": "sldCyl",308 "sld_solvent": "sldSolv"309 }310 ],311 "fractal": [312 "FractalModel",313 {314 "sld_block": "sldBlock",315 "radius": "radius",316 "cor_length": "cor_length",317 "sld_solvent": "sldSolv",318 "fractal_dim": "fractal_dim"319 }320 ],321 "fractal_core_shell": [322 "FractalCoreShell",323 {324 "sld_core": "core_sld",325 "sld_shell": "shell_sld",326 "sld_solvent": "solvent_sld",327 "radius": "radius",328 "thickness": "thickness",329 "fractal_dim": "frac_dim",330 "cor_length": "cor_length",331 "volfraction": "volfraction",332 },333 "FractalCoreShellModel"334 ],335 "fuzzy_sphere": [336 "FuzzySphereModel",337 {338 "sld": "sldSph",339 "fuzziness": "fuzziness",340 "radius": "radius",341 "sld_solvent": "sldSolv"342 }343 ],344 "gauss_lorentz_gel": [345 "GaussLorentzGel",346 {347 "gauss_scale": "scale_g",348 "cor_length_dynamic": "dyn_colength",349 "cor_length_static": "stat_colength",350 "background": "background",351 "lorentz_scale": "scale_l"352 },353 "GaussLorentzGelModel"354 ],355 "gaussian_peak": [356 "Peak Gauss Model",357 {358 "peak_pos": "q0",359 "sigma": "B",360 },361 "PeakGaussModel",362 ],363 "gel_fit": [364 "GelFitModel",365 {366 "rg": "radius",367 "lorentz_scale": "lScale",368 "guinier_scale": "gScale",369 "fractal_dim": "FractalExp",370 "cor_length": "zeta",371 }372 ],373 "guinier": [374 "Guinier",375 {376 "rg": "rg"377 },378 "GuinierModel",379 ],380 "guinier_porod": [381 "GuinierPorod",382 {383 "s": "dim",384 "rg": "rg",385 "porod_exp": "m",386 "scale": "scale",387 "background": "background"388 },389 "GuinierPorodModel",390 ],391 "hardsphere": [392 "HardsphereStructure",393 {394 "scale": "scale_factor",395 "radius_effective": "effect_radius",396 }397 ],398 "hayter_msa": [399 "HayterMSAStructure",400 {401 "scale": "scale_factor",402 "radius_effective": "effect_radius",403 "volfraction": "volfraction",404 "charge": "charge",405 "temperature": "temperature",406 "concentration_salt": "saltconc",407 "dielectconst": "dielectconst",408 }409 ],410 "hollow_cylinder": [411 "HollowCylinderModel",412 {413 "sld": "sldCyl",414 "sld_solvent": "sldSolv",415 "radius": "core_radius",416 "thickness": "radius",417 "length": "length",418 "theta": "axis_theta",419 "phi": "axis_phi",420 }421 ],422 "hollow_rectangular_prism": [423 "RectangularHollowPrismModel",424 {425 "sld": "sldPipe",426 "sld_solvent": "sldSolv",427 "length_a": "short_side",428 "b2a_ratio": "b2a_ratio",429 "c2a_ratio": "c2a_ratio",430 "thickness": "thickness",431 }432 ],433 "hollow_rectangular_prism_thin_walls": [434 "RectangularHollowPrismInfThinWallsModel",435 {436 "sld": "sldPipe",437 "sld_solvent": "sldSolv",438 "length_a": "short_side",439 "b2a_ratio": "b2a_ratio",440 "c2a_ratio": "c2a_ratio",441 }442 ],443 "lamellar": [444 "LamellarModel",445 {446 "sld": "sld_bi",447 "sld_solvent": "sld_sol",448 "thickness": "bi_thick"449 }450 ],451 "lamellar_hg": [452 "LamellarFFHGModel",453 {454 "sld": "sld_tail",455 "sld_solvent": "sld_solvent",456 "sld_head": "sld_head",457 "length_tail": "t_length",458 "length_head": "h_thickness"459 }460 ],461 "lamellar_hg_stack_caille": [462 "LamellarPSHGModel",463 {464 "sld": "sld_tail",465 "sld_head": "sld_head",466 "sld_solvent": "sld_solvent",467 "length_tail": "deltaT",468 "length_head": "deltaH",469 "d_spacing": "spacing",470 "Caille_parameter": "caille",471 "Nlayers": "n_plates",472 }473 ],474 "lamellar_stack_caille": [475 "LamellarPSModel",476 {477 "sld": "sld_bi",478 "sld_solvent": "sld_sol",479 "thickness": "delta",480 "d_spacing": "spacing",481 "Caille_parameter": "caille",482 "Nlayers": "n_plates",483 }484 ],485 "lamellar_stack_paracrystal": [486 "LamellarPCrystalModel",487 {488 "sld": "sld_layer",489 "sld_solvent": "sld_solvent",490 "thickness": "thickness",491 "d_spacing": "spacing",492 "sigma_d": "pd_spacing",493 "Nlayers": "Nlayers",494 }495 ],496 "line": [497 "LineModel",498 {499 "slope": "B",500 "scale": None,501 "background": None,502 "intercept": "A"503 }504 ],505 "linear_pearls": [506 "LinearPearlsModel",507 {508 "sld": "sld_pearl",509 "sld_solvent": "sld_solv",510 "edge_sep": "edge_separation"511 }512 ],513 "lorentz": [514 "Lorentz",515 {516 "cor_length": "length"517 },518 "LorentzModel",519 ],520 "mass_fractal": [521 "MassFractalModel",522 {523 "cutoff_length": "co_length",524 "radius": "radius",525 "fractal_dim_mass": "mass_dim"526 }527 ],528 "mass_surface_fractal": [529 "MassSurfaceFractal",530 {531 "rg_cluster": "cluster_rg",532 "fractal_dim_mass": "mass_dim",533 "radius": "radius",534 "fractal_dim_surf": "surface_dim",535 "rg_primary": "primary_rg"536 }537 ],538 "mono_gauss_coil": [539 "Debye",540 {541 "rg": "rg",542 "i_zero": "scale",543 "background": "background",544 },545 "DebyeModel",546 ],547 "multilayer_vesicle": [548 "MultiShellModel",549 {550 "radius": "core_radius",551 "sld_solvent": "core_sld",552 "n_shells": "n_pairs",553 "thick_shell": "s_thickness",554 "sld": "shell_sld",555 "thick_solvent": "w_thickness",556 }557 ],558 "onion": [559 "OnionExpShellModel",560 {561 "n_shells": "n_shells",562 "A": "A_shell",563 "sld_core": "sld_core0",564 "radius_core": "rad_core0",565 "sld_solvent": "sld_solv",566 "thickness": "thick_shell",567 "sld_in": "sld_in_shell",568 "sld_out": "sld_out_shell"569 }570 ],571 "parallelepiped": [572 "ParallelepipedModel",573 {574 "phi": "parallel_phi",575 "psi": "parallel_psi",576 "sld_solvent": "sldSolv",577 "length_a": "short_a",578 "length_b": "short_b",579 "sld": "sldPipe",580 "theta": "parallel_theta",581 "length_c": "long_c",582 "M0:sld": "M0_sld_pipe",583 "mtheta:sld": "M_theta_pipe",584 "mphi:sld": "M_phi_pipe",585 "M0:sld_solvent": "M0_sld_solv",586 "mtheta:sld_solvent": "M_theta_solv",587 "mphi:sld_solvent": "M_phi_solv",588 "up:frac_i": "Up_frac_i",589 "up:frac_f": "Up_frac_f",590 "up:angle": "Up_theta",591 }592 ],593 "peak_lorentz": [594 "Peak Lorentz Model",595 {596 "peak_pos": "q0",597 "peak_hwhm": "B"598 },599 "PeakLorentzModel",600 ],601 "pearl_necklace": [602 "PearlNecklaceModel",603 {604 "scale": "scale",605 "thick_string": "thick_string",606 "sld_string": "sld_string",607 "sld_solvent": "sld_solv",608 "edge_sep": "edge_separation",609 "num_pearls": "num_pearls",610 "radius": "radius",611 "background": "background",612 "sld": "sld_pearl"613 }614 ],615 "poly_gauss_coil": [616 "Poly_GaussCoil",617 {618 "rg": "rg",619 "polydispersity": "poly_m",620 "i_zero": "scale",621 "background": "background",622 }623 ],624 "polymer_excl_volume": [625 "PolymerExclVolume",626 {627 "rg": "rg",628 "scale": "scale",629 "background": "background",630 "porod_exp": "m"631 }632 ],633 "polymer_micelle": [634 "MicelleSphCoreModel",635 {636 "sld_corona": "rho_corona",637 "sld_solvent": "rho_solv",638 "sld_core": "rho_core",639 "ndensity": "ndensity",640 "v_core": "v_core",641 "v_corona": "v_corona",642 "radius_core": "radius_core",643 "rg": "radius_gyr",644 "d_penetration": "d_penetration",645 "n_aggreg": "n_aggreg",646 }647 ],648 "porod": [649 "PorodModel",650 {651 "scale": "scale",652 "background": "background"653 }654 ],655 "power_law": [656 "PowerLawAbsModel",657 {658 "scale": "scale",659 "background": "background",660 "power": "m"661 }662 ],663 "pringle": [664 "PringlesModel",665 {666 "scale": "scale",667 "sld_solvent": "sld_solvent",668 "thickness": "thickness",669 "beta": "beta",670 "radius": "radius",671 "background": "background",672 "alpha": "alpha",673 "sld": "sld_pringle"674 }675 ],676 "raspberry": [677 "RaspBerryModel",678 {679 "volfraction_lg": "volf_Lsph",680 "volfraction_sm": "volf_Ssph",681 "radius_sm": "radius_Ssph",682 "radius_lg": "radius_Lsph",683 "sld_lg": "sld_Lsph",684 "sld_sm": "sld_Ssph",685 "sld_solvent": "sld_solv",686 "surface_fraction": "surfrac_Ssph",687 "penetration": "delta_Ssph"688 }689 ],690 "rectangular_prism": [691 "RectangularPrismModel",692 {693 "sld": "sldPipe",694 "length_a": "short_side",695 "b2a_ratio": "b2a_ratio",696 "c2a_ratio": "c2a_ratio",697 "sld_solvent": "sldSolv"698 }699 ],700 "rpa": [701 "RPA10Model",702 {703 "K12": "Kab", "K13": "Kac", "K14": "Kad",704 "K23": "Kbc", "K24": "Kbd", "K34": "Kcd",705 "N1": "Na", "N2": "Nb", "N3": "Nc", "N4": "Nd",706 "L1": "La", "L2": "Lb", "L3": "Lc", "L4": "Ld",707 "v1": "va", "v2": "vb", "v3": "vc", "v4": "vd",708 "b1": "ba", "b2": "bb", "b3": "bc", "b4": "bd",709 "Phi1": "Phia", "Phi2": "Phib", "Phi3": "Phic", "Phi4": "Phid",710 "case_num": "lcase_n"711 }712 ],713 "sc_paracrystal": [714 "SCCrystalModel",715 {716 "sld": "sldSph",717 "sld_solvent": "sldSolv"718 }719 ],720 "sphere": [721 "SphereModel",722 {723 "sld": "sldSph",724 "radius": "radius",725 "sld_solvent": "sldSolv",726 "M0:sld": "M0_sld_sph",727 "mtheta:sld": "M_theta_sph",728 "mphi:sld": "M_phi_sph",729 "M0:sld_solvent": "M0_sld_solv",730 "mtheta:sld_solvent": "M_theta_solv",731 "mphi:sld_solvent": "M_phi_solv",732 "up:frac_i": "Up_frac_i",733 "up:frac_f": "Up_frac_f",734 "up:angle": "Up_theta"735 }736 ],737 "spherical_sld": [738 "SphericalSLDModel",739 # Be lazy and use a generator expression to define740 # sld1: sld_flat0, ...741 # thickness1: thick_flat0, ...742 # interface1: thick_inter0, ...743 # shape1: func_inter0, ...744 # nu1: nu_inter0, ...745 # but override thickness1 => rad_cor0 and sld1 => sld_core0.746 # Note: explicit key,value pairs given by **{...} override the747 # keys from the gnerator expression ((k,v) for k,v in seq) when748 # used as dict((generator), **{...})749 dict(((field_new+str(index+1), field_old+str(index))750 for field_new, field_old in [("sld", "sld_flat"),751 ("thickness", "thick_flat"),752 ("interface", "thick_inter"),753 ("shape", "func_inter"),754 ("nu", "nu_inter"),]755 for index in range(11)),756 **{757 "n_shells": "n_shells",758 "n_steps": "npts_inter",759 "sld_solvent": "sld_solv",760 "thickness1": "rad_core0",761 "sld1": "sld_core0",762 })763 ],764 "squarewell": [765 "SquareWellStructure",766 {767 "scale": "scale_factor",768 "radius_effective": "effect_radius",769 "wellwidth": "wellwidth",770 "welldepth": "welldepth",771 }772 ],773 "stacked_disks": [774 "StackedDisksModel",775 {776 "phi": "axis_phi",777 "sld_layer": "layer_sld",778 "sld_core": "core_sld",779 "theta": "axis_theta",780 "sld_solvent": "solvent_sld",781 "n_stacking": "n_stacking",782 "thick_layer": "layer_thick",783 "thick_core": "core_thick",784 }785 ],786 "star_polymer": [787 "StarPolymer",788 {789 "arms": "arms",790 "rg_squared": "R2"791 }792 ],793 "stickyhardsphere": [794 "StickyHSStructure",795 {796 "scale": "scale_factor",797 "radius_effective": "effect_radius",798 }799 ],800 "surface_fractal": [801 "SurfaceFractalModel",802 {803 "cutoff_length": "co_length",804 "radius": "radius",805 "fractal_dim_surf": "surface_dim"806 }807 ],808 "teubner_strey": [809 "TeubnerStreyModel",810 {811 # Note: parameters are completely rewritten in convert.py812 "volfraction_a": "volfraction_a",813 "sld_a": "sld_a",814 "sld_b": "sld_b",815 "d": "d",816 "xi": "xi",817 }818 ],819 "triaxial_ellipsoid": [820 "TriaxialEllipsoidModel",821 {822 "phi": "axis_phi",823 "radius_equat_minor": "semi_axisA",824 "radius_polar": "semi_axisC",825 "radius_equat_major": "semi_axisB",826 "sld_solvent": "sldSolv",827 "psi": "axis_psi",828 "sld": "sldEll",829 "theta": "axis_theta"830 }831 ],832 "two_lorentzian": [833 "TwoLorentzian",834 {835 "lorentz_scale_1": "scale_1",836 "lorentz_scale_2": "scale_2",837 "lorentz_exp_1": "exponent_1",838 "lorentz_exp_2": "exponent_2",839 "lorentz_length_2": "length_2",840 "lorentz_length_1": "length_1",841 "background": "background"842 },843 "TwoLorentzianModel",844 ],845 "two_power_law": [846 "TwoPowerLaw",847 {848 "coefficent_1": "coef_A",849 "power_2": "power2",850 "power_1": "power1",851 "background": "background",852 "crossover": "qc"853 },854 "TwoPowerLawModel",855 ],856 "unified_power_Rg": [857 "UnifiedPowerRg",858 dict(((field_new+str(index), field_old+str(index))859 for field_new, field_old in [("rg", "Rg"),860 ("power", "power"),861 ("G", "G"),862 ("B", "B"),]863 for index in range(11)),864 **{865 "background": "background",866 "scale": "scale",867 }),868 "UnifiedPowerRgModel",869 ],870 "vesicle": [871 "VesicleModel",872 {873 "sld": "shell_sld",874 "sld_solvent": "solv_sld"875 }876 ]31 (3, 1, 2) : { 32 "adsorbed_layer": [ 33 "Core2ndMomentModel", 34 { 35 "scale": "scale", 36 "second_moment": "second_moment", 37 "density_shell": "density_poly", 38 "sld_solvent": "sld_solv", 39 "radius": "radius_core", 40 "volfraction": "volf_cores", 41 "background": "background", 42 "adsorbed_amount": "ads_amount", 43 "sld_shell": "sld_poly" 44 } 45 ], 46 "barbell": [ 47 "BarBellModel", 48 { 49 "sld": "sld_barbell", 50 "length": "len_bar", 51 "radius_bell": "rad_bell", 52 "radius": "rad_bar", 53 "sld_solvent": "sld_solv" 54 } 55 ], 56 "bcc_paracrystal": [ 57 "BCCrystalModel", 58 { 59 "sld": "sldSph", 60 "sld_solvent": "sldSolv" 61 } 62 ], 63 "be_polyelectrolyte": [ 64 "BEPolyelectrolyte", 65 { 66 "ionization_degree": "alpha", 67 "polymer_concentration": "c", 68 "salt_concentration": "cs", 69 "virial_param": "h", 70 "background": "background", 71 "contrast_factor": "k", 72 "bjerrum_length": "lb", 73 "monomer_length": "b" 74 } 75 ], 76 "binary_hard_sphere": [ 77 "BinaryHSModel", 78 { 79 "sld_sm": "ss_sld", 80 "sld_lg": "ls_sld", 81 "volfraction_sm": "vol_frac_ss", 82 "radius_lg": "l_radius", 83 "radius_sm": "s_radius", 84 "volfraction_lg": "vol_frac_ls", 85 "sld_solvent": "solvent_sld" 86 } 87 ], 88 "broad_peak": [ 89 "BroadPeakModel", 90 { 91 "peak_pos": "q_peak", 92 "scale": None, 93 "lorentz_length": "length_l", 94 "porod_scale": "scale_p", 95 "lorentz_exp": "exponent_l", 96 "lorentz_scale": "scale_l", 97 "porod_exp": "exponent_p" 98 } 99 ], 100 "capped_cylinder": [ 101 "CappedCylinderModel", 102 { 103 "sld": "sld_capcyl", 104 "length": "len_cyl", 105 "radius_cap": "rad_cap", 106 "radius": "rad_cyl", 107 "sld_solvent": "sld_solv" 108 } 109 ], 110 "core_multi_shell": [ 111 "CoreMultiShellModel", 112 { 113 "thickness": "thick_shell", 114 "sld": "sld_shell", 115 "radius": "rad_core0", 116 "sld_core": "sld_core0", 117 "sld_solvent": "sld_solv", 118 "n": "n_shells", 119 "M0:sld_core": "M0_sld_core0", 120 "mtheta:sld_core": "M_theta_core0", 121 "mphi:sld_core": "M_phi_core0", 122 "M0:sld1": "M0_sld_shell1", 123 "mtheta:sld1": "M_theta_shell1", 124 "mphi:sld1": "M_phi_shell1", 125 "M0:sld2": "M0_sld_shell2", 126 "mtheta:sld2": "M_theta_shell2", 127 "mphi:sld2": "M_phi_shell2", 128 "M0:sld3": "M0_sld_shell3", 129 "mtheta:sld3": "M_theta_shell3", 130 "mphi:sld3": "M_phi_shell3", 131 "M0:sld4": "M0_sld_shell4", 132 "mtheta:sld4": "M_theta_shell4", 133 "mphi:sld4": "M_phi_shell4", 134 "M0:sld_solvent": "M0_sld_solv", 135 "mtheta:sld_solvent": "M_theta_solv", 136 "mphi:sld_solvent": "M_phi_solv", 137 "up:frac_i": "Up_frac_i", 138 "up:frac_f": "Up_frac_f", 139 "up:angle": "Up_theta", 140 } 141 ], 142 "core_shell_bicelle": [ 143 "CoreShellBicelleModel", 144 { 145 "phi": "axis_phi", 146 "sld_core": "core_sld", 147 "sld_rim": "rim_sld", 148 "thick_face": "face_thick", 149 "sld_solvent": "solvent_sld", 150 "thick_rim": "rim_thick", 151 "sld_face": "face_sld", 152 "theta": "axis_theta" 153 } 154 ], 155 "core_shell_cylinder": [ 156 "CoreShellCylinderModel", 157 { 158 "theta": "axis_theta", 159 "phi": "axis_phi", 160 "sld_shell": "shell_sld", 161 "sld_solvent": "solvent_sld", 162 "sld_core": "core_sld" 163 } 164 ], 165 "core_shell_ellipsoid:1": [ 166 "CoreShellEllipsoidModel", 167 { 168 "sld_core": "sld_core", 169 "sld_shell": "sld_shell", 170 "sld_solvent": "sld_solvent", 171 "radius_equat_core": "equat_core", 172 "x_core": "polar_core", 173 "thick_shell": "equat_shell", 174 "x_polar_shell": "polar_shell", 175 "theta": "axis_theta", 176 "phi": "axis_phi", 177 } 178 ], 179 "core_shell_ellipsoid": [ 180 "CoreShellEllipsoidXTModel", 181 { 182 "sld_core": "sld_core", 183 "sld_shell": "sld_shell", 184 "sld_solvent": "sld_solvent", 185 "radius_equat_core": "equat_core", 186 "thick_shell": "T_shell", 187 "x_core": "X_core", 188 "x_polar_shell": "XpolarShell", 189 "theta": "axis_theta", 190 "phi": "axis_phi", 191 } 192 ], 193 "core_shell_parallelepiped": [ 194 "CSParallelepipedModel", 195 { 196 "sld_core": "sld_pcore", 197 "sld_a": "sld_rimA", 198 "sld_b": "sld_rimB", 199 "sld_c": "sld_rimC", 200 "sld_solvent": "sld_solv", 201 "length_a": "shortA", 202 "length_b": "midB", 203 "length_c": "longC", 204 "thick_rim_a": "rimA", 205 "thick_rim_c": "rimC", 206 "thick_rim_b": "rimB", 207 "theta": "parallel_theta", 208 "phi": "parallel_phi", 209 "psi": "parallel_psi", 210 } 211 ], 212 "core_shell_sphere": [ 213 "CoreShellModel", 214 { 215 "sld_core": "core_sld", 216 "sld_shell": "shell_sld", 217 "sld_solvent": "solvent_sld", 218 "M0:sld_core": "M0_sld_core", 219 "mtheta:sld_core": "M_theta_core", 220 "mphi:sld_core": "M_phi_core", 221 "M0:sld_shell": "M0_sld_shell", 222 "mtheta:sld_shell": "M_theta_shell", 223 "mphi:sld_shell": "M_phi_shell", 224 "M0:sld_solvent": "M0_sld_solv", 225 "mtheta:sld_solvent": "M_theta_solv", 226 "mphi:sld_solvent": "M_phi_solv", 227 "up:frac_i": "Up_frac_i", 228 "up:frac_f": "Up_frac_f", 229 "up:angle": "Up_theta" 230 } 231 ], 232 "correlation_length": [ 233 "CorrLength", 234 { 235 "porod_scale": "scale_p", 236 "lorentz_scale": "scale_l", 237 "porod_exp": "exponent_p", 238 "lorentz_exp": "exponent_l", 239 "cor_length": "length_l" 240 }, 241 "CorrLengthModel" 242 ], 243 "cylinder": [ 244 "CylinderModel", 245 { 246 "sld": "sldCyl", 247 "theta": "cyl_theta", 248 "phi": "cyl_phi", 249 "sld_solvent": "sldSolv", 250 "M0:sld": "M0_sld_cyl", 251 "mtheta:sld": "M_theta_cyl", 252 "mphi:sld": "M_phi_cyl", 253 "M0:sld_solvent": "M0_sld_solv", 254 "mtheta:sld_solvent": "M_theta_solv", 255 "mphi:sld_solvent": "M_phi_solv", 256 "up:frac_i": "Up_frac_i", 257 "up:frac_f": "Up_frac_f", 258 "up:angle": "Up_theta" 259 } 260 ], 261 "dab": [ 262 "DABModel", 263 { 264 "cor_length": "length" 265 } 266 ], 267 "ellipsoid": [ 268 "EllipsoidModel", 269 { 270 "phi": "axis_phi", 271 "radius_equatorial": "radius_b", 272 "sld": "sldEll", 273 "theta": "axis_theta", 274 "radius_polar": "radius_a", 275 "sld_solvent": "sldSolv" 276 } 277 ], 278 "elliptical_cylinder": [ 279 "EllipticalCylinderModel", 280 { 281 "axis_ratio": "r_ratio", 282 "radius_minor": "r_minor", 283 "sld": "sldCyl", 284 "sld_solvent": "sldSolv", 285 "theta": "cyl_theta", 286 "phi": "cyl_phi", 287 "psi": "cyl_psi", 288 } 289 ], 290 "fcc_paracrystal": [ 291 "FCCrystalModel", 292 { 293 "sld": "sldSph", 294 "sld_solvent": "sldSolv" 295 } 296 ], 297 "flexible_cylinder": [ 298 "FlexibleCylinderModel", 299 { 300 "sld": "sldCyl", 301 "sld_solvent": "sldSolv" 302 } 303 ], 304 "flexible_cylinder_elliptical": [ 305 "FlexCylEllipXModel", 306 { 307 "sld": "sldCyl", 308 "sld_solvent": "sldSolv" 309 } 310 ], 311 "fractal": [ 312 "FractalModel", 313 { 314 "sld_block": "sldBlock", 315 "radius": "radius", 316 "cor_length": "cor_length", 317 "sld_solvent": "sldSolv", 318 "fractal_dim": "fractal_dim" 319 } 320 ], 321 "fractal_core_shell": [ 322 "FractalCoreShell", 323 { 324 "sld_core": "core_sld", 325 "sld_shell": "shell_sld", 326 "sld_solvent": "solvent_sld", 327 "radius": "radius", 328 "thickness": "thickness", 329 "fractal_dim": "frac_dim", 330 "cor_length": "cor_length", 331 "volfraction": "volfraction", 332 }, 333 "FractalCoreShellModel" 334 ], 335 "fuzzy_sphere": [ 336 "FuzzySphereModel", 337 { 338 "sld": "sldSph", 339 "fuzziness": "fuzziness", 340 "radius": "radius", 341 "sld_solvent": "sldSolv" 342 } 343 ], 344 "gauss_lorentz_gel": [ 345 "GaussLorentzGel", 346 { 347 "gauss_scale": "scale_g", 348 "cor_length_dynamic": "dyn_colength", 349 "cor_length_static": "stat_colength", 350 "background": "background", 351 "lorentz_scale": "scale_l" 352 }, 353 "GaussLorentzGelModel" 354 ], 355 "gaussian_peak": [ 356 "Peak Gauss Model", 357 { 358 "peak_pos": "q0", 359 "sigma": "B", 360 }, 361 "PeakGaussModel", 362 ], 363 "gel_fit": [ 364 "GelFitModel", 365 { 366 "rg": "radius", 367 "lorentz_scale": "lScale", 368 "guinier_scale": "gScale", 369 "fractal_dim": "FractalExp", 370 "cor_length": "zeta", 371 } 372 ], 373 "guinier": [ 374 "Guinier", 375 { 376 "rg": "rg" 377 }, 378 "GuinierModel", 379 ], 380 "guinier_porod": [ 381 "GuinierPorod", 382 { 383 "s": "dim", 384 "rg": "rg", 385 "porod_exp": "m", 386 "scale": "scale", 387 "background": "background" 388 }, 389 "GuinierPorodModel", 390 ], 391 "hardsphere": [ 392 "HardsphereStructure", 393 { 394 "scale": "scale_factor", 395 "radius_effective": "effect_radius", 396 } 397 ], 398 "hayter_msa": [ 399 "HayterMSAStructure", 400 { 401 "scale": "scale_factor", 402 "radius_effective": "effect_radius", 403 "volfraction": "volfraction", 404 "charge": "charge", 405 "temperature": "temperature", 406 "concentration_salt": "saltconc", 407 "dielectconst": "dielectconst", 408 } 409 ], 410 "hollow_cylinder": [ 411 "HollowCylinderModel", 412 { 413 "sld": "sldCyl", 414 "sld_solvent": "sldSolv", 415 "radius": "core_radius", 416 "thickness": "radius", 417 "length": "length", 418 "theta": "axis_theta", 419 "phi": "axis_phi", 420 } 421 ], 422 "hollow_rectangular_prism": [ 423 "RectangularHollowPrismModel", 424 { 425 "sld": "sldPipe", 426 "sld_solvent": "sldSolv", 427 "length_a": "short_side", 428 "b2a_ratio": "b2a_ratio", 429 "c2a_ratio": "c2a_ratio", 430 "thickness": "thickness", 431 } 432 ], 433 "hollow_rectangular_prism_thin_walls": [ 434 "RectangularHollowPrismInfThinWallsModel", 435 { 436 "sld": "sldPipe", 437 "sld_solvent": "sldSolv", 438 "length_a": "short_side", 439 "b2a_ratio": "b2a_ratio", 440 "c2a_ratio": "c2a_ratio", 441 } 442 ], 443 "lamellar": [ 444 "LamellarModel", 445 { 446 "sld": "sld_bi", 447 "sld_solvent": "sld_sol", 448 "thickness": "bi_thick" 449 } 450 ], 451 "lamellar_hg": [ 452 "LamellarFFHGModel", 453 { 454 "sld": "sld_tail", 455 "sld_solvent": "sld_solvent", 456 "sld_head": "sld_head", 457 "length_tail": "t_length", 458 "length_head": "h_thickness" 459 } 460 ], 461 "lamellar_hg_stack_caille": [ 462 "LamellarPSHGModel", 463 { 464 "sld": "sld_tail", 465 "sld_head": "sld_head", 466 "sld_solvent": "sld_solvent", 467 "length_tail": "deltaT", 468 "length_head": "deltaH", 469 "d_spacing": "spacing", 470 "Caille_parameter": "caille", 471 "Nlayers": "n_plates", 472 } 473 ], 474 "lamellar_stack_caille": [ 475 "LamellarPSModel", 476 { 477 "sld": "sld_bi", 478 "sld_solvent": "sld_sol", 479 "thickness": "delta", 480 "d_spacing": "spacing", 481 "Caille_parameter": "caille", 482 "Nlayers": "n_plates", 483 } 484 ], 485 "lamellar_stack_paracrystal": [ 486 "LamellarPCrystalModel", 487 { 488 "sld": "sld_layer", 489 "sld_solvent": "sld_solvent", 490 "thickness": "thickness", 491 "d_spacing": "spacing", 492 "sigma_d": "pd_spacing", 493 "Nlayers": "Nlayers", 494 } 495 ], 496 "line": [ 497 "LineModel", 498 { 499 "slope": "B", 500 "scale": None, 501 "background": None, 502 "intercept": "A" 503 } 504 ], 505 "linear_pearls": [ 506 "LinearPearlsModel", 507 { 508 "sld": "sld_pearl", 509 "sld_solvent": "sld_solv", 510 "edge_sep": "edge_separation" 511 } 512 ], 513 "lorentz": [ 514 "Lorentz", 515 { 516 "cor_length": "length" 517 }, 518 "LorentzModel", 519 ], 520 "mass_fractal": [ 521 "MassFractalModel", 522 { 523 "cutoff_length": "co_length", 524 "radius": "radius", 525 "fractal_dim_mass": "mass_dim" 526 } 527 ], 528 "mass_surface_fractal": [ 529 "MassSurfaceFractal", 530 { 531 "rg_cluster": "cluster_rg", 532 "fractal_dim_mass": "mass_dim", 533 "radius": "radius", 534 "fractal_dim_surf": "surface_dim", 535 "rg_primary": "primary_rg" 536 } 537 ], 538 "mono_gauss_coil": [ 539 "Debye", 540 { 541 "rg": "rg", 542 "i_zero": "scale", 543 "background": "background", 544 }, 545 "DebyeModel", 546 ], 547 "multilayer_vesicle": [ 548 "MultiShellModel", 549 { 550 "radius": "core_radius", 551 "sld_solvent": "core_sld", 552 "n_shells": "n_pairs", 553 "thick_shell": "s_thickness", 554 "sld": "shell_sld", 555 "thick_solvent": "w_thickness", 556 } 557 ], 558 "onion": [ 559 "OnionExpShellModel", 560 { 561 "n_shells": "n_shells", 562 "A": "A_shell", 563 "sld_core": "sld_core0", 564 "radius_core": "rad_core0", 565 "sld_solvent": "sld_solv", 566 "thickness": "thick_shell", 567 "sld_in": "sld_in_shell", 568 "sld_out": "sld_out_shell" 569 } 570 ], 571 "parallelepiped": [ 572 "ParallelepipedModel", 573 { 574 "phi": "parallel_phi", 575 "psi": "parallel_psi", 576 "sld_solvent": "sldSolv", 577 "length_a": "short_a", 578 "length_b": "short_b", 579 "sld": "sldPipe", 580 "theta": "parallel_theta", 581 "length_c": "long_c", 582 "M0:sld": "M0_sld_pipe", 583 "mtheta:sld": "M_theta_pipe", 584 "mphi:sld": "M_phi_pipe", 585 "M0:sld_solvent": "M0_sld_solv", 586 "mtheta:sld_solvent": "M_theta_solv", 587 "mphi:sld_solvent": "M_phi_solv", 588 "up:frac_i": "Up_frac_i", 589 "up:frac_f": "Up_frac_f", 590 "up:angle": "Up_theta", 591 } 592 ], 593 "peak_lorentz": [ 594 "Peak Lorentz Model", 595 { 596 "peak_pos": "q0", 597 "peak_hwhm": "B" 598 }, 599 "PeakLorentzModel", 600 ], 601 "pearl_necklace": [ 602 "PearlNecklaceModel", 603 { 604 "scale": "scale", 605 "thick_string": "thick_string", 606 "sld_string": "sld_string", 607 "sld_solvent": "sld_solv", 608 "edge_sep": "edge_separation", 609 "num_pearls": "num_pearls", 610 "radius": "radius", 611 "background": "background", 612 "sld": "sld_pearl" 613 } 614 ], 615 "poly_gauss_coil": [ 616 "Poly_GaussCoil", 617 { 618 "rg": "rg", 619 "polydispersity": "poly_m", 620 "i_zero": "scale", 621 "background": "background", 622 } 623 ], 624 "polymer_excl_volume": [ 625 "PolymerExclVolume", 626 { 627 "rg": "rg", 628 "scale": "scale", 629 "background": "background", 630 "porod_exp": "m" 631 } 632 ], 633 "polymer_micelle": [ 634 "MicelleSphCoreModel", 635 { 636 "sld_corona": "rho_corona", 637 "sld_solvent": "rho_solv", 638 "sld_core": "rho_core", 639 "ndensity": "ndensity", 640 "v_core": "v_core", 641 "v_corona": "v_corona", 642 "radius_core": "radius_core", 643 "rg": "radius_gyr", 644 "d_penetration": "d_penetration", 645 "n_aggreg": "n_aggreg", 646 } 647 ], 648 "porod": [ 649 "PorodModel", 650 { 651 "scale": "scale", 652 "background": "background" 653 } 654 ], 655 "power_law": [ 656 "PowerLawAbsModel", 657 { 658 "scale": "scale", 659 "background": "background", 660 "power": "m" 661 } 662 ], 663 "pringle": [ 664 "PringlesModel", 665 { 666 "scale": "scale", 667 "sld_solvent": "sld_solvent", 668 "thickness": "thickness", 669 "beta": "beta", 670 "radius": "radius", 671 "background": "background", 672 "alpha": "alpha", 673 "sld": "sld_pringle" 674 } 675 ], 676 "raspberry": [ 677 "RaspBerryModel", 678 { 679 "volfraction_lg": "volf_Lsph", 680 "volfraction_sm": "volf_Ssph", 681 "radius_sm": "radius_Ssph", 682 "radius_lg": "radius_Lsph", 683 "sld_lg": "sld_Lsph", 684 "sld_sm": "sld_Ssph", 685 "sld_solvent": "sld_solv", 686 "surface_fraction": "surfrac_Ssph", 687 "penetration": "delta_Ssph" 688 } 689 ], 690 "rectangular_prism": [ 691 "RectangularPrismModel", 692 { 693 "sld": "sldPipe", 694 "length_a": "short_side", 695 "b2a_ratio": "b2a_ratio", 696 "c2a_ratio": "c2a_ratio", 697 "sld_solvent": "sldSolv" 698 } 699 ], 700 "rpa": [ 701 "RPA10Model", 702 { 703 "K12": "Kab", "K13": "Kac", "K14": "Kad", 704 "K23": "Kbc", "K24": "Kbd", "K34": "Kcd", 705 "N1": "Na", "N2": "Nb", "N3": "Nc", "N4": "Nd", 706 "L1": "La", "L2": "Lb", "L3": "Lc", "L4": "Ld", 707 "v1": "va", "v2": "vb", "v3": "vc", "v4": "vd", 708 "b1": "ba", "b2": "bb", "b3": "bc", "b4": "bd", 709 "Phi1": "Phia", "Phi2": "Phib", "Phi3": "Phic", "Phi4": "Phid", 710 "case_num": "lcase_n" 711 } 712 ], 713 "sc_paracrystal": [ 714 "SCCrystalModel", 715 { 716 "sld": "sldSph", 717 "sld_solvent": "sldSolv" 718 } 719 ], 720 "sphere": [ 721 "SphereModel", 722 { 723 "sld": "sldSph", 724 "radius": "radius", 725 "sld_solvent": "sldSolv", 726 "M0:sld": "M0_sld_sph", 727 "mtheta:sld": "M_theta_sph", 728 "mphi:sld": "M_phi_sph", 729 "M0:sld_solvent": "M0_sld_solv", 730 "mtheta:sld_solvent": "M_theta_solv", 731 "mphi:sld_solvent": "M_phi_solv", 732 "up:frac_i": "Up_frac_i", 733 "up:frac_f": "Up_frac_f", 734 "up:angle": "Up_theta" 735 } 736 ], 737 "spherical_sld": [ 738 "SphericalSLDModel", 739 # Be lazy and use a generator expression to define 740 # sld1: sld_flat0, ... 741 # thickness1: thick_flat0, ... 742 # interface1: thick_inter0, ... 743 # shape1: func_inter0, ... 744 # nu1: nu_inter0, ... 745 # but override thickness1 => rad_cor0 and sld1 => sld_core0. 746 # Note: explicit key,value pairs given by **{...} override the 747 # keys from the gnerator expression ((k,v) for k,v in seq) when 748 # used as dict((generator), **{...}) 749 dict(((field_new+str(index+1), field_old+str(index)) 750 for field_new, field_old in [("sld", "sld_flat"), 751 ("thickness", "thick_flat"), 752 ("interface", "thick_inter"), 753 ("shape", "func_inter"), 754 ("nu", "nu_inter"),] 755 for index in range(11)), 756 **{ 757 "n_shells": "n_shells", 758 "n_steps": "npts_inter", 759 "sld_solvent": "sld_solv", 760 "thickness1": "rad_core0", 761 "sld1": "sld_core0", 762 }) 763 ], 764 "squarewell": [ 765 "SquareWellStructure", 766 { 767 "scale": "scale_factor", 768 "radius_effective": "effect_radius", 769 "wellwidth": "wellwidth", 770 "welldepth": "welldepth", 771 } 772 ], 773 "stacked_disks": [ 774 "StackedDisksModel", 775 { 776 "phi": "axis_phi", 777 "sld_layer": "layer_sld", 778 "sld_core": "core_sld", 779 "theta": "axis_theta", 780 "sld_solvent": "solvent_sld", 781 "n_stacking": "n_stacking", 782 "thick_layer": "layer_thick", 783 "thick_core": "core_thick", 784 } 785 ], 786 "star_polymer": [ 787 "StarPolymer", 788 { 789 "arms": "arms", 790 "rg_squared": "R2" 791 } 792 ], 793 "stickyhardsphere": [ 794 "StickyHSStructure", 795 { 796 "scale": "scale_factor", 797 "radius_effective": "effect_radius", 798 } 799 ], 800 "surface_fractal": [ 801 "SurfaceFractalModel", 802 { 803 "cutoff_length": "co_length", 804 "radius": "radius", 805 "fractal_dim_surf": "surface_dim" 806 } 807 ], 808 "teubner_strey": [ 809 "TeubnerStreyModel", 810 { 811 # Note: parameters are completely rewritten in convert.py 812 "volfraction_a": "volfraction_a", 813 "sld_a": "sld_a", 814 "sld_b": "sld_b", 815 "d": "d", 816 "xi": "xi", 817 } 818 ], 819 "triaxial_ellipsoid": [ 820 "TriaxialEllipsoidModel", 821 { 822 "phi": "axis_phi", 823 "radius_equat_minor": "semi_axisA", 824 "radius_polar": "semi_axisC", 825 "radius_equat_major": "semi_axisB", 826 "sld_solvent": "sldSolv", 827 "psi": "axis_psi", 828 "sld": "sldEll", 829 "theta": "axis_theta" 830 } 831 ], 832 "two_lorentzian": [ 833 "TwoLorentzian", 834 { 835 "lorentz_scale_1": "scale_1", 836 "lorentz_scale_2": "scale_2", 837 "lorentz_exp_1": "exponent_1", 838 "lorentz_exp_2": "exponent_2", 839 "lorentz_length_2": "length_2", 840 "lorentz_length_1": "length_1", 841 "background": "background" 842 }, 843 "TwoLorentzianModel", 844 ], 845 "two_power_law": [ 846 "TwoPowerLaw", 847 { 848 "coefficent_1": "coef_A", 849 "power_2": "power2", 850 "power_1": "power1", 851 "background": "background", 852 "crossover": "qc" 853 }, 854 "TwoPowerLawModel", 855 ], 856 "unified_power_Rg": [ 857 "UnifiedPowerRg", 858 dict(((field_new+str(index), field_old+str(index)) 859 for field_new, field_old in [("rg", "Rg"), 860 ("power", "power"), 861 ("G", "G"), 862 ("B", "B"),] 863 for index in range(11)), 864 **{ 865 "background": "background", 866 "scale": "scale", 867 }), 868 "UnifiedPowerRgModel", 869 ], 870 "vesicle": [ 871 "VesicleModel", 872 { 873 "sld": "shell_sld", 874 "sld_solvent": "solv_sld" 875 } 876 ] 877 877 } 878 878 } -
sasmodels/convert.py
r07c8d46 re65c3ba 4 4 from __future__ import print_function, division 5 5 6 import re7 6 import math 8 7 import warnings … … 64 63 return [pk*scale for pk in par] if isinstance(par, list) else par*scale 65 64 66 def _is_sld(model_info, id):65 def _is_sld(model_info, par): 67 66 """ 68 67 Return True if parameter is a magnetic magnitude or SLD parameter. 69 68 """ 70 if id.startswith('M0:'):69 if par.startswith('M0:'): 71 70 return True 72 if '_pd' in id or '.' in id:71 if '_pd' in par or '.' in par: 73 72 return False 74 73 for p in model_info.parameters.call_parameters: 75 if p.id == id:74 if p.id == par: 76 75 return p.type == 'sld' 77 76 # check through kernel parameters in case it is a named as a vector 78 77 for p in model_info.parameters.kernel_parameters: 79 if p.id == id:78 if p.id == par: 80 79 return p.type == 'sld' 81 80 return False … … 88 87 *scale=1e-6*. For forward conversion use *scale=1e6*. 89 88 """ 90 return dict(( id, (_rescale(v, scale) if _is_sld(model_info, id) else v))91 for id, v in pars.items())92 93 94 def _get_translation_table(model_info, version=(3, 1,2)):89 return dict((par, (_rescale(v, scale) if _is_sld(model_info, par) else v)) 90 for par, v in pars.items()) 91 92 93 def _get_translation_table(model_info, version=(3, 1, 2)): 95 94 conv_param = CONVERSION_TABLE.get(version, {}).get(model_info.id, [None, {}]) 96 95 translation = conv_param[1].copy() … … 130 129 newpars = pars.copy() 131 130 for new, old in mapping.items(): 132 if old == new: continue 133 if old is None: continue 134 for underscore, dot in PD_DOT: 131 if old == new: 132 continue 133 if old is None: 134 continue 135 for _, dot in PD_DOT: 135 136 source = old+dot 136 137 if source in newpars: … … 159 160 return None 160 161 161 def _hand_convert(name, oldpars, version=(3, 1,2)):162 if version == (3, 1,2):162 def _hand_convert(name, oldpars, version=(3, 1, 2)): 163 if version == (3, 1, 2): 163 164 oldpars = _hand_convert_3_1_2_to_4_1(name, oldpars) 164 165 return oldpars … … 295 296 return oldpars 296 297 297 def convert_model(name, pars, use_underscore=False, model_version=(3, 1,2)):298 def convert_model(name, pars, use_underscore=False, model_version=(3, 1, 2)): 298 299 """ 299 300 Convert model from old style parameter names to new style. … … 327 328 newpars = _convert_pars(newpars, translation) 328 329 # TODO: Still not convinced this is the best check 329 if not model_info.structure_factor and version == (3, 1,2):330 if not model_info.structure_factor and version == (3, 1, 2): 330 331 newpars = _rescale_sld(model_info, newpars, 1e6) 331 332 newpars.setdefault('scale', 1.0) … … 615 616 print("==== %s out ====="%new_name) 616 617 print(str(compare.parlist(model_info, new_pars, True))) 617 assert name ==new_name, "%r != %r"%(name, new_name)618 assert name == new_name, "%r != %r"%(name, new_name) 618 619 for k, v in new_pars.items(): 619 620 assert k in pars, "%s: %r appeared from conversion"%(name, k) 620 621 if isinstance(v, float): 621 assert abs(v-pars[k])<=abs(1e-12*v), "%s: %r %s != %s"%(name, k, v, pars[k]) 622 assert abs(v-pars[k]) <= abs(1e-12*v), \ 623 "%s: %r %s != %s"%(name, k, v, pars[k]) 622 624 else: 623 625 assert v == pars[k], "%s: %r %s != %s"%(name, k, v, pars[k]) -
sasmodels/core.py
r9e771a3 re65c3ba 10 10 11 11 import os 12 from os.path import basename, join as joinpath 13 from glob import glob 12 14 import re 13 from os.path import basename, dirname, join as joinpath14 from glob import glob15 15 16 16 import numpy as np # type: ignore … … 35 35 CUSTOM_MODEL_PATH = os.environ.get('SAS_MODELPATH', "") 36 36 if CUSTOM_MODEL_PATH == "": 37 path = joinpath(os.path.expanduser("~"), ".sasmodels", "custom_models") 38 if not os.path.isdir(path): 39 os.makedirs(path) 40 CUSTOM_MODEL_PATH = path 37 CUSTOM_MODEL_PATH = joinpath(os.path.expanduser("~"), ".sasmodels", "custom_models") 38 if not os.path.isdir(CUSTOM_MODEL_PATH): 39 os.makedirs(CUSTOM_MODEL_PATH) 41 40 42 41 try: -
sasmodels/data.py
ra1c5758 re65c3ba 64 64 data.qmin, data.qmax = data.x.min(), data.x.max() 65 65 data.mask = (np.isnan(data.y) if data.y is not None 66 else np.zeros_like(data.x, dtype='bool'))66 else np.zeros_like(data.x, dtype='bool')) 67 67 elif hasattr(data, 'qx_data'): 68 68 data.mask = ~data.mask … … 427 427 428 428 if getattr(data, 'radial', False): 429 radial_data.x = radial_data.q_data430 radial_data.y = radial_data.data429 data.x = data.q_data 430 data.y = data.data 431 431 432 432 use_data = use_data and data.y is not None -
sasmodels/generate.py
rff10479 re65c3ba 163 163 164 164 import sys 165 from os.path import abspath, dirname, join as joinpath, exists, isdir,getmtime165 from os.path import abspath, dirname, join as joinpath, exists, getmtime 166 166 import re 167 167 import string … … 654 654 line instead. 655 655 """ 656 for path, code in sources:656 for _path, code in sources: 657 657 if _IQXY_PATTERN.search(code): 658 658 return True 659 else: 660 return False 659 return False 661 660 662 661 … … 772 771 # TODO: allow mixed python/opencl kernels? 773 772 774 ocl = kernels(kernel_code, call_iq, call_iqxy, clear_iqxy, model_info.name)775 dll = kernels(kernel_code, call_iq, call_iqxy, clear_iqxy, model_info.name)773 ocl = _kernels(kernel_code, call_iq, call_iqxy, clear_iqxy, model_info.name) 774 dll = _kernels(kernel_code, call_iq, call_iqxy, clear_iqxy, model_info.name) 776 775 result = { 777 776 'dll': '\n'.join(source+dll[0]+dll[1]+dll[2]), … … 782 781 783 782 784 def kernels(kernel, call_iq, call_iqxy, clear_iqxy, name):783 def _kernels(kernel, call_iq, call_iqxy, clear_iqxy, name): 785 784 # type: ([str,str], str, str, str) -> List[str] 786 785 code = kernel[0] … … 931 930 932 931 def make_html(model_info): 932 # type: (ModelInfo) -> str 933 933 """ 934 934 Convert model docs directly to html. … … 940 940 941 941 def view_html(model_name): 942 # type: (str) -> None 943 """ 944 Load the model definition and view its help. 945 """ 942 946 from . import modelinfo 943 947 kernel_module = load_kernel_module(model_name) … … 946 950 947 951 def view_html_from_info(info): 952 # type: (ModelInfo) -> None 953 """ 954 View the help for a loaded model definition. 955 """ 948 956 from . import rst2html 949 957 url = "file://"+dirname(info.filename)+"/" … … 970 978 Program which prints the source produced by the model. 971 979 """ 972 import sys973 980 from .modelinfo import make_model_info 974 981 -
sasmodels/modelinfo.py
r6aee3ab re65c3ba 18 18 try: 19 19 from typing import Tuple, List, Union, Dict, Optional, Any, Callable, Sequence, Set 20 from types import ModuleType 20 21 except ImportError: 21 22 pass … … 499 500 for par in self.call_parameters: 500 501 if par.name == key: 501 break 502 else: 503 raise KeyError("unknown parameter %r"%key) 504 return par 502 return par 503 raise KeyError("unknown parameter %r"%key) 505 504 506 505 def __contains__(self, key): … … 508 507 if par.name == key: 509 508 return True 510 else: 511 return False 509 return False 512 510 513 511 def _set_vector_lengths(self): … … 526 524 """ 527 525 # Sort out the length of the vector parameters such as thickness[n] 528 529 526 for p in self.kernel_parameters: 530 527 if p.length_control: 531 for ref in self.kernel_parameters: 532 if ref.id == p.length_control: 533 break 534 else: 535 raise ValueError("no reference variable %r for %s" 536 % (p.length_control, p.name)) 528 ref = self._get_ref(p) 537 529 ref.is_control = True 538 530 ref.polydisperse = False … … 542 534 % ref.name) 543 535 p.length = int(high) 536 537 def _get_ref(self, p): 538 # type: (Parameter) -> Parameter 539 for ref in self.kernel_parameters: 540 if ref.id == p.length_control: 541 return ref 542 raise ValueError("no reference variable %r for %s" 543 % (p.length_control, p.name)) 544 544 545 545 def _get_defaults(self): … … 714 714 715 715 def _find_source_lines(model_info, kernel_module): 716 # type: (ModelInfo, ModuleType) -> None 716 717 """ 717 718 Identify the location of the C source inside the model definition file. … … 967 968 #: the SESANS correlation function. Note: not currently implemented. 968 969 sesans = None # type: Optional[Callable[[np.ndarray], np.ndarray]] 970 #: Returns a random parameter set for the model 971 random = None # type: Optional[Callable[[], Dict[str, float]]] 969 972 970 973 # line numbers within the python file for bits of C source, if defined -
sasmodels/rst2html.py
rdd4d95d re65c3ba 211 211 sys.exit(app.exec_()) 212 212 213 # Set default html viewer 214 view_html = view_html_qtapp 215 213 216 def can_use_qt(): 214 217 """ … … 249 252 import sys 250 253 view_help(sys.argv[1], qt=False) 251 -
sasmodels/sasview_model.py
r17db833 re65c3ba 186 186 sys.modules['sas.models'] = sas.sascalc.fit 187 187 sas.models = sas.sascalc.fit 188 189 188 import sas.models 190 189 from sasmodels.conversion_table import CONVERSION_TABLE 190 191 191 for new_name, conversion in CONVERSION_TABLE.get((3, 1, 2), {}).items(): 192 192 # CoreShellEllipsoidModel => core_shell_ellipsoid:1 … … 202 202 def MultiplicationModel(form_factor, structure_factor): 203 203 # type: ("SasviewModel", "SasviewModel") -> "SasviewModel" 204 """ 205 Returns a constructed product model from form_factor and structure_factor. 206 """ 204 207 model_info = product.make_product_info(form_factor._model_info, 205 208 structure_factor._model_info) -
sasmodels/special.py
r110f69c re65c3ba 192 192 193 193 """ 194 # pylint: disable=unused-import 195 194 196 import numpy as np 195 import scipy.special196 197 197 198 # Functions to add to our standard set … … 199 200 200 201 # C99 standard math library functions 201 M_PI, M_PI_2, M_PI_4, M_SQRT1_2, M_E = np.pi, np.pi/2, np.pi/4, np.sqrt(0.5), np.e202 202 from numpy import exp, log, power as pow, expm1, sqrt 203 203 from numpy import sin, cos, tan, arcsin as asin, arccos as acos, arctan as atan … … 207 207 from numpy import NAN, inf as INFINITY 208 208 209 # erf, erfc, tgamma, lgamma **do not use**210 211 # non-standard constants and functions212 M_PI_180, M_4PI_3 = M_PI/180, 4*M_PI/3213 214 # can't do SINCOS in python; use "s, c = SINCOS(x)" instead215 def SINCOS(x): return sin(x), cos(x)216 217 def square(x): return x*x218 219 def cube(x): return x*x*x220 221 from numpy import sinc as _sinc222 def sas_sinx_x(x): return _sinc(x/M_PI)223 def powr(x, y): return x**y224 def pown(x, n): return x**n225 226 FLOAT_SIZE = 8227 228 def polevl(x, c, n): return np.polyval(c[:n], x)229 def p1evl(x, c, n): return np.polyval(np.hstack(([1.], c))[:n], x)230 231 209 from scipy.special import gamma as sas_gamma 232 210 from scipy.special import erf as sas_erf … … 236 214 from scipy.special import jn as sas_JN 237 215 216 # erf, erfc, tgamma, lgamma **do not use** 217 218 # C99 standard math constants 219 M_PI, M_PI_2, M_PI_4, M_SQRT1_2, M_E = np.pi, np.pi/2, np.pi/4, np.sqrt(0.5), np.e 220 221 # non-standard constants 222 M_PI_180, M_4PI_3 = M_PI/180, 4*M_PI/3 223 224 # can't do SINCOS in python; use "s, c = SINCOS(x)" instead 225 def SINCOS(x): 226 """return sin(x), cos(x)""" 227 return sin(x), cos(x) 228 229 def square(x): 230 """return x^2""" 231 return x*x 232 233 def cube(x): 234 """return x^3""" 235 return x*x*x 236 237 def sas_sinx_x(x): 238 """return sin(x)/x""" 239 from numpy import sinc as _sinc 240 return _sinc(x/M_PI) 241 242 def powr(x, y): 243 """return x^y for x>0""" 244 return x**y 245 def pown(x, n): 246 """return x^n for n integer""" 247 return x**n 248 249 FLOAT_SIZE = 8 250 251 def polevl(x, c, n): 252 """return p(x) for polynomial p of degree n-1 with coefficients c""" 253 return np.polyval(c[:n], x) 254 255 def p1evl(x, c, n): 256 """return x^n + p(x) for polynomial p of degree n-1 with coefficients c""" 257 return np.polyval(np.hstack(([1.], c))[:n], x) 258 238 259 def sas_Si(x): 239 return scipy.special.sici(x)[0] 260 """return Si(x)""" 261 from scipy.special import sici 262 return sici(x)[0] 240 263 241 264 def sas_j1(x): 265 """return j1(x)""" 242 266 if np.isscalar(x): 243 267 retvalue = (sin(x) - x*cos(x))/x**2 if x != 0. else 0. … … 246 270 retvalue = (sin(x) - x*cos(x))/x**2 247 271 retvalue[x == 0.] = 0. 272 return retvalue 248 273 249 274 def sas_3j1x_x(x): 275 """return 3*j1(x)/x""" 250 276 if np.isscalar(x): 251 277 retvalue = 3*(sin(x) - x*cos(x))/x**3 if x != 0. else 1. … … 257 283 258 284 def sas_2J1x_x(x): 285 """return 2*J1(x)/x""" 259 286 if np.isscalar(x): 260 287 retvalue = 2*sas_J1(x)/x if x != 0 else 1.
Note: See TracChangeset
for help on using the changeset viewer.