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

testPsfDetermination broken due to NumPy behaviour change

    Details

    • Type: Bug
    • Status: Done
    • Priority: Major
    • Resolution: Done
    • Fix Version/s: None
    • Component/s: meas_algorithms
    • Labels:
      None
    • Templates:
    • Story Points:
      0.5
    • Sprint:
      Science Pipelines DM-W16-2
    • Team:
      Data Release Production

      Description

      Old NumPy behaviour (tested on 1.6.2):

      In [1]: import numpy
       
      In [2]: a = numpy.array([])
       
      In [3]: numpy.median(a)
      /usr/lib64/python2.6/site-packages/numpy/core/fromnumeric.py:2374: RuntimeWarning: invalid value encountered in double_scalars
        return mean(axis, dtype, out)
       
      Out[3]: nan
      

      New NumPy behaviour (1.10.0):

      In [1]: import numpy
       
      In [2]: a = numpy.array([])
       
      In [3]: numpy.median(a)
      [...]
      IndexError: index -1 is out of bounds for axis 0 with size 0
      

      This breaks testPsfDeterminer and testPsfDeterminerSubimage, e.g.:

      ERROR: testPsfDeterminerSubimage (__main__.SpatialModelPsfTestCase)
      Test the (PCA) psfDeterminer on subImages
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "./testPsfDetermination.py", line 342, in testPsfDeterminerSubimage
          trimCatalogToImage(subExp, self.catalog))
        File "/Users/jds/Projects/Astronomy/LSST/src/meas_algorithms/python/lsst/meas/algorithms/objectSizeStarSelector.py", line 377, in selectStars
          widthStdAllowed=self._widthStdAllowed)
        File "/Users/jds/Projects/Astronomy/LSST/src/meas_algorithms/python/lsst/meas/algorithms/objectSizeStarSelector.py", line 195, in _kcenters
          centers[i] = func(yvec[clusterId == i])
        File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3084, in median
          overwrite_input=overwrite_input)
        File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.py", line 2997, in _ureduce
          r = func(a, **kwargs)
        File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/function_base.py", line 3138, in _median
          n = np.isnan(part[..., -1])
      IndexError: index -1 is out of bounds for axis 0 with size 0
      

        Attachments

          Container Issues

            Issue Links

              Activity

                People

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Summary Panel