MPoL-dev / MPoL

A flexible Python platform for Regularized Maximum Likelihood imaging
https://mpol-dev.github.io/MPoL/
MIT License
33 stars 11 forks source link

Make images.ImageCube passthrough default, remove `nn.Parameter` from ImageCube #246

Closed iancze closed 8 months ago

iancze commented 8 months ago

Throughout the codebase and tutorials, we always use images.ImageCube with passthrough=True. In this mode, ImageCube's forward method acts like an identity function with some cached state self.cube stored in a 'packed' format ready for easy passing to the FFT. After the first call to forward, (regardless of whether passthrough=True) there are convenience methods for reading the cube in 'sky format', calculating the total flux, and exporting the image to FITS.

I don't think we ever use ImageCube in a non-passthrough capacity. This is a holdover feature from before we introduced BaseCube. The only justification for keeping this functionality would be where the user wanted a direct mapping from self.cube pixels to true sky pixels. I would argue that this is a) usually not desireable... enforcing non-negative pixel fluxes is a physically motivated and often strong regularization b) better accomplished by using BaseCube with a pixel_mapping function of lambda x : x.

Suggested changes Make ImageCube a passthrough layer by default and remove capacity for nn.Parameter in this layer entirely.