Changeset 4057e06 in sasmodels
- Timestamp:
- Mar 4, 2019 5:17:36 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:
- cff2939
- Parents:
- 275511c (diff), 8064d5e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - git-author:
- Paul Kienzle <pkienzle@…> (03/04/19 17:17:36)
- git-committer:
- GitHub <noreply@…> (03/04/19 17:17:36)
- Files:
-
- 6 edited
- 6 moved
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/jitter.py
r275511c r4057e06 964 964 965 965 def 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. 966 968 import mpl_toolkits.mplot3d # Adds projection='3d' option to subplot 969 import matplotlib as mpl 967 970 import matplotlib.pyplot as plt 968 971 from matplotlib.widgets import Slider 969 972 970 973 ## create the plot window 971 974 #plt.hold(True) … … 982 985 pass 983 986 984 #axcolor = {'facecolor': 'lightgoldenrodyellow'} 985 axcolor = {} 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'} 986 991 987 992 ## add control widgets to plot 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) 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 998 1004 # Note: using ridiculous definition of rectangle distribution, whose width 999 1005 # in sasmodels is sqrt(3) times the given width. Divide by sqrt(3) to keep -
sasmodels/kernelcl.py
rf872fd1 r8064d5e 58 58 import time 59 59 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 60 69 import numpy as np # type: ignore 61 62 70 63 71 # Attempt to setup opencl. This may fail if the pyopencl package is not … … 611 619 #Call kernel and retrieve results 612 620 wait_for = None 613 last_nap = time.clock()621 last_nap = clock() 614 622 step = 1000000//self.q_input.nq + 1 615 623 for start in range(0, call_details.num_eval, step): … … 622 630 # Allow other processes to run 623 631 wait_for[0].wait() 624 current_time = time.clock()632 current_time = clock() 625 633 if current_time - last_nap > 0.5: 626 634 time.sleep(0.001) -
sasmodels/resolution.py
r9e7837a re2592f0 445 445 q = np.sort(q) 446 446 if q_min + 2*MINIMUM_RESOLUTION < q[0]: 447 n_low = np.ceil((q[0]-q_min) / (q[1]-q[0])) if q[1] > q[0] else 15447 n_low = int(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 = np.ceil((q_max-q[-1]) / (q[-1]-q[-2])) if q[-1] > q[-2] else 15452 n_high = int(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]), np.ceil(n_low)+1)[:-1]501 q_low = np.logspace(log10(q_min), log10(q[0]), int(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), np.ceil(n_high)+1)[1:]506 q_high = np.logspace(log10(q[-1]), log10(q_max), int(np.ceil(n_high))+1)[1:] 507 507 else: 508 508 q_high = [] -
sasmodels/weights.py
r3d58247 re2592f0 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 npts25 self.npts = self.default['npts'] if npts is None else int(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 -
explore/beta/sasfit_compare.py
r2a12351b r119073a 505 505 } 506 506 507 Q, IQ = load_sasfit(data_file(' richard_test.txt'))508 Q, IQSD = load_sasfit(data_file(' richard_test2.txt'))509 Q, IQBD = load_sasfit(data_file(' richard_test3.txt'))507 Q, IQ = load_sasfit(data_file('sasfit_sphere_schulz_IQD.txt')) 508 Q, IQSD = load_sasfit(data_file('sasfit_sphere_schulz_IQSD.txt')) 509 Q, IQBD = load_sasfit(data_file('sasfit_sphere_schulz_IQBD.txt')) 510 510 target = Theory(Q=Q, F1=None, F2=None, P=IQ, S=None, I=IQSD, Seff=None, Ibeta=IQBD) 511 511 actual = sphere_r(Q, norm="sasfit", **pars) … … 526 526 } 527 527 528 Q, IQ = load_sasfit(data_file(' richard_test4.txt'))529 Q, IQSD = load_sasfit(data_file(' richard_test5.txt'))530 Q, IQBD = load_sasfit(data_file(' richard_test6.txt'))528 Q, IQ = load_sasfit(data_file('sasfit_ellipsoid_shulz_IQD.txt')) 529 Q, IQSD = load_sasfit(data_file('sasfit_ellipsoid_shulz_IQSD.txt')) 530 Q, IQBD = load_sasfit(data_file('sasfit_ellipsoid_shulz_IQBD.txt')) 531 531 target = Theory(Q=Q, F1=None, F2=None, P=IQ, S=None, I=IQSD, Seff=None, Ibeta=IQBD) 532 532 actual = ellipsoid_pe(Q, norm="sasfit", **pars) -
sasmodels/models/pearl_necklace.c
r99658f6 r9b5fd42 40 40 const double si = sas_sinx_x(q*A_s); 41 41 const double omsi = 1.0 - si; 42 const double pow_si = pow (si, num_pearls);42 const double pow_si = pown(si, num_pearls); 43 43 44 44 // form factor for num_pearls … … 81 81 radius_from_volume(double radius, double edge_sep, double thick_string, double fp_num_pearls) 82 82 { 83 const int num_pearls = (int) fp_num_pearls +0.5;84 83 const double vol_tot = form_volume(radius, edge_sep, thick_string, fp_num_pearls); 85 84 return cbrt(vol_tot/M_4PI_3);
Note: See TracChangeset
for help on using the changeset viewer.