Details
-
Type:
Bug
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: meas_algorithms
-
Labels:None
-
Story Points:2
-
Epic Link:
-
Sprint:DRP X16-3
-
Team:Data Release Production
Description
`ObjectSizeStarSelector` can produce the following numpy warning:
RuntimeWarning: invalid value encountered in less
|
This occurs at the following point in the code:
for i in range(nCluster):
|
# Only compute func if some points are available; otherwise, default to NaN.
|
pointsInCluster = (clusterId == i)
|
if numpy.any(pointsInCluster):
|
centers[i] = func(yvec[pointsInCluster])
|
where `func` has been assigned to `numpy.mean`. When I have seen this occur I have found that `dist` is an array of `nan`
I suggest that the star selector handle this situation more gracefully, e.g. by reporting an appropriate exception or handling the data in an appropriate way. If logging a message would be helpful, then please do that (and if RFC-154 is adopted, a log will be available).
One way to reproduce this is to run `tests/testProcessCcd.py` in `pipe_tasks`. However, I often see it when running `processCcd.py` on other data, as well.
Attachments
Issue Links
- mentioned in
-
Page Loading...
I was asked for more information about what I want, so here goes....
I feel that the warning messages from numpy are basically useless because the user has no idea where they are coming from nor what the problem is.
The following are all possible better ways to handle this, depending on what problem is causing the warning:
Also, some of these numpy warnings are being caused by not properly identifying problems before calling numpy (e.g. passing an empty array). If the error condition is easy to test before calling numpy then I suggest doing that. I doubt all such conditions can be caught in advance, but when they can, that's a good thing to do.
For logging: all tasks already contain a log attribute. If you are catching the issue in non-task code (such as a measurement plugin) then you can easily get a log object from pex_logging and log to that. I suggest creating it in the constructor so all methods of the plugin have access to it.