Changeset 48fbd50 in sasmodels for sasmodels/kerneldll.py
- Timestamp:
- Mar 21, 2016 6:02:51 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 25b30fd, 3a45c2c
- Parents:
- 88aa3ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kerneldll.py
r445d1c0 r48fbd50 218 218 self.dll = None 219 219 220 def __call__(self, q_vectors):220 def make_kernel(self, q_vectors): 221 221 q_input = PyInput(q_vectors, self.dtype) 222 222 if self.dll is None: self._load_dll() … … 251 251 """ 252 252 def __init__(self, kernel, model_info, q_input): 253 self.kernel = kernel 253 254 self.info = model_info 254 255 self.q_input = q_input 255 256 self.dtype = q_input.dtype 256 self.kernel = kernel257 self.res = np.empty(q_input.nq+3, q_input.dtype)258 257 self.dim = '2d' if q_input.is_2d else '1d' 259 260 # In dll kernel, but not in opencl kernel 261 self.p_res = self.res.ctypes.data 258 self.result = np.empty(q_input.nq+3, q_input.dtype) 262 259 263 260 def __call__(self, details, weights, values, cutoff): … … 265 262 else np.float64 if self.q_input.dtype == generate.F64 266 263 else np.float128) 267 if details.dtype != np.int32 or weights.dtype != real or values.dtype != real: 268 raise TypeError("numeric type does not match the kernel type") 269 #details = np.asarray(details, dtype='int32') 270 #weights = np.asarray(weights, dtype=real) 271 #values = np.asarray(values, dtype=real) 272 #TODO: How can I access max_pd and is this the way to do it? 273 #max_pd = model_info['max_pd'] 274 max_pd = 1 264 assert details.dtype == np.int32 265 assert weights.dtype == real and values.dtype == real 266 267 max_pd = self.info['max_pd'] 268 start, stop = 0, details[4*max_pd-1] 275 269 args = [ 276 270 self.q_input.nq, # nq 277 #TODO: pd_start will need to be changed 278 0, # pd_start 279 details[3*max_pd:4*max_pd], # pd_stop pd_stride[MAX_PD] 271 start, # pd_start 272 stop, # pd_stop pd_stride[MAX_PD] 280 273 details.ctypes.data, # problem 281 274 weights.ctypes.data, # weights 282 275 values.ctypes.data, #pars 283 self.q_input.q _pointers[0], #q284 self. p_res, # results276 self.q_input.q.ctypes.data, #q 277 self.result.ctypes.data, # results 285 278 real(cutoff), # cutoff 286 279 ] 287 280 self.kernel(*args) 288 return self.res [:-3]281 return self.result[:-3] 289 282 290 283 def release(self):
Note: See TracChangeset
for help on using the changeset viewer.