Ignore:
Timestamp:
Oct 11, 2018 1:59:57 PM (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/dataloader/data_info.py

    r9e6aeaf re090ba90  
    2626import numpy as np 
    2727import math 
     28from math import fabs 
    2829 
    2930class plottable_1D(object): 
     
    656657        return self._perform_operation(other, operation) 
    657658 
    658     def __div__(self, other): 
     659    def __truediv__(self, other): 
    659660        """ 
    660661        Divided a data set by another 
     
    667668            return a/b 
    668669        return self._perform_operation(other, operation) 
    669  
    670     def __rdiv__(self, other): 
     670    __div__ = __truediv__ 
     671 
     672    def __rtruediv__(self, other): 
    671673        """ 
    672674        Divided a data set by another 
     
    679681            return b/a 
    680682        return self._perform_operation(other, operation) 
     683    __rdiv__ = __rtruediv__ 
    681684 
    682685    def __or__(self, other): 
     
    800803            TOLERANCE = 0.01 
    801804            for i in range(len(self.x)): 
    802                 if math.fabs((self.x[i] - other.x[i])/self.x[i]) > TOLERANCE: 
     805                if fabs(self.x[i] - other.x[i]) > self.x[i]*TOLERANCE: 
    803806                    msg = "Incompatible data sets: x-values do not match" 
    804807                    raise ValueError(msg) 
     
    10221025                raise ValueError(msg) 
    10231026            for ind in range(len(self.data)): 
    1024                 if math.fabs((self.qx_data[ind] - other.qx_data[ind])/self.qx_data[ind]) > TOLERANCE: 
     1027                if fabs(self.qx_data[ind] - other.qx_data[ind]) > fabs(self.qx_data[ind])*TOLERANCE: 
    10251028                    msg = "Incompatible data sets: qx-values do not match: %s %s" % (self.qx_data[ind], other.qx_data[ind]) 
    10261029                    raise ValueError(msg) 
    1027                 if math.fabs((self.qy_data[ind] - other.qy_data[ind])/self.qy_data[ind]) > TOLERANCE: 
     1030                if fabs(self.qy_data[ind] - other.qy_data[ind]) > fabs(self.qy_data[ind])*TOLERANCE: 
    10281031                    msg = "Incompatible data sets: qy-values do not match: %s %s" % (self.qy_data[ind], other.qy_data[ind]) 
    10291032                    raise ValueError(msg) 
Note: See TracChangeset for help on using the changeset viewer.