This line of code has absolutely nothing to do with data that gets stacked in the coadd. No NaNs get propagated or passed to the coadds. That's the job of statisticsStack and afwMath.StatisticsControl().
This line of code defines the approximate nImage the artifact filter uses to compute the max number of epochs an artifact can appear in before being called persistent rather than ephemeral. It is counting. The line was using the fact that chip-gaps were populated with NaNs to find the chip gaps. Note: chip gaps also have the "NO_DATA" bit set. I want to extend the definition beyond NO_DATA to include every bit plane specified in the badMaskPlanes config parameter. If we don't use the NaNs to define the zero-contribution here to the approximate nImage, it will have no effect on the stacked image.
Weird edge case This afternoon I was thinking about scenarios where accumulating by excluding NO_DATA would yield a different approximate-nImage than excluding NO_DATA and NaN's. I could think of a scenario where someone accidentally removes NO_DATA from badMaskPlanes, which I tried... In this case: The final N-Image produced by assembleSubregion:
does not take into account the NaNs (the chip-gaps and edges), and over estimates the number of epochs contributing. For this weird edge case, it probably would be best to exclude NaNs from the count too.
For the final nImage computed here: (https://github.com/lsst/pipe_tasks/blob/master/python/lsst/pipe/tasks/assembleCoadd.py#L646)
LEFT (normal with badMaskPlane includes NO_DATA) RIGHT(weird, with badMaskPlane that does not include no data)
You'll see on the right the number of visits are overestimated in the final nImage.
Note the coadds are identical.