AlecThomson / RACS-tools

Useful scripts for RACS
BSD 3-Clause "New" or "Revised" License
12 stars 7 forks source link

Numerical instability in NaN masking #41

Closed AlecThomson closed 1 year ago

AlecThomson commented 1 year ago

When convolving with a small kernel in the robust method the current NaN masking is producing some images full of NaNs!

The tricky bit here is that we're casting bools to floats when convolving the NaN mask. We can't just use mask_conv==0 since the area we want is full of floats. The current method to recast float to bool is:

mask_conv = ~np.isclose(mask_conv, 0)

I'll probably need to tweak the tolerance to make this more robust to this kind of numerical error.