Project: datamanagement
Issue DM-4071: testPsfDetermination broken due to NumPy behaviour change
Old NumPy behaviour (tested on 1.6.2): {code} 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 {code} New NumPy behaviour (1.10.0): {code} 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 {code} This breaks {{testPsfDeterminer}} and {{testPsfDeterminerSubimage}}, e.g.: {code} 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 {code}
Story points: 1