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

meas_base tests broken with NumPy 1.12

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Done
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      meas_base's tests/testVariance.py contains the line:

      var.getArray()[bad, :] = float("nan")
      

      Where bad is 54.0.

      As of NumPy 1.12, this will throw an IndexError and the tests (obviously) fail.

      Should be an easy fix.

        Attachments

          Issue Links

            Activity

            Hide
            swinbank John Swinbank added a comment -

            (Assigned to me since it's blocking me from making progress, but I won't be able to look at it for a few hours — if somebody else catches it in the meantime, be my guest.)

            Show
            swinbank John Swinbank added a comment - (Assigned to me since it's blocking me from making progress, but I won't be able to look at it for a few hours — if somebody else catches it in the meantime, be my guest.)
            Hide
            swinbank John Swinbank added a comment -

            Same issue in meas_deblender:

            ======================================================================
            ERROR: test1 (__main__.RampEdgeTestCase)
            ----------------------------------------------------------------------
            Traceback (most recent call last):
              File "tests/testEdges.py", line 198, in test1
                parent1d = img[yslice, :]
            IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
             
            ----------------------------------------------------------------------
            

            Show
            swinbank John Swinbank added a comment - Same issue in meas_deblender: ====================================================================== ERROR: test1 (__main__.RampEdgeTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/testEdges.py", line 198, in test1 parent1d = img[yslice, :] IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices   ----------------------------------------------------------------------
            Hide
            swinbank John Swinbank added a comment -

            Looks like something similar in ip_diffim:

            ======================================================================
            ERROR: testMeasure (__main__.DipoleMeasurementTaskTest)
            ----------------------------------------------------------------------
            Traceback (most recent call last):
              File "tests/testDipole.py", line 371, in testMeasure
                psf, psfSum, exposure, s = createDipole(100, 100, 50, 50)
              File "tests/testDipole.py", line 83, in createDipole
                array[yp:yp+psfh, xp:xp+psfw] += psfim.getArray()
            TypeError: slice indices must be integers or None or have an __index__ method
             
            ----------------------------------------------------------------------
            

            Show
            swinbank John Swinbank added a comment - Looks like something similar in ip_diffim: ====================================================================== ERROR: testMeasure (__main__.DipoleMeasurementTaskTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/testDipole.py", line 371, in testMeasure psf, psfSum, exposure, s = createDipole(100, 100, 50, 50) File "tests/testDipole.py", line 83, in createDipole array[yp:yp+psfh, xp:xp+psfw] += psfim.getArray() TypeError: slice indices must be integers or None or have an __index__ method   ----------------------------------------------------------------------
            Hide
            swinbank John Swinbank added a comment -

            meas_modelfit:

            ***** error: from /Users/jds/Projects/Astronomy/LSST/stack/EupsBuildDir/DarwinX86/meas_modelfit-12.1-8-g91d787d+17/build.log:
            ======================================================================
            ERROR: testFull (__main__.GeneralShapeletPsfApproxPluginsTestCase)
            ----------------------------------------------------------------------
            Traceback (most recent call last):
              File "tests/testGeneralShapeletPsfModels.py", line 139, in testFull
                self.exposure.setPsf(self.makePsf("galsimPsf_0.9.fits", max=33))
              File "tests/testGeneralShapeletPsfModels.py", line 67, in makePsf
                data = data[trim0:trim0+max, trim1:trim1+max]
            TypeError: slice indices must be integers or None or have an __index__ method
             
            ----------------------------------------------------------------------
            

            Show
            swinbank John Swinbank added a comment - meas_modelfit: ***** error: from /Users/jds/Projects/Astronomy/LSST/stack/EupsBuildDir/DarwinX86/meas_modelfit-12.1-8-g91d787d+17/build.log: ====================================================================== ERROR: testFull (__main__.GeneralShapeletPsfApproxPluginsTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/testGeneralShapeletPsfModels.py", line 139, in testFull self.exposure.setPsf(self.makePsf("galsimPsf_0.9.fits", max=33)) File "tests/testGeneralShapeletPsfModels.py", line 67, in makePsf data = data[trim0:trim0+max, trim1:trim1+max] TypeError: slice indices must be integers or None or have an __index__ method   ----------------------------------------------------------------------
            Hide
            swinbank John Swinbank added a comment -
            Show
            swinbank John Swinbank added a comment - Jenkins: lsst_distrib lsst_py3
            Hide
            swinbank John Swinbank added a comment -

            Hey David Reiss, do you have time to review this? It should be pretty trivial!

            Show
            swinbank John Swinbank added a comment - Hey David Reiss , do you have time to review this? It should be pretty trivial!
            Hide
            rowen Russell Owen added a comment -

            My unsolicited comment is that these changes all look good, but I suggest using int(py+psfh) instead of int(py)+psfh in ip_diffim. (If David Reiss is comfortable with it, this could be deemed a review).

            Show
            rowen Russell Owen added a comment - My unsolicited comment is that these changes all look good, but I suggest using int(py+psfh) instead of int(py)+psfh in ip_diffim. (If David Reiss is comfortable with it, this could be deemed a review).
            Hide
            swinbank John Swinbank added a comment -

            I've tweaked the way the casting is done in ip_diffim based on the suggestion from Russell Owen and further comments from Tim Jenness. Not quite in the way either of them suggested, but I hope it's good enough to keep them happy!

            I'll wait for David to chime in on whether he thinks this has had enough reviewing before I do anything else.

            Show
            swinbank John Swinbank added a comment - I've tweaked the way the casting is done in ip_diffim based on the suggestion from Russell Owen and further comments from Tim Jenness . Not quite in the way either of them suggested, but I hope it's good enough to keep them happy! I'll wait for David to chime in on whether he thinks this has had enough reviewing before I do anything else.
            Hide
            reiss David Reiss added a comment -

            Looks good to me and you chose the casting that I would have preferred. So call it reviewed.
            Thanks also to Russell Owen and Tim Jenness.

            Show
            reiss David Reiss added a comment - Looks good to me and you chose the casting that I would have preferred. So call it reviewed. Thanks also to Russell Owen and Tim Jenness .
            Hide
            swinbank John Swinbank added a comment -

            Thanks, all. Merged.

            Show
            swinbank John Swinbank added a comment - Thanks, all. Merged.

              People

              Assignee:
              swinbank John Swinbank
              Reporter:
              swinbank John Swinbank
              Reviewers:
              David Reiss
              Watchers:
              David Reiss, John Swinbank, Russell Owen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: