Changeset e2592f0 in sasmodels
- Timestamp:
- Oct 9, 2018 5:23:53 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:
- 7d97437
- Parents:
- 353e899
- Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelcl.py
rd86f0fc re2592f0 56 56 import time 57 57 58 try: 59 from time import perf_counter as clock 60 except ImportError: # CRUFT: python < 3.3 61 if sys.platform.count("darwin") > 0: 62 from time import time as clock 63 else: 64 from time import clock 65 58 66 import numpy as np # type: ignore 59 60 67 61 68 # Attempt to setup opencl. This may fail if the opencl package is not … … 575 582 # Call kernel and retrieve results 576 583 wait_for = None 577 last_nap = time.clock()584 last_nap = clock() 578 585 step = 1000000//self.q_input.nq + 1 579 586 for start in range(0, call_details.num_eval, step): … … 586 593 # Allow other processes to run 587 594 wait_for[0].wait() 588 current_time = time.clock()595 current_time = clock() 589 596 if current_time - last_nap > 0.5: 590 597 time.sleep(0.05) -
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
Note: See TracChangeset
for help on using the changeset viewer.