Changeset 3d7f364 in sasmodels
 Timestamp:
 Feb 14, 2019 11:57:27 AM (3 years ago)
 Branches:
 master, core_shell_microgels, magnetic_model, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 275511c
 Parents:
 9ec9c67
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sasmodels/jitter.py
r9ec9c67 r3d7f364 77 77 # TODO: draw endcaps on beam 78 78 ## Draw tiny balls on the end will work 79 #draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow')80 #draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow')79 draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow') 80 draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow') 81 81 ## The following does not work 82 82 #triangles = [(0, i+1, i+2) for i in range(steps2)] … … 295 295 Represent jitter as a set of shapes at different orientations. 296 296 """ 297 project, weight = get_projection(projection)297 project, project_weight = get_projection(projection) 298 298 299 299 # set max diagonal to 0.95 … … 304 304 base = {'gaussian':3, 'rectangle':sqrt(3), 'uniform':1}[dist] 305 305 def steps(delta): 306 limit = base*delta307 306 if views is None: 308 307 n = max(3, min(25, 2*int(base*delta/5))) 309 308 else: 310 309 n = views 311 s = base*delta*np.linspace(1, 1, n) if delta > 0 else [0] 312 return s 313 stheta = steps(dtheta) 314 sphi = steps(dphi) 315 spsi = steps(dpsi) 316 #print(stheta, sphi, spsi) 317 for theta in stheta: 318 for phi in sphi: 319 for psi in spsi: 320 w = weight(theta, phi, 1.0, 1.0) 310 return base*delta*np.linspace(1, 1, n) if delta > 0 else [0.] 311 for theta in steps(dtheta): 312 for phi in steps(dphi): 313 for psi in steps(dpsi): 314 w = project_weight(theta, phi, 1.0, 1.0) 321 315 if w > 0: 322 316 dview = project(theta, phi, psi) … … 782 776 vmin = vmax*10**7 783 777 #vmin, vmax = clipped_range(Iqxy, portion=portion, mode='top') 778 #vmin, vmax = Iqxy.min(), Iqxy.max() 784 779 #print("range",(vmin,vmax)) 785 780 #qx, qy = np.meshgrid(qx, qy) … … 791 786 #colors = cm.coolwarm(level) 792 787 #colors = cm.gist_yarg(level) 788 #colors = cm.Wistia(level) 789 colors[level<=0, 3] = 0. # set floor to transparent 793 790 x, y = np.meshgrid(qx/qx.max(), qy/qy.max()) 794 791 axes.plot_surface(x, y, 1.1*np.ones_like(x), facecolors=colors) … … 955 952 956 953 # set up calculator 957 calculator, size = select_calculator(model_name, n=1 00, size=size)954 calculator, size = select_calculator(model_name, n=150, size=size) 958 955 draw_shape = DRAW_SHAPES.get(model_name, draw_parallelepiped) 959 956 #draw_shape = draw_fcc … … 1118 1115 color = kw['color'] 1119 1116 #TODO: convert color to [r, g, b, a] if not already 1117 if isinstance(color, (tuple, list)): 1118 if len(color) == 3: 1119 color = (color[0], color[1], color[2], alpha) 1120 else: 1121 color = (color[0], color[1], color[2], alpha*color[3]) 1122 color = np.array(color) 1120 1123 if isinstance(color, np.ndarray) and color.shape[1] == 4: 1121 1124 color[..., 3] = alpha … … 1157 1160 h = ipv.plot_surface(x, y, z, **kw) 1158 1161 ipv_set_transparency(kw, h) 1162 #h.material.side = "DoubleSide" 1159 1163 return h 1160 1164 def plot_trisurf(self, x, y, triangles=None, Z=None, **kw): … … 1189 1193 h = ipv.plot_mesh(x, y, z, u=u, v=v, texture=image, wireframe=False) 1190 1194 ipv_set_transparency(kw, h) 1195 h.material.side = "DoubleSide" 1191 1196 return h 1192 1197 def text(self, *args, **kw): … … 1231 1236 1232 1237 ## Move shape and draw scattering 1233 draw_beam(axes, (0, 0) )1234 draw_jitter(axes, view, jitter, dist=dist, size=size, 1238 draw_beam(axes, (0, 0), steps=25) 1239 draw_jitter(axes, view, jitter, dist=dist, size=size, alpha=1.0, 1235 1240 draw_shape=draw_shape, projection=projection) 1236 draw_mesh(axes, view, jitter, dist=dist, n=mesh, radius=0.95, projection=projection) 1241 draw_mesh(axes, view, jitter, dist=dist, n=mesh, radius=0.95, 1242 projection=projection) 1237 1243 draw_scattering(calculator, axes, view, jitter, dist=dist) 1238 1244
Note: See TracChangeset
for help on using the changeset viewer.