Changeset f942f4d in sasmodels
- Timestamp:
- Mar 28, 2019 10:23:15 AM (6 years ago)
- Branches:
- master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
- Children:
- 9562dd2, b39bf3b
- Parents:
- 6652522 (diff), 6dccecc (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/direct_model.py
rfacb052 ra7db39fa 59 59 """ 60 60 mesh = get_mesh(calculator.info, pars, dim=calculator.dim, mono=mono) 61 print("in call_kernel: pars:", list(zip(*mesh))[0])61 #print("in call_kernel: pars:", list(zip(*mesh))[0]) 62 62 call_details, values, is_magnetic = make_kernel_args(calculator, mesh) 63 63 #print("in call_kernel: values:", values) … … 118 118 active = lambda name: True 119 119 120 print("in get_mesh: pars:",[p.id for p in parameters.call_parameters])120 #print("in get_mesh: pars:",[p.id for p in parameters.call_parameters]) 121 121 mesh = [_get_par_weights(p, values, active(p.name)) 122 122 for p in parameters.call_parameters] -
sasmodels/model_test.py
r6652522 rf942f4d 240 240 s_name = pars.pop('@S') 241 241 ps_test = [pars] + list(test[1:]) 242 #print("PS TEST PARAMS!!!",ps_test) 242 243 # build the P@S model 243 244 s_info = load_model_info(s_name) 244 #print("in run_all: s_info:", s_info)245 245 ps_info = product.make_product_info(self.info, s_info) 246 246 ps_model = build_model(ps_info, dtype=self.dtype, 247 247 platform=self.platform) 248 248 # run the tests 249 self.info = ps_model.info 250 #print("SELF.INFO PARAMS!!!",[p.id for p in self.info.parameters.call_parameters]) 251 #print("PS MODEL PARAMETERS:",[p.id for p in ps_model.info.parameters.call_parameters]) 249 252 results.append(self.run_one(ps_model, ps_test)) 250 253 … … 397 400 if par == product.STRUCTURE_MODE_ID: 398 401 continue 399 if par == "radius_effective": # test should not need this??400 continue401 402 parts = par.split('_pd') 402 403 if len(parts) > 1 and parts[1] not in ("", "_n", "nsigma", "type"): -
sasmodels/models/cylinder.py
r0b8a1fc r6652522 110 110 ---------------------------- 111 111 112 * **Author:** 113 * **Last Modified by:** 114 * **Last Reviewed by:** 112 * **Author:** 113 * **Last Modified by:** 114 * **Last Reviewed by:** 115 115 * **Source added by :** Steve King **Date:** March 25, 2019 116 116 """ … … 184 184 phi_pd=10, phi_pd_n=5) 185 185 186 # pylint: disable=bad-whitespace, line-too-long186 # Test 1-D and 2-D models 187 187 qx, qy = 0.2 * np.cos(2.5), 0.2 * np.sin(2.5) 188 # After redefinition of angles, find new tests values. Was 10 10 in old coords 188 theta, phi = 80.1534480601659, 10.1510817110481 # (10, 10) in sasview 3.x 189 189 tests = [ 190 190 [{}, 0.2, 0.042761386790780453], 191 191 [{}, [0.2], [0.042761386790780453]], 192 # new coords 193 [{'theta':80.1534480601659, 'phi':10.1510817110481}, (qx, qy), 0.03514647218513852], 194 [{'theta':80.1534480601659, 'phi':10.1510817110481}, [(qx, qy)], [0.03514647218513852]], 195 # old coords 196 #[{'theta':10.0, 'phi':10.0}, (qx, qy), 0.03514647218513852], 197 #[{'theta':10.0, 'phi':10.0}, [(qx, qy)], [0.03514647218513852]], 192 [{'theta': theta, 'phi': phi}, (qx, qy), 0.03514647218513852], 193 [{'theta': theta, 'phi': phi}, [(qx, qy)], [0.03514647218513852]], 198 194 ] 199 del qx, qy # not necessary to delete, but cleaner 200 201 # Default radius and length 202 def calc_volume(radius, length): 203 """Return form volume for cylinder.""" 204 return pi*radius**2*length 205 def calc_r_effs(radius, length): 206 """Return effective radii for modes 0-7 of cylinder.""" 207 return [ 195 del qx, qy, theta, phi # not necessary to delete, but cleaner 196 197 def _extend_with_reff_tests(radius, length): 198 """Test R_eff and form volume calculations""" 199 # V and Vr are the same for each R_eff mode 200 V = pi*radius**2*length # shell volume = form volume for solid objects 201 Vr = 1.0 # form:shell volume ratio 202 # Use test value for I(0.2) from above to check Fsq value. Need to 203 # remove scale and background before testing. 204 q = 0.2 205 scale, background = V, 0.001 206 Fsq = (0.042761386790780453 - background)*scale 207 F = None # Need target value for <F> 208 # Various values for R_eff, depending on mode 209 r_effs = [ 208 210 0., 209 211 0.5*(0.75*radius*(2.0*radius*length … … 216 218 np.sqrt(4*radius**2 + length**2)/2., 217 219 ] 218 r_effs = calc_r_effs(parameters[2][2], parameters[3][2]) 219 cyl_vol = calc_volume(parameters[2][2], parameters[3][2]) 220 #tests.extend([ 221 # ({'effective_radius_type': 0}, 0.1, 667.7347318577124, 1.0000, r_effs[0], cyl_vol, 1.0), 222 # first & second None do not work here, replacind 2nd Non by real number gives error also 223 # ({'effective_radius_type': 1}, 0.1, None, None, r_effs[1], None, None), 224 # ({'effective_radius_type': 2}, 0.1, None, None, r_effs[2], None, None), 225 # ({'effective_radius_type': 3}, 0.1, None, None, r_effs[3], None, None), 226 # ({'effective_radius_type': 4}, 0.1, None, None, r_effs[4], None, None), 227 # ({'effective_radius_type': 5}, 0.1, None, None, r_effs[5], None, None), 228 # ({'effective_radius_type': 6}, 0.1, None, None, r_effs[6], None, None), 229 # ({'effective_radius_type': 7}, 0.1, None, None, r_effs[7], None, None), 230 #]) 231 del r_effs, cyl_vol 232 # pylint: enable=bad-whitespace, line-too-long 220 tests.extend([ 221 ({'radius_effective_mode': 0}, q, F, Fsq, r_effs[0], V, Vr), 222 ({'radius_effective_mode': 1}, q, F, Fsq, r_effs[1], V, Vr), 223 ({'radius_effective_mode': 2}, q, F, Fsq, r_effs[2], V, Vr), 224 ({'radius_effective_mode': 3}, q, F, Fsq, r_effs[3], V, Vr), 225 ({'radius_effective_mode': 4}, q, F, Fsq, r_effs[4], V, Vr), 226 ({'radius_effective_mode': 5}, q, F, Fsq, r_effs[5], V, Vr), 227 ({'radius_effective_mode': 6}, q, F, Fsq, r_effs[6], V, Vr), 228 ({'radius_effective_mode': 7}, q, F, Fsq, r_effs[7], V, Vr), 229 ]) 230 231 # Test Reff and volume with default model parameters 232 _extend_with_reff_tests(parameters[2][2], parameters[3][2]) 233 del _extend_with_reff_tests 233 234 234 235 # ADDED by: RKH ON: 18Mar2016 renamed sld's etc
Note: See TracChangeset
for help on using the changeset viewer.