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.