Image masking code is hard to understand and test, refactor the code to make the functions explain each step
- (initialize mask, check for finite, mask_non_linear, ensure there is a mask in the image, update image mask, etc.)
Goal: Change image masking to be more flexible per instrument, especially to deal with really crappy instruments/reductions sometimes used by @lgalbany
This issue should enable a more robust/custom per instrument masking.