Changeset bde38b5 in sasmodels for sasmodels/kernelpy.py


Ignore:
Timestamp:
Aug 14, 2016 9:12:40 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
ac98886
Parents:
b1c40bee
git-author:
Paul Kienzle <pkienzle@…> (08/14/16 21:08:59)
git-committer:
Paul Kienzle <pkienzle@…> (08/14/16 21:12:40)
Message:

simplify kernel calling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/kernelpy.py

    r40a87fa rbde38b5  
    100100    """ 
    101101    def __init__(self, kernel, model_info, q_input): 
     102        # type: (callable, ModelInfo, List[np.ndarray]) -> None 
    102103        self.dtype = np.dtype('d') 
    103104        self.info = model_info 
     
    156157 
    157158    def __call__(self, call_details, values, cutoff, magnetic): 
    158         assert isinstance(call_details, details.CallDetails) 
     159        # type: (CallDetails, np.ndarray, np.ndarray, float, bool) -> np.ndarray 
     160        if magnetic: 
     161            raise NotImplementedError("Magnetism not implemented for pure python models") 
     162        #print("Calling python kernel") 
     163        #call_details.show(values) 
    159164        res = _loops(self._parameter_vector, self._form, self._volume, 
    160165                     self.q_input.nq, call_details, values, cutoff) 
     
    162167 
    163168    def release(self): 
     169        # type: () -> None 
    164170        """ 
    165171        Free resources associated with the kernel. 
     
    189195            return np.ones(nq, 'd')*background 
    190196 
    191     pd_value = values[2+n_pars:2+n_pars + call_details.pd_sum] 
    192     pd_weight = values[2+n_pars + call_details.pd_sum:] 
     197    pd_value = values[2+n_pars:2+n_pars + call_details.num_weights] 
     198    pd_weight = values[2+n_pars + call_details.num_weights:] 
    193199 
    194200    pd_norm = 0.0 
     
    209215 
    210216    total = np.zeros(nq, 'd') 
    211     for loop_index in range(call_details.pd_prod): 
     217    for loop_index in range(call_details.num_eval): 
    212218        # update polydispersity parameter values 
    213219        if p0_index == p0_length: 
Note: See TracChangeset for help on using the changeset viewer.