Changeset d1ff3a5 in sasmodels


Ignore:
Timestamp:
Jul 26, 2017 12:52:11 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
72be531
Parents:
b139ee6
Message:

make sure y, dy exists when setting simulated data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/direct_model.py

    ra769b54 rd1ff3a5  
    293293        self.Iq = y 
    294294        if self.data_type in ('Iq', 'Iq-oriented'): 
     295            if self._data.y is None: 
     296                self._data.y = np.empty(len(self._data.x), 'd') 
     297            if self._data.dy is None: 
     298                self._data.dy = np.empty(len(self._data.x), 'd') 
    295299            self._data.dy[self.index] = dy 
    296300            self._data.y[self.index] = y 
    297301        elif self.data_type == 'Iqxy': 
     302            if self._data.data is None: 
     303                self._data.data = np.empty_like(self._data.qx_data, 'd') 
     304            if self._data.err_data is None: 
     305                self._data.err_data = np.empty_like(self._data.qx_data, 'd') 
    298306            self._data.data[self.index] = y 
     307            self._data.err_data[self.index] = dy 
    299308        elif self.data_type == 'sesans': 
     309            if self._data.y is None: 
     310                self._data.y = np.empty(len(self._data.x), 'd') 
    300311            self._data.y[self.index] = y 
    301312        else: 
     
    315326        # TODO: extend plotting of calculate Iq to other measurement types 
    316327        # TODO: refactor so we don't store the result in the model 
    317         self.Iq_calc = None 
     328        self.Iq_calc = Iq_calc 
    318329        if self.data_type == 'sesans': 
    319330            Iq_mono = (call_kernel(self._kernel_mono, pars, mono=True) 
Note: See TracChangeset for help on using the changeset viewer.