Changeset e090ba90 in sasview for src/sas/sascalc/corfunc


Ignore:
Timestamp:
Oct 11, 2018 11:59:57 AM (6 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1249
Children:
88d2e70
Parents:
67ed543
Message:

remove errors and warnings from py37 tests of sascalc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/corfunc/corfunc_calculator.py

    ra26f67f re090ba90  
    3030            self.start = start 
    3131            self.stop = stop 
    32             self._lastx = [] 
    33             self._lasty = [] 
     32            self._lastx = np.empty(0, dtype='d') 
     33            self._lasty = None 
    3434 
    3535        def __call__(self, x): 
    3636            # If input is a single number, evaluate the function at that number 
    3737            # and return a single number 
    38             if type(x) == float or type(x) == int: 
     38            if isinstance(x, (float, int)): 
    3939                return self._smoothed_function(np.array([x]))[0] 
    4040            # If input is a list, and is different to the last input, evaluate 
     
    4242            # the function was called, return the result that was calculated 
    4343            # last time instead of explicity evaluating the function again. 
    44             elif self._lastx == [] or x.tolist() != self._lastx.tolist(): 
    45                 self._lasty = self._smoothed_function(x) 
    46                 self._lastx = x 
     44            if not np.array_equal(x, self._lastx): 
     45                self._lastx, self._lasty = x, self._smoothed_function(x) 
    4746            return self._lasty 
    4847 
     
    8887        # Only process data of the class Data1D 
    8988        if not issubclass(data.__class__, Data1D): 
    90             raise ValueError("Data must be of the type DataLoader.Data1D") 
     89            raise ValueError("Correlation function cannot be computed with 2D data.") 
    9190 
    9291        # Prepare the data 
     
    246245        """Fit the Guinier region of the curve""" 
    247246        A = np.vstack([q**2, np.ones(q.shape)]).T 
    248         return lstsq(A, np.log(iq)) 
     247        return lstsq(A, np.log(iq), rcond=None) 
    249248 
    250249    def _fit_porod(self, q, iq): 
Note: See TracChangeset for help on using the changeset viewer.