estimateBackground deep copies the exposure if subtract=True and returns the copy. This seems a waste of memory and time with no real benefit for the user. In my opinion it should simply modify the exposure in place. In addition, it returns the exposure or None if background not subtracted; this is clumsy and seems unnecessary if it modifies the exposure in place. Also it has a ConfigClass attribute so I suggest that it be made a task.
My full proposal is:
- Modify the exposure in place if subtracting the background
- Accept the current background model, make a shallow copy and return the new background. That way if background is not to be subtracted the input background model is still valid for the exposure.
- Make estimateBackground a task