Changes in / [4057e06:275511c] in sasmodels


Ignore:
Location:
sasmodels
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/jitter.py

    r275511c r275511c  
    964964 
    965965def mpl_plot(calculator, draw_shape, size, view, jitter, dist, mesh, projection): 
    966     # Note: travis-ci does not support mpl_toolkits.mplot3d, but this shouldn't be 
    967     # an issue since we are lazy-loading the package on a path that isn't tested. 
    968966    import mpl_toolkits.mplot3d  # Adds projection='3d' option to subplot 
    969     import matplotlib as mpl 
    970967    import matplotlib.pyplot as plt 
    971968    from matplotlib.widgets import Slider 
    972      
     969 
    973970    ## create the plot window 
    974971    #plt.hold(True) 
     
    985982        pass 
    986983 
    987  
    988     # CRUFT: use axisbg instead of facecolor for matplotlib<2 
    989     facecolor_prop = 'facecolor' if mpl.__version__ > '2' else 'axisbg' 
    990     props = {facecolor_prop: 'lightgoldenrodyellow'} 
     984    #axcolor = {'facecolor': 'lightgoldenrodyellow'} 
     985    axcolor = {} 
    991986 
    992987    ## add control widgets to plot 
    993     axes_theta = plt.axes([0.1, 0.15, 0.45, 0.04], **props) 
    994     axes_phi = plt.axes([0.1, 0.1, 0.45, 0.04], **props) 
    995     axes_psi = plt.axes([0.1, 0.05, 0.45, 0.04], **props) 
    996     stheta = Slider(axes_theta, 'Theta', -90, 90, valinit=theta) 
    997     sphi = Slider(axes_phi, 'Phi', -180, 180, valinit=phi) 
    998     spsi = Slider(axes_psi, 'Psi', -180, 180, valinit=psi) 
    999  
    1000     axes_dtheta = plt.axes([0.75, 0.15, 0.15, 0.04], **props) 
    1001     axes_dphi = plt.axes([0.75, 0.1, 0.15, 0.04], **props) 
    1002     axes_dpsi = plt.axes([0.75, 0.05, 0.15, 0.04], **props) 
    1003  
     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) 
     991    stheta = Slider(axes_theta, u'Ξ', -90, 90, valinit=0) 
     992    sphi = Slider(axes_phi, u'φ', -180, 180, valinit=0) 
     993    spsi = Slider(axes_psi, u'ψ', -180, 180, valinit=0) 
     994 
     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) 
    1004998    # Note: using ridiculous definition of rectangle distribution, whose width 
    1005999    # in sasmodels is sqrt(3) times the given width.  Divide by sqrt(3) to keep 
  • sasmodels/kernelcl.py

    rf872fd1 rf872fd1  
    5858import time 
    5959 
    60 try: 
    61     from time import perf_counter as clock 
    62 except ImportError: # CRUFT: python < 3.3 
    63     import sys 
    64     if sys.platform.count("darwin") > 0: 
    65         from time import time as clock 
    66     else: 
    67         from time import clock 
    68  
    6960import numpy as np  # type: ignore 
     61 
    7062 
    7163# Attempt to setup opencl. This may fail if the pyopencl package is not 
     
    619611        #Call kernel and retrieve results 
    620612        wait_for = None 
    621         last_nap = clock() 
     613        last_nap = time.clock() 
    622614        step = 1000000//self.q_input.nq + 1 
    623615        for start in range(0, call_details.num_eval, step): 
     
    630622                # Allow other processes to run 
    631623                wait_for[0].wait() 
    632                 current_time = clock() 
     624                current_time = time.clock() 
    633625                if current_time - last_nap > 0.5: 
    634626                    time.sleep(0.001) 
  • sasmodels/resolution.py

    re2592f0 r9e7837a  
    445445    q = np.sort(q) 
    446446    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 15 
     447        n_low = np.ceil((q[0]-q_min) / (q[1]-q[0])) if q[1] > q[0] else 15 
    448448        q_low = np.linspace(q_min, q[0], n_low+1)[:-1] 
    449449    else: 
    450450        q_low = [] 
    451451    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 15 
     452        n_high = np.ceil((q_max-q[-1]) / (q[-1]-q[-2])) if q[-1] > q[-2] else 15 
    453453        q_high = np.linspace(q[-1], q_max, n_high+1)[1:] 
    454454    else: 
     
    499499            q_min = q[0]*MINIMUM_ABSOLUTE_Q 
    500500        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] 
    502502    else: 
    503503        q_low = [] 
    504504    if q_max > q[-1]: 
    505505        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:] 
    507507    else: 
    508508        q_high = [] 
  • sasmodels/weights.py

    re2592f0 r3d58247  
    2323    default = dict(npts=35, width=0, nsigmas=3) 
    2424    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 
    2626        self.width = self.default['width'] if width is None else width 
    2727        self.nsigmas = self.default['nsigmas'] if nsigmas is None else nsigmas 
Note: See TracChangeset for help on using the changeset viewer.