Changeset fa79f5c in sasmodels for example


Ignore:
Timestamp:
Nov 29, 2017 8:43:12 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
a839b22
Parents:
32398dc
Message:

restore working sesans example using direct model

Location:
example
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • example/sesans_parameters_sphere.py

    r9217ef8 rfa79f5c  
    4646# DO NOT MODIFY THIS LINE 
    4747problem = sesansfit.sesans_fit(sesans_file, model, initial_vals, custom_params, param_range) 
    48  
  • example/sesans_sphere_2micron.py

    r3330bb4 rfa79f5c  
    11""" 
    2 This is a data file  used to load in sesans data and fit it using the bumps engine 
     2This is a data file used to load in sesans data and fit it using the bumps engine 
    33""" 
    44from bumps.names import * 
     
    3838# Constraints 
    3939# model.param_name = f(other params) 
    40 # EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is 
    41 # a custom parameter 
     40# EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius 
     41# and scale are model functions and phi is a custom parameter 
    4242model.scale = phi*(1-phi) 
    4343 
     
    4545# DO NOT MODIFY THIS LINE 
    4646problem = sesansfit.sesans_fit(sesans_file, model, initial_vals, custom_params, param_range) 
    47  
  • example/sesansfit.py

    r9217ef8 rfa79f5c  
     1import logging 
     2 
    13from bumps.names import * 
    24from sasmodels import core, bumps_model, sesans 
     
    810    return model 
    911 
    10 def sesans_fit(file, model, initial_vals={}, custom_params={}, param_range=[], acceptance_angle=None): 
     12def sesans_fit(file, model, initial_vals={}, custom_params={}, param_range=[], 
     13               acceptance_angle=None): 
    1114    """ 
    1215 
     
    1922    @return: FitProblem for Bumps usage 
    2023    """ 
     24    logging.basicConfig() 
     25 
    2126    initial_vals['background'] = 0.0 
    2227    try: 
    2328        loader = Loader() 
    24         data = loader.load(file) 
    25         if data is None: raise IOError("Could not load file %r"%(file)) 
     29        data = loader.load(file)[0] 
     30        if data is None: 
     31            raise IOError("Could not load file %r"%(file)) 
    2632 
    27     except: 
     33    except Exception: 
     34        raise 
    2835        # If no loadable data file, generate random data 
    2936        SElength = np.linspace(0, 2400, 61) # [A] 
     
    5057    data.Rmax = 30*radius # [A] 
    5158 
    52     if isinstance(model, basestring): 
     59    if isinstance(model, str): 
    5360        model = get_bumps_model(model) 
    5461 
  • example/spheres2micron.ses

    r6abf703 rfa79f5c  
    1 DataFileTitle   Polystyrene of Markus Strobl,  Full Sine, ++ only  
    2 Sample  Polystyrene 2 um in 53% H2O, 47% D2O  
    3 Settings        D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast  
    4 Operator        CPD  
    5 Date    ma 7 jul 2014 18:54:43  
    6 ScanType        sine one element scan  
    7 Thickness [mm]  2  
    8 Q_zmax [\AA^-1]         0.05  
    9 Q_ymax [\AA^-1]         0.05  
    10    
    11 spin echo length [nm]    error SEL       wavelength [nm]         error wavelength        polarisation    error pol  
    12 49.778  2.4889  0.211   0.01055 0.99782 0.0044367 
    13 63.041  3.152   0.211   0.01055 1.0026  0.0047862 
    14 76.487  3.8244  0.211   0.01055 0.99601 0.0060598 
    15 89.847  4.4924  0.211   0.01055 0.99175 0.0058257 
    16 103.41  5.1705  0.211   0.01055 0.99543 0.0060966 
    17 116.95  5.8475  0.211   0.01055 0.99512 0.0048106 
    18 130.61  6.5303  0.211   0.01055 0.9975  0.0062594 
    19 144.37  7.2184  0.211   0.01055 0.99473 0.005293 
    20 158.2   7.9102  0.211   0.01055 0.9927  0.0053389 
    21 172.12  8.6062  0.211   0.01055 0.99453 0.0064548 
    22 186.17  9.3087  0.211   0.01055 0.98641 0.0073259 
    23 200.28  10.014  0.211   0.01055 0.98879 0.0078682 
    24 214.46  10.723  0.211   0.01055 0.9895  0.0068058 
    25 228.73  11.436  0.211   0.01055 0.99204 0.0082509 
    26 243.12  12.156  0.211   0.01055 0.99406 0.0051381 
    27 257.55  12.878  0.211   0.01055 0.97965 0.0055447 
    28 272.22  13.611  0.211   0.01055 0.97982 0.0065843 
    29 286.9   14.345  0.211   0.01055 0.97793 0.0071814 
    30 301.73  15.087  0.211   0.01055 0.97835 0.0066197 
    31 316.75  15.838  0.211   0.01055 0.98125 0.0069484 
    32 331.82  16.591  0.211   0.01055 0.97828 0.0068737 
    33 347.16  17.358  0.211   0.01055 0.97682 0.006744 
    34 362.45  18.122  0.211   0.01055 0.98155 0.0059865 
    35 378.09  18.904  0.211   0.01055 0.96446 0.0066788 
    36 393.74  19.687  0.211   0.01055 0.97276 0.0073781 
    37 409.61  20.481  0.211   0.01055 0.97101 0.0071053 
    38 425.55  21.278  0.211   0.01055 0.97501 0.0068244 
    39 441.91  22.096  0.211   0.01055 0.96958 0.0072272 
    40 458.12  22.906  0.211   0.01055 0.95991 0.0064035 
    41 474.77  23.739  0.211   0.01055 0.96219 0.0059227 
    42 491.52  24.576  0.211   0.01055 0.96016 0.0058606 
    43 508.51  25.426  0.211   0.01055 0.9509  0.0049836 
    44 525.68  26.284  0.211   0.01055 0.95558 0.0055218 
    45 543.08  27.154  0.211   0.01055 0.95079 0.0058258 
    46 560.74  28.037  0.211   0.01055 0.9514  0.0043921 
    47 578.69  28.935  0.211   0.01055 0.94562 0.0046962 
    48 596.75  29.838  0.211   0.01055 0.94588 0.0047341 
    49 615.17  30.758  0.211   0.01055 0.93958 0.0045821 
    50 633.77  31.688  0.211   0.01055 0.93731 0.0043108 
    51 652.82  32.641  0.211   0.01055 0.93664 0.0052044 
    52 672.04  33.602  0.211   0.01055 0.93209 0.0035563 
    53 691.57  34.578  0.211   0.01055 0.93385 0.0046002 
    54 711.48  35.574  0.211   0.01055 0.93028 0.0051136 
    55 731.67  36.583  0.211   0.01055 0.93012 0.0035279 
    56 752.17  37.608  0.211   0.01055 0.92594 0.0039458 
    57 773.1   38.655  0.211   0.01055 0.92352 0.0027613 
    58 794.42  39.721  0.211   0.01055 0.91823 0.0034587 
    59 816.14  40.807  0.211   0.01055 0.90862 0.0034262 
    60 838.19  41.91   0.211   0.01055 0.91909 0.003498 
    61 860.69  43.034  0.211   0.01055 0.91013 0.0030537 
    62 883.74  44.187  0.211   0.01055 0.90449 0.0035391 
    63 907.04  45.352  0.211   0.01055 0.90057 0.0029672 
    64 930.95  46.547  0.211   0.01055 0.90316 0.0031245 
    65 955.38  47.769  0.211   0.01055 0.89492 0.0030981 
    66 980.25  49.013  0.211   0.01055 0.89636 0.0036625 
    67 1005.7  50.284  0.211   0.01055 0.88808 0.0022652 
    68 1031.7  51.586  0.211   0.01055 0.88665 0.0044622 
    69 1058.3  52.914  0.211   0.01055 0.88205 0.0030275 
    70 1085.5  54.276  0.211   0.01055 0.88257 0.0028637 
    71 1113.4  55.669  0.211   0.01055 0.87629 0.0030312 
    72 1141.9  57.093  0.211   0.01055 0.87732 0.0026539 
    73 1171    58.55   0.211   0.01055 0.87361 0.0034591 
    74 1201    60.052  0.211   0.01055 0.86595 0.0028129 
    75 1231.6  61.582  0.211   0.01055 0.86804 0.0043311 
    76 1263    63.151  0.211   0.01055 0.86676 0.0028806 
    77 1295.2  64.762  0.211   0.01055 0.85655 0.0028657 
    78 1328.4  66.419  0.211   0.01055 0.85794 0.0034773 
    79 1362.3  68.113  0.211   0.01055 0.85521 0.0032798 
    80 1397.1  69.854  0.211   0.01055 0.84974 0.0044537 
    81 1432.9  71.644  0.211   0.01055 0.84149 0.0032738 
    82 1469.7  73.487  0.211   0.01055 0.84801 0.0037874 
    83 1507.5  75.376  0.211   0.01055 0.84334 0.003206 
    84 1546.4  77.318  0.211   0.01055 0.83749 0.0040707 
    85 1586.4  79.322  0.211   0.01055 0.83921 0.0049938 
    86 1627.6  81.381  0.211   0.01055 0.83434 0.0057337 
    87 1669.9  83.497  0.211   0.01055 0.82878 0.0062417 
    88 1713.6  85.678  0.211   0.01055 0.82309 0.0080179 
    89 1758.5  87.927  0.211   0.01055 0.82433 0.0074191 
    90 1804.8  90.239  0.211   0.01055 0.82023 0.0076431 
    91 1852.5  92.627  0.211   0.01055 0.82756 0.0063064 
    92 1901.7  95.087  0.211   0.01055 0.82584 0.0052944 
    93 1952.4  97.622  0.211   0.01055 0.82799 0.0050662 
    94 2004.8  100.24  0.211   0.01055 0.82345 0.0043127 
    95 2058.8  102.94  0.211   0.01055 0.82296 0.0038 
    96 2114.5  105.72  0.211   0.01055 0.81987 0.0034072 
    97 2172    108.6   0.211   0.01055 0.82021 0.0036752 
    98 2231.4  111.57  0.211   0.01055 0.82765 0.0028851 
    99 2292.8  114.64  0.211   0.01055 0.82664 0.0038942 
    100 2356.2  117.81  0.211   0.01055 0.82702 0.0047371 
    101 2421.8  121.09  0.211   0.01055 0.81593 0.0043772 
    102 2489.6  124.48  0.211   0.01055 0.8251  0.0028026 
    103 2559.5  127.98  0.211   0.01055 0.8292  0.0024574 
    104 2631.9  131.59  0.211   0.01055 0.82626 0.0036198 
    105 2706.8  135.34  0.211   0.01055 0.8208  0.0032314 
    106 2784.3  139.22  0.211   0.01055 0.81959 0.0042731 
    107 2864.5  143.23  0.211   0.01055 0.82653 0.002699 
    108 2947.5  147.38  0.211   0.01055 0.82401 0.0036726 
    109 3033.5  151.67  0.211   0.01055 0.82361 0.0048224 
    110 3122.4  156.12  0.211   0.01055 0.82358 0.0041221 
    111 3214.5  160.73  0.211   0.01055 0.82187 0.0028807 
    112 3310.1  165.5   0.211   0.01055 0.82644 0.003516 
    113 3409    170.45  0.211   0.01055 0.82355 0.0021166 
    114 3511.4  175.57  0.211   0.01055 0.82513 0.0033911 
    115 3617.6  180.88  0.211   0.01055 0.82802 0.0015342 
    116 3727.6  186.38  0.211   0.01055 0.82663 0.0029222 
    117 3841.7  192.08  0.211   0.01055 0.82026 0.0020755 
    118 3960    198     0.211   0.01055 0.83079 0.0026394 
    119 4082.7  204.13  0.211   0.01055 0.82665 0.0027466 
    120 4209.9  210.5   0.211   0.01055 0.82774 0.0025199 
    121 4341.9  217.09  0.211   0.01055 0.83489 0.0030619 
    122 4478.7  223.94  0.211   0.01055 0.81987 0.0020988 
    123 4620.8  231.04  0.211   0.01055 0.8253  0.0023899 
    124 4768.2  238.41  0.211   0.01055 0.82653 0.0022851 
    125 4921.1  246.06  0.211   0.01055 0.82442 0.003383 
    126 5079.8  253.99  0.211   0.01055 0.82827 0.0015979 
    127 5244.7  262.23  0.211   0.01055 0.82494 0.0031129 
    128 5415.7  270.79  0.211   0.01055 0.82183 0.0030149 
    129 5593.3  279.67  0.211   0.01055 0.83217 0.0046976 
    130 5777.8  288.89  0.211   0.01055 0.82227 0.005574 
    131 5969.3  298.46  0.211   0.01055 0.82338 0.0025569 
     1FileFormatVersion       1.0 
     2DataFileTitle           Polystyrene of Markus Strobl,  Full Sine, ++ only 
     3Sample                  Polystyrene 2 um in 53% H2O, 47% D2O 
     4Settings                D1=D2=20x8 mm,Ds = 16x10 mm (WxH), GF1 =scanning, GF2 = 2.5 A. 2 um polystyrene in 53% H2O, 47% D2O; 8.55% contrast 
     5Operator                CPD 
     6Date                    do 10 jul 2014 16:37:30 
     7ScanType                sine one element scan 
     8Thickness               2.00E-01 
     9Thickness_unit          cm 
     10Theta_zmax              0.0168 
     11Theta_zmax_unit         radians 
     12Theta_ymax              0.0168 
     13Theta_ymax_unit         radians 
     14Orientation             Z 
     15SpinEchoLength_unit     A 
     16Depolarisation_unit     A-2 cm-1 
     17Wavelength_unit         A 
     18 
     19BEGIN_DATA 
     20SpinEchoLength Depolarisation Depolarisation_error SpinEchoLength_error Wavelength Wavelength_error Polarisation  Polarisation_error 
     21391.56 0.0041929 0.0036894 19.578 2.11 0.1055 1.0037 0.0032974 
     221564 -0.0046571 0.0038185 78.2 2.11 0.1055 0.99586 0.003386 
     232735.6 -0.017007 0.0038132 136.78 2.11 0.1055 0.98497 0.0033444 
     243907.9 -0.033462 0.0035068 195.39 2.11 0.1055 0.97064 0.0030309 
     255080.2 -0.047483 0.0038208 254.01 2.11 0.1055 0.9586 0.0032613 
     266251.8 -0.070375 0.00376 312.59 2.11 0.1055 0.93926 0.0031446 
     277423.2 -0.092217 0.0037927 371.16 2.11 0.1055 0.92117 0.0031108 
     288595.5 -0.10238 0.004006 429.77 2.11 0.1055 0.91287 0.0032562 
     299767.7 -0.12672 0.0038534 488.39 2.11 0.1055 0.8933 0.0030651 
     3010940 -0.1374 0.004243 546.98 2.11 0.1055 0.88484 0.003343 
     3112112 -0.16072 0.0045837 605.58 2.11 0.1055 0.86666 0.0035372 
     3213284 -0.16623 0.0045613 664.2 2.11 0.1055 0.86242 0.0035027 
     3314456 -0.18468 0.0044918 722.79 2.11 0.1055 0.84837 0.0033931 
     3415628 -0.19143 0.0048967 781.38 2.11 0.1055 0.84328 0.0036768 
     3516800 -0.20029 0.0045421 840.02 2.11 0.1055 0.83666 0.0033837 
     3617971 -0.19798 0.0046642 898.56 2.11 0.1055 0.83838 0.0034819 
     3719143 -0.21442 0.0047052 957.17 2.11 0.1055 0.82619 0.0034614 
     3820316 -0.20885 0.0044931 1015.8 2.11 0.1055 0.8303 0.0033218 
     3921488 -0.21393 0.0049186 1074.4 2.11 0.1055 0.82655 0.00362 
     4022660 -0.20685 0.004423 1133 2.11 0.1055 0.83179 0.0032758 
     4123832 -0.20802 0.0046979 1191.6 2.11 0.1055 0.83092 0.0034758 
     4225003 -0.19848 0.0045953 1250.2 2.11 0.1055 0.838 0.0034289 
     4326175 -0.21117 0.0044567 1308.8 2.11 0.1055 0.82859 0.0032881 
     4427347 -0.21283 0.004137 1367.4 2.11 0.1055 0.82736 0.0030477 
     4528520 -0.2042 0.0044587 1426 2.11 0.1055 0.83375 0.0033101 
     4629692 -0.2112 0.0042852 1484.6 2.11 0.1055 0.82857 0.0031615 
     4730864 -0.20319 0.0043483 1543.2 2.11 0.1055 0.8345 0.003231 
     4832036 -0.20752 0.0044297 1601.8 2.11 0.1055 0.83129 0.0032788 
     4933207 -0.20654 0.0043188 1660.4 2.11 0.1055 0.83201 0.0031995 
     5034380 -0.20126 0.0046375 1719 2.11 0.1055 0.83593 0.0034518 
     5135551 -0.20924 0.0042871 1777.6 2.11 0.1055 0.83001 0.0031684 
     5236724 -0.21323 0.0045471 1836.2 2.11 0.1055 0.82707 0.0033487 
     5337895 -0.21324 0.0045354 1894.7 2.11 0.1055 0.82706 0.00334 
     5439067 -0.19905 0.0044141 1953.4 2.11 0.1055 0.83758 0.003292 
     5540239 -0.1991 0.0047441 2012 2.11 0.1055 0.83754 0.003538 
     5641411 -0.20359 0.0050136 2070.5 2.11 0.1055 0.8342 0.003724 
     5742583 -0.21032 0.0049474 2129.1 2.11 0.1055 0.82922 0.0036529 
     5843755 -0.20689 0.0048203 2187.8 2.11 0.1055 0.83176 0.00357 
     5944927 -0.21075 0.0052337 2246.4 2.11 0.1055 0.8289 0.0038628 
     6046099 -0.19956 0.0047827 2304.9 2.11 0.1055 0.8372 0.0035653 
Note: See TracChangeset for help on using the changeset viewer.