Changeset 7988501 in sasview


Ignore:
Timestamp:
Oct 8, 2016 2:34:03 PM (8 years ago)
Author:
jhbakker
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
51a4d78
Parents:
6df015de
Message:

Data1D class changed to include SESANS Data format

Location:
src/sas
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/dataloader/data_info.py

    r1b82623 r7988501  
    705705        raise(TypeError,'This is neither SANS nor SESANS data, what the hell are you doing??') 
    706706 
    707     def __init__(self, x=None, y=None, lam=None, dx=None, dy=None, dlam=None): 
     707    def __init__(self, x=None, y=None, dx=None, dy=None, lam=None, dlam=None): 
    708708        DataInfo.__init__(self) 
    709         plottable_1D.__init__(self, x, y, lam, dx, dy, dlam) 
     709        plottable_1D.__init__(self, x, y, dx, dy,None, None, lam, dlam) 
     710        if self.lam is None: # This means the lam param was not detected in the data: it's SANS data! 
     711            x_unit = '1/A' 
     712            y_unit = '1/cm' 
     713        elif self.lam is not None: # This means lam was detected (should be an empty ndarray): it's SESANS data! 
     714            x_unit = 'A' 
     715            y_unit = 'pol' 
     716        else: # and if it's neither, you get punished! 
     717            raise(TypeError,'This is neither SANS nor SESANS data, what the hell are you doing??') 
    710718 
    711719    def __str__(self): 
  • src/sas/sascalc/fit/AbstractFitEngine.py

    rfc18690 r7988501  
    131131        a way to get residuals from data. 
    132132    """ 
    133     def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None): 
     133    def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None, lam=None, dlam=None): 
    134134        """ 
    135135            :param smearer: is an object of class QSmearer or SlitSmearer 
     
    152152                 
    153153        """ 
    154         Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy) 
     154        Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy, lam=lam,dlam=dlam) 
    155155        self.num_points = len(x) 
    156156        self.sas_data = data 
  • src/sas/sascalc/fit/BumpsFitting.py

    rb699768 r7988501  
    2626from bumps import parameter 
    2727from bumps.fitproblem import FitProblem 
    28  
    2928 
    3029from sas.sascalc.fit.AbstractFitEngine import FitEngine 
  • src/sas/sasgui/guiframe/dataFitting.py

    rd85c194 r7988501  
    1717    """ 
    1818    """ 
    19     def __init__(self, x=None, y=None, dx=None, dy=None): 
     19    def __init__(self, x=None, y=None, dx=None, dy=None, lam=None, dlam=None): 
    2020        """ 
    2121        """ 
     
    2424        if y is None: 
    2525            y = [] 
    26         PlotData1D.__init__(self, x, y, dx, dy) 
    27         LoadData1D.__init__(self, x, y, dx, dy) 
     26        PlotData1D.__init__(self, x, y, lam, dx, dy, dlam) 
     27        LoadData1D.__init__(self, x, y, lam, dx, dy, dlam) 
    2828        self.id = None 
    2929        self.list_group_id = [] 
     
    6868        # First, check the data compatibility 
    6969        dy, dy_other = self._validity_check(other) 
    70         result = Data1D(x=[], y=[], dx=None, dy=None) 
     70        result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=None) 
    7171        result.clone_without_data(length=len(self.x), clone=self) 
    7272        result.copy_from_datainfo(data1d=self) 
     
    115115        # First, check the data compatibility 
    116116        self._validity_check_union(other) 
    117         result = Data1D(x=[], y=[], dx=None, dy=None) 
     117        result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=None) 
    118118        tot_length = len(self.x) + len(other.x) 
    119119        result = self.clone_without_data(length=tot_length, clone=result) 
     120        if self.dlam == None or other.dlam is None: 
     121            result.dlam = None 
     122        else: 
     123            result.dlam = numpy.zeros(tot_length) 
    120124        if self.dy == None or other.dy is None: 
    121125            result.dy = None 
     
    141145        result.y = numpy.append(self.y, other.y) 
    142146        result.y = result.y[ind] 
     147        result.lam = numpy.append(self.lam, other.lam) 
     148        result.lam = result.lam[ind] 
     149        if result.dlam != None: 
     150            result.dlam = numpy.append(self.dlam, other.dlam) 
     151            result.dlam = result.dlam[ind] 
    143152        if result.dy != None: 
    144153            result.dy = numpy.append(self.dy, other.dy) 
     
    260269        # First, check the data compatibility 
    261270        self._validity_check_union(other) 
    262         result = Data1D(x=[], y=[], dx=None, dy=None) 
     271        result = Data1D(x=[], y=[], lam=[], dx=None, dy=None, dlam=[]) 
    263272        tot_length = len(self.x)+len(other.x) 
    264273        result.clone_without_data(length=tot_length, clone=self) 
     274        if self.dlam == None or other.dlam is None: 
     275            result.dlam = None 
     276        else: 
     277            result.dlam = numpy.zeros(tot_length) 
    265278        if self.dy == None or other.dy is None: 
    266279            result.dy = None 
     
    285298        result.y = numpy.append(self.y, other.y) 
    286299        result.y = result.y[ind] 
     300        result.lam = numpy.append(self.lam, other.lam) 
     301        result.lam = result.lam[ind] 
    287302        if result.dy != None: 
    288303            result.dy = numpy.append(self.dy, other.dy) 
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r6df015de r7988501  
    282282                           num=self.npts_x, endpoint=True) 
    283283        self.data = Data1D(x=x) 
    284         self.data.xaxis('\\rm{Q}', "A^{-1}") 
    285         self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     284        #self.data.xaxis('\\rm{Q}', "A^{-1}") 
     285        self.data.xaxis('\\rm{X}', "") 
     286        #self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     287        self.data.yaxis('\\rm{Y}', "") 
    286288        self.data.is_data = False 
    287289        self.data.id = str(self.uid) + " data" 
     
    308310                           num=self.npts_x, endpoint=True, base=10.0) 
    309311        self.data = Data1D(x=x) 
    310         self.data.xaxis('\\rm{Q}', "A^{-1}") 
    311         self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     312        #self.data.xaxis('\\rm{Q}', "A^{-1}") 
     313        #self.data.yaxis('\\rm{Intensity}', "cm^{-1}") 
     314        self.data.xaxis('\\rm{X}', "") 
     315        self.data.yaxis('\\rm{Y}', "") 
    312316        self.data.is_data = False 
    313317        self.data.id = str(self.uid) + " data" 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r6df015de r7988501  
    9898    def onTrafo(self, event): 
    9999        """ 
    100         On Weighting radio button event, sets the weightbt_string 
     100        On Trafo radio button event, sets the Trafobt_string 
    101101        """ 
    102102        self.Trafobt_string = event.GetEventObject().GetLabelText() 
     
    120120        self.no_transform = wx.RadioButton(self, wx.ID_ANY, 
    121121                                                  'None', style=wx.RB_GROUP) 
    122         self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
    123                           id=self.no_transform.GetId()) 
     122 
     123        #self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
     124         #                 id=self.no_transform.GetId()) 
    124125        self.hankel = wx.RadioButton(self, wx.ID_ANY, 
    125126                                                  'Hankel') 
    126         self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
    127                           id=self.hankel.GetId()) 
     127        #self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
     128        #                  id=self.hankel.GetId()) 
    128129        self.cosine = wx.RadioButton(self, wx.ID_ANY, 
    129130                                                  'Cosine') 
    130         self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
    131                           id=self.cosine.GetId()) 
     131        #self.Bind(wx.EVT_RADIOBUTTON, self.onTrafo, 
     132         #                 id=self.cosine.GetId()) 
    132133 
    133134        #Not sure about this (only once though) 
  • src/sas/sasgui/plottools/plottables.py

    r8abd96d r7988501  
    10221022    """ 
    10231023 
    1024     def __init__(self, x, y, dx=None, dy=None): 
     1024    def __init__(self, x, y, lam=None, dx=None, dy=None, dlam=None): 
    10251025        """ 
    10261026        Draw points specified by x[i],y[i] in the current color/symbol. 
     
    10361036        self.x = x 
    10371037        self.y = y 
     1038        self.lam = lam 
    10381039        self.dx = dx 
    10391040        self.dy = dy 
     1041        self.dlam = dlam 
    10401042        self.source = None 
    10411043        self.detector = None 
Note: See TracChangeset for help on using the changeset viewer.