Changeset 275511c in sasmodels
 Timestamp:
 Feb 14, 2019 12:23:35 PM (3 years ago)
 Branches:
 master, core_shell_microgels, magnetic_model, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 4057e06
 Parents:
 3d7f364
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sasmodels/jitter.py
r3d7f364 r275511c 53 53 from numpy import pi, cos, sin, sqrt, exp, degrees, radians 54 54 55 def draw_beam(axes, view=(0, 0), alpha=0.5, steps= 6):55 def draw_beam(axes, view=(0, 0), alpha=0.5, steps=25): 56 56 """ 57 57 Draw the beam going from source at (0, 0, 1) to detector at (0, 0, 1) … … 76 76 77 77 # TODO: draw endcaps on beam 78 ## Draw tiny balls on the end will work79 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')78 ## Drawing tiny balls on the end will work 79 #draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow', alpha=alpha) 80 #draw_sphere(axes, radius=0.02, center=(0, 0, 1.3), color='yellow', alpha=alpha) 81 81 ## The following does not work 82 82 #triangles = [(0, i+1, i+2) for i in range(steps2)] … … 200 200 201 201 x, y, z = transform_xyz(view, jitter, x, y, z) 202 axes.plot_trisurf(x, y, triangles=tri, Z=z, color=color, alpha=alpha) 202 axes.plot_trisurf(x, y, triangles=tri, Z=z, color=color, alpha=alpha, 203 linewidth=0) 203 204 204 205 # Colour the c+ face of the box. … … 223 224 ]) 224 225 225 def draw_sphere(axes, radius=0.5, steps=25, center=(0,0,0), color='w' ):226 def draw_sphere(axes, radius=0.5, steps=25, center=(0,0,0), color='w', alpha=1.): 226 227 """Draw a sphere""" 227 228 u = np.linspace(0, 2 * np.pi, steps) … … 231 232 y = radius * np.outer(np.sin(u), np.sin(v)) + center[1] 232 233 z = radius * np.outer(np.ones(np.size(u)), np.cos(v)) + center[2] 233 axes.plot_surface(x, y, z, color=color )234 axes.plot_surface(x, y, z, color=color, alpha=alpha) 234 235 #axes.plot_wireframe(x, y, z) 235 236 … … 981 982 pass 982 983 983 axcolor = 'lightgoldenrodyellow' 984 #axcolor = {'facecolor': 'lightgoldenrodyellow'} 985 axcolor = {} 984 986 985 987 ## add control widgets to plot 986 axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], facecolor=axcolor)987 axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], facecolor=axcolor)988 axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], facecolor=axcolor)988 axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], **axcolor) 989 axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], **axcolor) 990 axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], **axcolor) 989 991 stheta = Slider(axes_theta, u'Îž', 90, 90, valinit=0) 990 992 sphi = Slider(axes_phi, u'Ï', 180, 180, valinit=0) 991 993 spsi = Slider(axes_psi, u'Ï', 180, 180, valinit=0) 992 994 993 axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], facecolor=axcolor)994 axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], facecolor=axcolor)995 axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], facecolor=axcolor)995 axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], **axcolor) 996 axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], **axcolor) 997 axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], **axcolor) 996 998 # Note: using ridiculous definition of rectangle distribution, whose width 997 999 # in sasmodels is sqrt(3) times the given width. Divide by sqrt(3) to keep … … 1031 1033 1032 1034 ## Move shape and draw scattering 1033 draw_beam(axes, (0, 0) )1034 draw_jitter(axes, view, jitter, dist=dist, size=size, 1035 draw_beam(axes, (0, 0), alpha=1.) 1036 draw_jitter(axes, view, jitter, dist=dist, size=size, alpha=1., 1035 1037 draw_shape=draw_shape, projection=projection, views=3) 1036 1038 draw_mesh(axes, view, jitter, dist=dist, n=mesh, projection=projection) … … 1163 1165 return h 1164 1166 def plot_trisurf(self, x, y, triangles=None, Z=None, **kw): 1167 kw.pop('linewidth', None) 1165 1168 ipv_fix_color(kw) 1166 1169 x, y, z = make_vec(x, y, Z)
Note: See TracChangeset
for help on using the changeset viewer.