Clipped variance error estimate

It looks like there may be a bug in line 1000 of afw/math/Statistics.cc [link]. This is ostensibly supposed to set ret.second to be an estimate of the error in the clipped variance. However, it performs the vacuous operation ret.second = ret.second, which just leaves it as the initial default value, NaN (line 940).

I believe that _varianceclip.second (assigned on line 924, making use of the varianceError method defined on line 136) is intended to be the square of the estimated error here, similar to how _variance.second is used on line 988 to establish the error on the unclipped variance.

Is my understanding correct? If so, then line 1000 should be revised to set ret.second equal to ::sqrt(_varianceclip.second). I’ve set up a pull request with this proposed edit here.

Thanks for finding this and for your pull request. Someone from the Science Pipelines team will follow our external contribution process to run it through our Continuous Integration system and merge it.

I’ve filed DM-31358 to track this. It looks like there isn’t a test for the clipped variance error estimate in test_statistics, so I’m adding that test on the branch.

1 Like