Changeset 4e28511 in sasmodels
- Timestamp:
- Mar 20, 2019 9:00:26 PM (6 years ago)
- Branches:
- master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- df20715, 069743a
- Parents:
- b297ba9
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extra/pylint.rc
rb297ba9 r4e28511 290 290 # (useful for modules/projects where namespaces are manipulated during runtime 291 291 # and thus existing member attributes cannot be deduced by static analysis 292 ignored-modules=bumps,sas,numpy,numpy.random,scipy,scipy.special 292 ignored-modules=bumps,sas,numpy,numpy.random,scipy,scipy.special,pyopencl,pycuda,matplotlib.cm,ipyvolume,ipywidget 293 293 294 294 # List of classes names for which member attributes should not be checked -
sasmodels/jitter.py
rb297ba9 r4e28511 114 114 def draw_sc(axes, size, view, jitter, steps=None, alpha=1): 115 115 """Draw points for simple cubic paracrystal""" 116 # pylint: disable=unused-argument 116 117 atoms = _build_sc() 117 118 _draw_crystal(axes, size, view, jitter, atoms=atoms) … … 119 120 def draw_fcc(axes, size, view, jitter, steps=None, alpha=1): 120 121 """Draw points for face-centered cubic paracrystal""" 122 # pylint: disable=unused-argument 121 123 # Build the simple cubic crystal 122 124 atoms = _build_sc() … … 134 136 def draw_bcc(axes, size, view, jitter, steps=None, alpha=1): 135 137 """Draw points for body-centered cubic paracrystal""" 138 # pylint: disable=unused-argument 136 139 # Build the simple cubic crystal 137 140 atoms = _build_sc() … … 189 192 color=(0.6, 1.0, 0.6), alpha=1): 190 193 """Draw a parallelepiped surface, with view and jitter.""" 194 # pylint: disable=unused-argument 191 195 a, b, c = size 192 196 x = a*np.array([+1, -1, +1, -1, +1, -1, +1, -1]) … … 212 216 # in front of the "c+" face. Use the c face so that rotations about psi 213 217 # rotate that face. 214 if 0: 218 if 0: # pylint: disable=using-constant-test 215 219 color = (1, 0.6, 0.6) # pink 216 220 x = a*np.array([+1, -1, +1, -1, +1, -1, +1, -1]) … … 229 233 ]) 230 234 231 def draw_sphere(axes, radius= 0.5, steps=25,235 def draw_sphere(axes, radius=1.0, steps=25, 232 236 center=(0, 0, 0), color='w', alpha=1.): 233 237 """Draw a sphere""" … … 249 253 axes.plot([x, x], [y, y], [z, z+dz], color='black') 250 254 251 def draw_person_on_sphere(axes, view, height=0.5, radius= 0.5):255 def draw_person_on_sphere(axes, view, height=0.5, radius=1.0): 252 256 """ 253 257 Draw a person on the surface of a sphere. … … 265 269 arm_length = torso_length * 0.90 266 270 267 def _draw_part( x, z):268 y = np.zeros_like(x)271 def _draw_part(y, z): 272 x = np.zeros_like(y) 269 273 xp, yp, zp = transform_xyz(view, None, x, y, z + radius) 270 274 axes.plot(xp, yp, zp, color='k') … … 272 276 # circle for head 273 277 u = np.linspace(0, 2 * pi, 40) 274 x= head_radius * cos(u)278 y = head_radius * cos(u) 275 279 z = head_radius * sin(u) + head_height 276 _draw_part( x, z)280 _draw_part(y, z) 277 281 278 282 # rectangle for body 279 x= np.array([-torso_radius, torso_radius, torso_radius, -torso_radius, -torso_radius])283 y = np.array([-torso_radius, torso_radius, torso_radius, -torso_radius, -torso_radius]) 280 284 z = np.array([0., 0, torso_length, torso_length, 0]) + leg_length 281 _draw_part( x, z)285 _draw_part(y, z) 282 286 283 287 # arms 284 x= np.array([-torso_radius - limb_offset, -torso_radius - limb_offset, -torso_radius])288 y = np.array([-torso_radius - limb_offset, -torso_radius - limb_offset, -torso_radius]) 285 289 z = np.array([shoulder_height - arm_length, shoulder_height, shoulder_height]) 286 _draw_part( x, z)287 _draw_part(- x, z)290 _draw_part(y, z) 291 _draw_part(-y, z) # pylint: disable=invalid-unary-operand-type 288 292 289 293 # legs 290 x= np.array([-torso_radius + limb_offset, -torso_radius + limb_offset])294 y = np.array([-torso_radius + limb_offset, -torso_radius + limb_offset]) 291 295 z = np.array([0, leg_length]) 292 _draw_part( x, z)293 _draw_part(- x, z)296 _draw_part(y, z) 297 _draw_part(-y, z) # pylint: disable=invalid-unary-operand-type 294 298 295 299 limits = [-radius-height, radius+height] … … 397 401 Should allow free movement in theta, but phi is distorted. 398 402 """ 403 # pylint: disable=unused-argument 399 404 # TODO: try Kent distribution instead of a gaussian warped by projection 400 405 … … 534 539 535 540 # mesh in theta, phi formed by rotating z 536 dtheta, dphi, dpsi = jitter 541 dtheta, dphi, dpsi = jitter # pylint: disable=unused-variable 537 542 z = np.matrix([[0], [0], [radius]]) 538 543 points = np.hstack([_rotate(theta_i, phi_j, z) … … 829 834 #print("range",(vmin,vmax)) 830 835 #qx, qy = np.meshgrid(qx, qy) 831 if 0: 836 if 0: # pylint: disable=using-constant-test 832 837 level = np.asarray(255*(Iqxy - vmin)/(vmax - vmin), 'i') 833 838 level[level < 0] = 0 … … 841 846 x, y = np.meshgrid(qx/qx.max(), qy/qy.max()) 842 847 axes.plot_surface(x, y, -1.1*np.ones_like(x), facecolors=colors) 843 elif 1: 848 elif 1: # pylint: disable=using-constant-test 844 849 axes.contourf(qx/qx.max(), qy/qy.max(), Iqxy, zdir='z', offset=-1.1, 845 850 levels=np.linspace(vmin, vmax, 24)) … … 1019 1024 # Note: travis-ci does not support mpl_toolkits.mplot3d, but this shouldn't be 1020 1025 # an issue since we are lazy-loading the package on a path that isn't tested. 1021 import mpl_toolkits.mplot3d # Adds projection='3d' option to subplot 1026 # Importing mplot3d adds projection='3d' option to subplot 1027 import mpl_toolkits.mplot3d # pylint: disable=unused-variable 1022 1028 import matplotlib as mpl 1023 1029 import matplotlib.pyplot as plt … … 1074 1080 ## callback to draw the new view 1075 1081 def _update(val, axis=None): 1082 # pylint: disable=unused-argument 1076 1083 view = stheta.val, sphi.val, spsi.val 1077 1084 jitter = sdtheta.val, sdphi.val, sdpsi.val … … 1083 1090 1084 1091 ## Visualize as person on globe 1085 #draw_sphere(axes )1086 #draw_person_on_sphere(axes, view )1092 #draw_sphere(axes, radius=0.5) 1093 #draw_person_on_sphere(axes, view, radius=0.5) 1087 1094 1088 1095 ## Move beam instead of shape … … 1092 1099 ## Move shape and draw scattering 1093 1100 draw_beam(axes, (0, 0), alpha=1.) 1101 #draw_person_on_sphere(axes, view, radius=1.2, height=0.5) 1094 1102 draw_jitter(axes, view, jitter, dist=dist, size=size, alpha=1., 1095 1103 draw_shape=draw_shape, projection=projection, views=3) … … 1208 1216 import ipyvolume as ipv 1209 1217 1210 class Axes :1218 class Axes(object): 1211 1219 """ 1212 1220 Matplotlib Axes3D style interface to ipyvolume renderer. 1213 1221 """ 1222 # pylint: disable=no-self-use,no-init 1214 1223 # transparency can be achieved by setting the following: 1215 1224 # mesh.color = [r, g, b, alpha] … … 1260 1269 def contourf(self, x, y, v, zdir='z', offset=0, levels=None, **kw): 1261 1270 """mpl style contourf interface for ipyvolume""" 1271 # pylint: disable=unused-argument 1262 1272 # Don't use contour for now (although we might want to later) 1263 1273 self.pcolor(x, y, v, zdir='z', offset=offset, **kw) 1264 1274 def pcolor(self, x, y, v, zdir='z', offset=0, **kw): 1265 1275 """mpl style pcolor interface for ipyvolume""" 1276 # pylint: disable=unused-argument 1266 1277 x, y, v = make_vec(x, y, v) 1267 1278 image = make_image(v, kw) … … 1317 1328 ## Visualize as person on globe 1318 1329 #draw_beam(axes, (0, 0)) 1319 #draw_sphere(axes )1320 #draw_person_on_sphere(axes, view )1330 #draw_sphere(axes, radius=0.5) 1331 #draw_person_on_sphere(axes, view, radius=0.5) 1321 1332 1322 1333 ## Move beam instead of shape -
sasmodels/kernelcl.py
rb297ba9 r4e28511 115 115 Monkey patch pyopencl to allow spaces in include file path. 116 116 """ 117 # pylint: disable=protected-access 117 118 import pyopencl 118 119 if hasattr(pyopencl, '_DEFAULT_INCLUDE_OPTIONS'):
Note: See TracChangeset
for help on using the changeset viewer.