Changeset 0ac3db5 in sasmodels for sasmodels/bumps_model.py


Ignore:
Timestamp:
Feb 18, 2015 3:01:46 PM (9 years ago)
Author:
jhbakker
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:
a006b63
Parents:
e806077
Message:

SESANSfit now uses sesans_reader dataloader

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/bumps_model.py

    rc97724e r0ac3db5  
    217217def _plot_sesans(data, theory, view): 
    218218    import matplotlib.pyplot as plt 
    219     resid = (theory - data.data)/data.err_data 
     219    resid = (theory - data.y)/data.dy 
    220220    plt.subplot(121) 
    221     plt.errorbar(data.SElength, data.data, yerr=data.err_data) 
    222     plt.plot(data.SElength, theory, '-', hold=True) 
     221    plt.errorbar(data.x, data.y, yerr=data.dy) 
     222    plt.plot(data.x, theory, '-', hold=True) 
    223223    plt.xlabel('spin echo length (A)') 
    224224    plt.ylabel('polarization') 
    225225    plt.subplot(122) 
    226     plt.plot(data.SElength, resid, 'x') 
     226    plt.plot(data.x, resid, 'x') 
    227227    plt.xlabel('spin echo length (A)') 
    228228    plt.ylabel('residuals') 
     
    267267        self.model = model 
    268268        self.cutoff = cutoff 
    269         if hasattr(data, 'SElength'): 
     269# TODO       if  isinstance(data,SESANSData1D)         
     270        if hasattr(data, 'lam'): 
    270271            self.data_type = 'sesans' 
    271272        elif hasattr(data, 'qx_data'): 
     
    278279        # interpret data 
    279280        if self.data_type == 'sesans': 
    280             q = sesans.make_q(data.q_zmax, data.Rmax) 
     281            q = sesans.make_q(data.sample.zacceptance, data.Rmax) 
    281282            self.index = slice(None,None) 
    282             self.iq = data.data 
    283             self.diq = data.err_data 
     283            self.iq = data.y 
     284            self.diq = data.dy 
    284285            self._theory = np.zeros_like(q) 
    285286            q_vectors = [q] 
     
    353354            #self._theory[:] = self._fn.eval(pars, pd_pars) 
    354355            if self.data_type == 'sesans': 
    355                 P = sesans.hankel(self.data.SElength, self.data.wavelength, 
    356                                   self.data.thickness, self._fn_inputs[0], 
     356                P = sesans.hankel(self.data.x, self.data.lam, 
     357                                  self.data.sample.thickness/10, self._fn_inputs[0], 
    357358                                  self._theory) 
    358359                self._cache['theory'] = P 
     
    401402            self.data.data[self.index] = y 
    402403        elif self.data_type == 'sesans': 
    403             self.data.data[self.index] = y 
     404            self.data.y[self.index] = y 
    404405        else: 
    405406            raise ValueError("Unknown model") 
Note: See TracChangeset for help on using the changeset viewer.