Changeset 2c4a190 in sasmodels for sasmodels/direct_model.py


Ignore:
Timestamp:
Dec 13, 2018 11:08:26 AM (5 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
8803a38
Parents:
c6084f1
Message:

simplify use of multiple scattering in bumps fits

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/direct_model.py

    r7b9e4dd r2c4a190  
    242242            else: 
    243243                Iq, dIq = None, None 
    244             #self._theory = np.zeros_like(q) 
    245             q_vectors = [res.q_calc] 
    246244        elif self.data_type == 'Iqxy': 
    247245            #if not model.info.parameters.has_2d: 
     
    260258            res = resolution2d.Pinhole2D(data=data, index=index, 
    261259                                         nsigma=3.0, accuracy=accuracy) 
    262             #self._theory = np.zeros_like(self.Iq) 
    263             q_vectors = res.q_calc 
    264260        elif self.data_type == 'Iq': 
    265261            index = (data.x >= data.qmin) & (data.x <= data.qmax) 
     
    286282            else: 
    287283                res = resolution.Perfect1D(data.x[index]) 
    288  
    289             #self._theory = np.zeros_like(self.Iq) 
    290             q_vectors = [res.q_calc] 
    291284        elif self.data_type == 'Iq-oriented': 
    292285            index = (data.x >= data.qmin) & (data.x <= data.qmax) 
     
    304297                                      qx_width=data.dxw[index], 
    305298                                      qy_width=data.dxl[index]) 
    306             q_vectors = res.q_calc 
    307299        else: 
    308300            raise ValueError("Unknown data type") # never gets here 
     
    310302        # Remember function inputs so we can delay loading the function and 
    311303        # so we can save/restore state 
    312         self._kernel_inputs = q_vectors 
    313304        self._kernel = None 
    314305        self.Iq, self.dIq, self.index = Iq, dIq, index 
     
    347338        # type: (ParameterSet, float) -> np.ndarray 
    348339        if self._kernel is None: 
    349             self._kernel = self._model.make_kernel(self._kernel_inputs) 
     340            # TODO: change interfaces so that resolution returns kernel inputs 
     341            # Maybe have resolution always return a tuple, or maybe have 
     342            # make_kernel accept either an ndarray or a pair of ndarrays. 
     343            kernel_inputs = self.resolution.q_calc 
     344            if isinstance(kernel_inputs, np.ndarray): 
     345                kernel_inputs = (kernel_inputs,) 
     346            self._kernel = self._model.make_kernel(kernel_inputs) 
    350347 
    351348        # Need to pull background out of resolution for multiple scattering 
Note: See TracChangeset for help on using the changeset viewer.