photutils icon indicating copy to clipboard operation
photutils copied to clipboard

EPSFModel could do with a 2D wrapper like GriddablePSFModel

Open Onoddil opened this issue 5 years ago • 0 comments

FittableImageModel has a wrapper for varying PSFs in GriddablePSFModel. It would be good if there were other options available in 2D interpolation form -- primarily one for EPSFModel, to match more closely the framework laid out in its corresponding publication (Anderson & King 2000).

Given that GriddablePSFModel seems to actually only worry about what underlying model it is an interpolation of in its evaluate call, where it evaluates the 4 closest model interpolation spline points (at each pixel?) and subsequently creates a FittableImageModel for those spline points and evaluates them at some x, y points, could this be extended to simply allow for an input model? Say

    def __init__(self, data, flux=flux.default, x_0=x_0.default,
                 y_0=y_0.default, fill_value=0.0, underlying_model=FittableImageModel):

and then we replace

        psfmodel = FittableImageModel(self._psf_interp,
                                      oversampling=self.oversampling)

        return psfmodel.evaluate(x, y, flux, x_0, y_0)

with

        psfmodel = self.underlying_model(self._psf_interp,
                                         oversampling=self.oversampling)

        return psfmodel.evaluate(x, y, flux, x_0, y_0)

or something.

I don't know how this would be handled re: EPSFModel requiring more inputs, like norm_radius (or subsequent other models with other inputs), but at a first glance if it were possible to pass all corresponding model parameters via data.meta then GriddablePSFModel could be a one-stop-shop for all two-dimensionally interpolated model instances, which would be neater than having them all be separate.

Onoddil avatar Nov 20 '19 19:11 Onoddil