Uploaded image for project: 'Data Management'
  1. Data Management
  2. DM-14735

Fix polynomial warnings in shapelet

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: To Do
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: shapelet

      Description

      test_hermiteTransformMatrix.py produces the following warning (twice):

      tests/test_hermiteTransformMatrix.py::HermiteTransformMatrixTestCase::testTransformMatrix
        /Users/rowen/UW/LSST/lsstsw3/miniconda/lib/python3.6/site-packages/numpy/lib/polynomial.py:1187: FutureWarning: In the future extra properties will not be copied across when constructing one poly1d from another
          other = poly1d(other)
      

      This appears to be a legitimate issue but I confess I'm not sure what to do about it.

        Attachments

          Issue Links

            Activity

            Hide
            jbosch Jim Bosch added a comment -

            I'm quite certain that we're not relying on any extra attributes being copied.  I'd guess NumPy has a way to squash the warning by acknowledging somehow (i.e. with some keyword argument) that you accept the changed behavior.

            Show
            jbosch Jim Bosch added a comment - I'm quite certain that we're not relying on any extra attributes being copied.  I'd guess NumPy has a way to squash the warning by acknowledging somehow (i.e. with some keyword argument) that you accept the changed behavior.
            Hide
            tjenness Tim Jenness added a comment -

            The code triggering this is from polynomial.py:

               1325     def __mul__(self, other):
               1326         if isscalar(other):
               1327             return poly1d(self.coeffs * other)
               1328         else:
               1329             other = poly1d(other)
               1330             return poly1d(polymul(self.coeffs, other.coeffs))
               1331 
            

            The warning from polynomial.py comes from:

               1223             if set(c_or_r.__dict__) - set(self.__dict__):
               1224                 msg = ("In the future extra properties will not be copied "
               1225                        "across when constructing one poly1d from another")
               1226                 warnings.warn(msg, FutureWarning, stacklevel=2)
               1227                 self.__dict__.update(c_or_r.__dict__)
            

            The full stack trace is:

            Traceback (most recent call last):
              File "tests/test_hermiteTransformMatrix.py", line 83, in testTransformMatrix
                v1 = self.ht(inx)(transPoint.getX()) * self.ht(iny)(transPoint.getY())
              File "tests/test_hermiteTransformMatrix.py", line 49, in ht
                return (scipy.poly1d([(2**n * np.pi**0.5 * scipy.special.gamma(n+1))**(-0.5)])
              File "/Users/timj/work/lsstsw3/miniconda/envs/lsst-scipipe-2.0.0/lib/python3.8/site-packages/numpy/lib/polynomial.py", line 1329, in __mul__
                other = poly1d(other)
              File "/Users/timj/work/lsstsw3/miniconda/envs/lsst-scipipe-2.0.0/lib/python3.8/site-packages/numpy/lib/polynomial.py", line 1226, in __init__
                warnings.warn(msg, FutureWarning, stacklevel=2)
            

            Show
            tjenness Tim Jenness added a comment - The code triggering this is from polynomial.py: 1325 def __mul__(self, other): 1326 if isscalar(other): 1327 return poly1d(self.coeffs * other) 1328 else: 1329 other = poly1d(other) 1330 return poly1d(polymul(self.coeffs, other.coeffs)) 1331 The warning from polynomial.py comes from: 1223 if set(c_or_r.__dict__) - set(self.__dict__): 1224 msg = ("In the future extra properties will not be copied " 1225 "across when constructing one poly1d from another") 1226 warnings.warn(msg, FutureWarning, stacklevel=2) 1227 self.__dict__.update(c_or_r.__dict__) The full stack trace is: Traceback (most recent call last): File "tests/test_hermiteTransformMatrix.py", line 83, in testTransformMatrix v1 = self.ht(inx)(transPoint.getX()) * self.ht(iny)(transPoint.getY()) File "tests/test_hermiteTransformMatrix.py", line 49, in ht return (scipy.poly1d([(2**n * np.pi**0.5 * scipy.special.gamma(n+1))**(-0.5)]) File "/Users/timj/work/lsstsw3/miniconda/envs/lsst-scipipe-2.0.0/lib/python3.8/site-packages/numpy/lib/polynomial.py", line 1329, in __mul__ other = poly1d(other) File "/Users/timj/work/lsstsw3/miniconda/envs/lsst-scipipe-2.0.0/lib/python3.8/site-packages/numpy/lib/polynomial.py", line 1226, in __init__ warnings.warn(msg, FutureWarning, stacklevel=2)
            Hide
            jbosch Jim Bosch added a comment -

            Still seems valid.  Low priority because pretty much nobody develops in this package anyway, so these warnings are much less visible than others.

            Show
            jbosch Jim Bosch added a comment - Still seems valid.  Low priority because pretty much nobody develops in this package anyway, so these warnings are much less visible than others.

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rowen Russell Owen
              Watchers:
              Jim Bosch, Russell Owen, Tim Jenness
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:

                  Jenkins

                  No builds found.