Describe the bug
(Found by @acdo2002) The MAD (median absolute deviation) calculation becomes lower when more additional nans are included in the fitting data. When std is 0 (with a large number of nans), the fitting fails.
Screenshots or videos

To Reproduce
Steps to reproduce the behavior:
- Fit the entire image and the fitting fails.
Expected behavior
The MAD calculation does not change when additional nans are included (and the fitting result does not change).
Fitting the entire image does not fail.
Platform info (please complete the following information):
- OS [e.g. macOS Monterey]: macOS Big Sur
- Browser [e.g. chrome, safari, electron app]: chrome
- Browser version [e.g. 22]: 117
- Backend branch [e.g. dev, v3b2 release]: dev, v4
- Frontend branch [e.g. dev, v3b2 release]: dev, v4
Additional context
Download test image
Describe the bug
(Found by @acdo2002) The MAD (median absolute deviation) calculation becomes lower when more additional nans are included in the fitting data. When std is 0 (with a large number of nans), the fitting fails.
Screenshots or videos

To Reproduce
Steps to reproduce the behavior:
Expected behavior
The MAD calculation does not change when additional nans are included (and the fitting result does not change).
Fitting the entire image does not fail.
Platform info (please complete the following information):
Additional context
Download test image