Changeset b9578fc in sasmodels
- Timestamp:
- Oct 27, 2017 8:54:21 AM (7 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- a9bc435
- Parents:
- f39d4a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/jitter.py
r36b3154 rb9578fc 15 15 import numpy as np 16 16 from numpy import pi, cos, sin, sqrt, exp, degrees, radians 17 18 SCALED_PHI = True 17 19 18 20 def draw_beam(ax, view=(0, 0)): … … 177 179 raise ValueError("expected dist to be 'gaussian' or 'rectangle'") 178 180 181 if SCALED_PHI: 182 scale_phi = lambda dtheta, dphi: ( 183 dphi/abs(cos(radians(dtheta))) if dtheta != 90 184 else 0 if dphi == 0 185 else 4*pi) 186 w = np.outer(weights, weights) 187 else: 188 scale_phi = lambda dtheta, dphe: dphi 189 w = np.outer(weights*cos(radians(dtheta*t)), weights) 190 179 191 # mesh in theta, phi formed by rotating z 180 192 z = np.matrix([[0], [0], [radius]]) 181 points = np.hstack([Rx( phi_i)*Ry(theta_i)*z193 points = np.hstack([Rx(scale_phi(theta_i, phi_j))*Ry(theta_i)*z 182 194 for theta_i in dtheta*t 183 for phi_i in dphi*t]) 195 for phi_j in dphi*t]) 196 # select just the active points (i.e., those with phi < 180 197 active = np.array([abs(scale_phi(theta_i, phi_j)) < 180 198 for theta_i in dtheta*t 199 for phi_j in dphi*t]) 200 points = points[:, active] 201 w = w.flatten()[active] 202 184 203 # rotate relative to beam 185 204 points = orient_relative_to_beam(view, points) 186 205 187 w = np.outer(weights*cos(radians(dtheta*t)), weights)188 189 206 x, y, z = [np.array(v).flatten() for v in points] 190 ax.scatter(x, y, z, c=w .flatten(), marker='o', vmin=0., vmax=1.)207 ax.scatter(x, y, z, c=w, marker='o', vmin=0., vmax=1.) 191 208 192 209 def draw_labels(ax, view, jitter, text):
Note: See TracChangeset
for help on using the changeset viewer.