- Timestamp:
- Mar 6, 2017 5:25:51 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:
- 20c856a, 3a45c2c
- Parents:
- acfb094
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
example/fit.py
r1182da5 rf4b36fa 24 24 % section) 25 25 data = radial_data if section != "tangential" else tan_data 26 phi = 0 if section != "tangential" else 90 26 theta = 89.9 if section != "tangential" else 0 27 phi = 90 27 28 kernel = load_model(name, dtype="single") 28 29 cutoff = 1e-3 … … 30 31 if name == "ellipsoid": 31 32 model = Model(kernel, 32 scale=0.08, 33 r _polar=15, r_equatorial=800,33 scale=0.08, background=35, 34 radius_polar=15, radius_equatorial=800, 34 35 sld=.291, sld_solvent=7.105, 35 background=0, 36 theta=90, phi=phi, 37 theta_pd=15, theta_pd_n=40, theta_pd_nsigma=3, 38 r_polar_pd=0.222296, r_polar_pd_n=1, r_polar_pd_nsigma=0, 39 r_equatorial_pd=.000128, r_equatorial_pd_n=1, r_equatorial_pd_nsigma=0, 36 theta=theta, phi=phi, 37 theta_pd=0, theta_pd_n=0, theta_pd_nsigma=3, 40 38 phi_pd=0, phi_pd_n=20, phi_pd_nsigma=3, 39 radius_polar_pd=0.222296, radius_polar_pd_n=1, radius_polar_pd_nsigma=0, 40 radius_equatorial_pd=.000128, radius_equatorial_pd_n=1, radius_equatorial_pd_nsigma=0, 41 41 ) 42 42 43 44 43 # SET THE FITTING PARAMETERS 45 model.r_polar.range(15, 1000) 46 model.r_equatorial.range(15, 1000) 47 model.theta_pd.range(0, 360) 44 model.radius_polar.range(15, 1000) 45 model.radius_equatorial.range(15, 1000) 46 #model.theta.range(0, 90) 47 #model.theta_pd.range(0,10) 48 model.phi_pd.range(0,20) 49 model.phi.range(0, 180) 48 50 model.background.range(0,1000) 49 51 model.scale.range(0, 10) 50 52 51 53 52 53 54 elif name == "lamellar": 54 55 model = Model(kernel, 55 scale=0.08, 56 scale=0.08, background=0.003, 56 57 thickness=19.2946, 57 58 sld=5.38,sld_sol=7.105, 58 background=0.003,59 59 thickness_pd= 0.37765, thickness_pd_n=10, thickness_pd_nsigma=3, 60 60 ) 61 62 61 63 62 # SET THE FITTING PARAMETERS … … 77 76 radius_pd=.0084, radius_pd_n=10, radius_pd_nsigma=3, 78 77 length_pd=0.493, length_pd_n=10, length_pd_nsigma=3, 79 phi_pd=0, phi_pd_n=5 ,phi_pd_nsigma=3,)78 phi_pd=0, phi_pd_n=5 phi_pd_nsigma=3,) 80 79 """ 81 80 pars = dict( 82 81 scale=.01, background=35, 83 82 sld=.291, sld_solvent=5.77, 84 radius=250, length=178, 85 theta=90, phi=phi, 83 radius=250, length=178, 86 84 radius_pd=0.1, radius_pd_n=5, radius_pd_nsigma=3, 87 85 length_pd=0.1,length_pd_n=5, length_pd_nsigma=3, 88 theta_pd=10, theta_pd_n=50, theta_pd_nsigma=3, 89 phi_pd=0, phi_pd_n=10, phi_pd_nsigma=3) 86 theta=theta, phi=phi, 87 theta_pd=0, theta_pd_n=0, theta_pd_nsigma=3, 88 phi_pd=10, phi_pd_n=20, phi_pd_nsigma=3) 90 89 model = Model(kernel, **pars) 91 90 … … 93 92 model.radius.range(1, 500) 94 93 model.length.range(1, 5000) 95 model.theta.range(-90,100)96 model. theta_pd.range(0, 30)97 model. theta_pd_n = model.theta_pd + 594 #model.theta.range(0, 90) 95 model.phi.range(0, 180) 96 model.phi_pd.range(0, 30) 98 97 model.radius_pd.range(0, 1) 99 model.length_pd.range(0, 2)98 model.length_pd.range(0, 1) 100 99 model.scale.range(0, 10) 101 100 model.background.range(0, 100) … … 104 103 elif name == "core_shell_cylinder": 105 104 model = Model(kernel, 106 scale= .031, radius=19.5, thickness=30, length=22, 107 sld_core=7.105, sld_shell=.291, sdl_solvent=7.105, 108 background=0, theta=0, phi=phi, 109 105 scale= .031, background=0, 106 radius=19.5, thickness=30, length=22, 107 sld_core=7.105, sld_shell=.291, sld_solvent=7.105, 110 108 radius_pd=0.26, radius_pd_n=10, radius_pd_nsigma=3, 111 109 length_pd=0.26, length_pd_n=10, length_pd_nsigma=3, 112 110 thickness_pd=1, thickness_pd_n=1, thickness_pd_nsigma=1, 113 theta_pd=1, theta_pd_n=10, theta_pd_nsigma=3, 114 phi_pd=0.1, phi_pd_n=1, phi_pd_nsigma=1, 111 theta=theta, phi=phi, 112 theta_pd=1, theta_pd_n=1, theta_pd_nsigma=3, 113 phi_pd=0, phi_pd_n=20, phi_pd_nsigma=3, 115 114 ) 116 115 117 116 # SET THE FITTING PARAMETERS 118 #model.radius.range(115, 1000)119 #model.length.range(0, 2500)117 model.radius.range(115, 1000) 118 model.length.range(0, 2500) 120 119 #model.thickness.range(18, 38) 121 120 #model.thickness_pd.range(0, 1) 122 121 #model.phi.range(0, 90) 122 model.phi_pd.range(0,20) 123 123 #model.radius_pd.range(0, 1) 124 124 #model.length_pd.range(0, 1) … … 131 131 elif name == "capped_cylinder": 132 132 model = Model(kernel, 133 scale=.08, radius=20, cap_radius=40, length=400, 133 scale=.08, background=35, 134 radius=20, cap_radius=40, length=400, 134 135 sld=1, sld_solvent=6.3, 135 background=0, theta=0, phi=phi,136 136 radius_pd=.1, radius_pd_n=5, radius_pd_nsigma=3, 137 137 cap_radius_pd=.1, cap_radius_pd_n=5, cap_radius_pd_nsigma=3, 138 138 length_pd=.1, length_pd_n=1, length_pd_nsigma=0, 139 theta_pd=.1, theta_pd_n=1, theta_pd_nsigma=0, 140 phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0, 139 theta=theta, phi=phi, 140 theta_pd=0, theta_pd_n=1, theta_pd_nsigma=0, 141 phi_pd=10, phi_pd_n=20, phi_pd_nsigma=0, 141 142 ) 142 143 144 model.radius.range(115, 1000) 145 model.length.range(0, 2500) 146 #model.thickness.range(18, 38) 147 #model.thickness_pd.range(0, 1) 148 #model.phi.range(0, 90) 149 model.phi_pd.range(0,20) 150 #model.radius_pd.range(0, 1) 151 #model.length_pd.range(0, 1) 152 #model.theta_pd.range(0, 360) 153 #model.background.range(0,5) 143 154 model.scale.range(0, 1) 144 155 … … 146 157 elif name == "triaxial_ellipsoid": 147 158 model = Model(kernel, 148 scale=0.08, req_minor=15, req_major=20, rpolar=500, 159 scale=0.08, background=35, 160 radius_equat_minor=15, radius_equat_major=20, radius_polar=500, 149 161 sld=7.105, solvent_sld=.291, 150 background=5, theta=0, phi=phi, psi=0, 162 radius_equat_minor_pd=.1, radius_equat_minor_pd_n=1, radius_equat_minor_pd_nsigma=0, 163 radius_equat_major_pd=.1, radius_equat_major_pd_n=1, radius_equat_major_pd_nsigma=0, 164 radius_polar_pd=.1, radius_polar_pd_n=1, radius_polar_pd_nsigma=0, 165 theta=theta, phi=phi, psi=0, 151 166 theta_pd=20, theta_pd_n=40, theta_pd_nsigma=3, 152 167 phi_pd=.1, phi_pd_n=1, phi_pd_nsigma=0, 153 168 psi_pd=30, psi_pd_n=1, psi_pd_nsigma=0, 154 req_minor_pd=.1, req_minor_pd_n=1, req_minor_pd_nsigma=0,155 req_major_pd=.1, req_major_pd_n=1, req_major_pd_nsigma=0,156 rpolar_pd=.1, rpolar_pd_n=1, rpolar_pd_nsigma=0,157 169 ) 158 170 159 171 # SET THE FITTING PARAMETERS 160 model.r eq_minor.range(15, 1000)161 model.r eq_major.range(15, 1000)162 #model.r polar.range(15, 1000)172 model.radius_equat_minor.range(15, 1000) 173 model.radius_equat_major.range(15, 1000) 174 #model.radius_polar.range(15, 1000) 163 175 #model.background.range(0,1000) 164 176 #model.theta_pd.range(0, 360) … … 173 185 M = Experiment(data=data, model=model) 174 186 if section == "both": 175 tan_model = Model(model. kernel, **model.parameters())187 tan_model = Model(model.sasmodel, **model.parameters()) 176 188 tan_model.phi = model.phi - 90 177 189 tan_model.cutoff = cutoff
Note: See TracChangeset
for help on using the changeset viewer.