Changes in sasmodels/kernelpy.py [e44432d:3199b17] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/kernelpy.py
re44432d r3199b17 33 33 logger = logging.getLogger(__name__) 34 34 35 35 36 class PyModel(KernelModel): 36 37 """ … … 38 39 """ 39 40 def __init__(self, model_info): 40 # Make sure Iq is available and vectorized 41 # Make sure Iq is available and vectorized. 41 42 _create_default_functions(model_info) 42 43 self.info = model_info 43 44 self.dtype = np.dtype('d') 45 logger.info("make python model " + self.info.name) 44 46 45 47 def make_kernel(self, q_vectors): … … 52 54 """ 53 55 pass 56 54 57 55 58 class PyInput(object): … … 90 93 self.q = None 91 94 95 92 96 class PyKernel(Kernel): 93 97 """ … … 130 134 parameter_vector = np.empty(len(partable.call_parameters)-2, 'd') 131 135 132 # Create views into the array to hold the arguments 136 # Create views into the array to hold the arguments. 133 137 offset = 0 134 138 kernel_args, volume_args = [], [] … … 173 177 else (lambda mode: 1.0)) 174 178 175 176 177 179 def _call_kernel(self, call_details, values, cutoff, magnetic, effective_radius_type): 178 180 # type: (CallDetails, np.ndarray, np.ndarray, float, bool) -> np.ndarray … … 194 196 self.q_input.release() 195 197 self.q_input = None 198 196 199 197 200 def _loops(parameters, # type: np.ndarray … … 253 256 total = np.zeros(nq, 'd') 254 257 for loop_index in range(call_details.num_eval): 255 # update polydispersity parameter values258 # Update polydispersity parameter values. 256 259 if p0_index == p0_length: 257 260 pd_index = (loop_index//pd_stride)%pd_length … … 264 267 p0_index += 1 265 268 if weight > cutoff: 266 # Call the scattering function 269 # Call the scattering function. 267 270 # Assume that NaNs are only generated if the parameters are bad; 268 271 # exclude all q for that NaN. Even better would be to have an … … 272 275 continue 273 276 274 # update value and norm277 # Update value and norm. 275 278 total += weight * Iq 276 279 weight_norm += weight … … 292 295 any functions that are not already marked as vectorized. 293 296 """ 294 # Note: must call create_vector_Iq before create_vector_Iqxy297 # Note: Must call create_vector_Iq before create_vector_Iqxy. 295 298 _create_vector_Iq(model_info) 296 299 _create_vector_Iqxy(model_info)
Note: See TracChangeset
for help on using the changeset viewer.