Changes in / [e589e9a:a8a1d48] in sasmodels
- Location:
- sasmodels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/jitter.py
r7d97437 r1198f90 15 15 pass 16 16 17 import matplotlib as mpl18 17 import matplotlib.pyplot as plt 19 18 from matplotlib.widgets import Slider … … 747 746 pass 748 747 749 # CRUFT: use axisbg instead of facecolor for matplotlib<2 750 facecolor_prop = 'facecolor' if mpl.__version__ > '2' else 'axisbg' 751 props = {facecolor_prop: 'lightgoldenrodyellow'} 748 axcolor = 'lightgoldenrodyellow' 752 749 753 750 ## add control widgets to plot 754 axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], **props)755 axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], **props)756 axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], **props)751 axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], axisbg=axcolor) 752 axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], axisbg=axcolor) 753 axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], axisbg=axcolor) 757 754 stheta = Slider(axes_theta, 'Theta', -90, 90, valinit=theta) 758 755 sphi = Slider(axes_phi, 'Phi', -180, 180, valinit=phi) 759 756 spsi = Slider(axes_psi, 'Psi', -180, 180, valinit=psi) 760 757 761 axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], **props)762 axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], **props)763 axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], **props)758 axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], axisbg=axcolor) 759 axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], axisbg=axcolor) 760 axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], axisbg=axcolor) 764 761 # Note: using ridiculous definition of rectangle distribution, whose width 765 762 # in sasmodels is sqrt(3) times the given width. Divide by sqrt(3) to keep -
sasmodels/kernelcl.py
rf872fd1 rf872fd1 58 58 import time 59 59 60 try:61 from time import perf_counter as clock62 except ImportError: # CRUFT: python < 3.363 import sys64 if sys.platform.count("darwin") > 0:65 from time import time as clock66 else:67 from time import clock68 69 60 import numpy as np # type: ignore 61 70 62 71 63 # Attempt to setup opencl. This may fail if the pyopencl package is not … … 619 611 #Call kernel and retrieve results 620 612 wait_for = None 621 last_nap = clock()613 last_nap = time.clock() 622 614 step = 1000000//self.q_input.nq + 1 623 615 for start in range(0, call_details.num_eval, step): … … 630 622 # Allow other processes to run 631 623 wait_for[0].wait() 632 current_time = clock()624 current_time = time.clock() 633 625 if current_time - last_nap > 0.5: 634 626 time.sleep(0.001) -
sasmodels/resolution.py
re2592f0 r9e7837a 445 445 q = np.sort(q) 446 446 if q_min + 2*MINIMUM_RESOLUTION < q[0]: 447 n_low = int(np.ceil((q[0]-q_min) / (q[1]-q[0]))) if q[1] > q[0] else 15447 n_low = np.ceil((q[0]-q_min) / (q[1]-q[0])) if q[1] > q[0] else 15 448 448 q_low = np.linspace(q_min, q[0], n_low+1)[:-1] 449 449 else: 450 450 q_low = [] 451 451 if q_max - 2*MINIMUM_RESOLUTION > q[-1]: 452 n_high = int(np.ceil((q_max-q[-1]) / (q[-1]-q[-2]))) if q[-1] > q[-2] else 15452 n_high = np.ceil((q_max-q[-1]) / (q[-1]-q[-2])) if q[-1] > q[-2] else 15 453 453 q_high = np.linspace(q[-1], q_max, n_high+1)[1:] 454 454 else: … … 499 499 q_min = q[0]*MINIMUM_ABSOLUTE_Q 500 500 n_low = log_delta_q * (log(q[0])-log(q_min)) 501 q_low = np.logspace(log10(q_min), log10(q[0]), int(np.ceil(n_low))+1)[:-1]501 q_low = np.logspace(log10(q_min), log10(q[0]), np.ceil(n_low)+1)[:-1] 502 502 else: 503 503 q_low = [] 504 504 if q_max > q[-1]: 505 505 n_high = log_delta_q * (log(q_max)-log(q[-1])) 506 q_high = np.logspace(log10(q[-1]), log10(q_max), int(np.ceil(n_high))+1)[1:]506 q_high = np.logspace(log10(q[-1]), log10(q_max), np.ceil(n_high)+1)[1:] 507 507 else: 508 508 q_high = [] -
sasmodels/weights.py
re2592f0 r3d58247 23 23 default = dict(npts=35, width=0, nsigmas=3) 24 24 def __init__(self, npts=None, width=None, nsigmas=None): 25 self.npts = self.default['npts'] if npts is None else int(npts)25 self.npts = self.default['npts'] if npts is None else npts 26 26 self.width = self.default['width'] if width is None else width 27 27 self.nsigmas = self.default['nsigmas'] if nsigmas is None else nsigmas
Note: See TracChangeset
for help on using the changeset viewer.