Esempio n. 1
0
    def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None):
        """
            :param smearer: is an object of class QSmearer or SlitSmearer
               that will smear the theory data (slit smearing or resolution
               smearing) when set.
            
            The proper way to set the smearing object would be to
            do the following: ::
            
                from sas.models.qsmearing import smear_selection
                smearer = smear_selection(some_data)
                fitdata1d = FitData1D( x= [1,3,..,],
                                        y= [3,4,..,8],
                                        dx=None,
                                        dy=[1,2...], smearer= smearer)
           
            :Note: that some_data _HAS_ to be of
                class DataLoader.data_info.Data1D
                Setting it back to None will turn smearing off.
                
        """
        Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy)
        self.num_points = len(x)
        self.sas_data = data
        self.smearer = smearer
        self._first_unsmeared_bin = None
        self._last_unsmeared_bin = None
        # Check error bar; if no error bar found, set it constant(=1)
        # TODO: Should provide an option for users to set it like percent,
        # constant, or dy data
        if dy is None or dy == [] or dy.all() == 0:
            self.dy = numpy.ones(len(y))
        else:
            self.dy = numpy.asarray(dy).copy()

        ## Min Q-value
        #Skip the Q=0 point, especially when y(q=0)=None at x[0].
        if min(self.x) == 0.0 and self.x[0] == 0 and\
                     not numpy.isfinite(self.y[0]):
            self.qmin = min(self.x[self.x != 0])
        else:
            self.qmin = min(self.x)
        ## Max Q-value
        self.qmax = max(self.x)

        # Range used for input to smearing
        self._qmin_unsmeared = self.qmin
        self._qmax_unsmeared = self.qmax
        # Identify the bin range for the unsmeared and smeared spaces
        self.idx = (self.x >= self.qmin) & (self.x <= self.qmax)
        self.idx_unsmeared = (self.x >= self._qmin_unsmeared) \
                            & (self.x <= self._qmax_unsmeared)
Esempio n. 2
0
    def __init__(self, x, y, dx=None, dy=None, smearer=None, data=None):
        """
            :param smearer: is an object of class QSmearer or SlitSmearer
               that will smear the theory data (slit smearing or resolution
               smearing) when set.
            
            The proper way to set the smearing object would be to
            do the following: ::
            
                from sas.models.qsmearing import smear_selection
                smearer = smear_selection(some_data)
                fitdata1d = FitData1D( x= [1,3,..,],
                                        y= [3,4,..,8],
                                        dx=None,
                                        dy=[1,2...], smearer= smearer)
           
            :Note: that some_data _HAS_ to be of
                class DataLoader.data_info.Data1D
                Setting it back to None will turn smearing off.
                
        """
        Data1D.__init__(self, x=x, y=y, dx=dx, dy=dy)
        self.num_points = len(x)
        self.sas_data = data
        self.smearer = smearer
        self._first_unsmeared_bin = None
        self._last_unsmeared_bin = None
        # Check error bar; if no error bar found, set it constant(=1)
        # TODO: Should provide an option for users to set it like percent,
        # constant, or dy data
        if dy is None or dy == [] or dy.all() == 0:
            self.dy = numpy.ones(len(y))
        else:
            self.dy = numpy.asarray(dy).copy()

        ## Min Q-value
        #Skip the Q=0 point, especially when y(q=0)=None at x[0].
        if min(self.x) == 0.0 and self.x[0] == 0 and\
                     not numpy.isfinite(self.y[0]):
            self.qmin = min(self.x[self.x != 0])
        else:
            self.qmin = min(self.x)
        ## Max Q-value
        self.qmax = max(self.x)
        
        # Range used for input to smearing
        self._qmin_unsmeared = self.qmin
        self._qmax_unsmeared = self.qmax
        # Identify the bin range for the unsmeared and smeared spaces
        self.idx = (self.x >= self.qmin) & (self.x <= self.qmax)
        self.idx_unsmeared = (self.x >= self._qmin_unsmeared) \
                            & (self.x <= self._qmax_unsmeared)
Esempio n. 3
0
 def __init__(self, x=None, y=None, dx=None, dy=None):
     """
     """
     if x is None:
         x = []
     if y is None:
         y = []
     PlotData1D.__init__(self, x, y, dx, dy)
     LoadData1D.__init__(self, x, y, dx, dy)
     self.id = None
     self.list_group_id = []
     self.group_id = None
     self.is_data = True
     self.path = None
     self.xtransform = None
     self.ytransform = None
     self.title = ""
     self.scale = None
Esempio n. 4
0
 def __init__(self, x=None, y=None, dx=None, dy=None):
     """
     """
     if x is None:
         x = []
     if y is None:
         y = []
     PlotData1D.__init__(self, x, y, dx, dy)
     LoadData1D.__init__(self, x, y, dx, dy)
     self.id = None
     self.list_group_id = []
     self.group_id = None
     self.is_data = True
     self.path = None
     self.xtransform = None
     self.ytransform = None
     self.title = ""
     self.scale = None