Autostronomy / AstroPhot

A fast, flexible, automated, and differentiable astronomical image 2D forward modelling tool for precise parallel multi-wavelength photometry
https://astrophot.readthedocs.io
GNU General Public License v3.0
79 stars 9 forks source link

What's the "approved" way to specify a star (delta function) that should be convolved? #125

Closed wmwv closed 3 months ago

wmwv commented 9 months ago

What's the approved way to specify a star?

Currently, there are PSF and star models. These are meant to be used with PSF convolution turned off.

However, conceptually, a point source is a delta function that one then wants to convolve the same way as other sources in the image. Performance wise, the convolution and integration (modulo the normalization) may be faster to have already realized in the model; and if that's the answer then I understand. But it seems a bit prone to error to re-specify the PSF when defining the model. It seems more symmetric to define a galaxy model and a point source model to be fit together with a known target.PSF.

I'd like to fit a galaxy and a time-variable SN across a set of images. The SN is a point source; we will assume we have the PSF for the individual images already.

An example model, or an addition to the Model_Zoo tutorial explaining how to simulate a point source. Or explaining best performance practice is to realize the PSF for the model to fit faster (if that is true).

ConnorStoneAstro commented 9 months ago

Ah, this is a notation which I've been wondering about how clear it is. The psf star model object is what you want. You pass it a PSF_Image object and it uses that as the image to convolve with a delta function effectively, though it is optimized for that specifically. Convolution is turned off for star models since they represent delta functions, they have to handle the convolution internally for it to be done correctly, the standard extended source convolution wouldn't work as well. I hope that helps!

wmwv commented 9 months ago

Yes, I think the documentation is clear about how using a psf_star_model would allow you to pass a PSF and be used this way.

I think the documentation could benefit some more explicit statement that this was the recommended way to do it, and that there was a reason that this way was better or the only alternative. I think I can infer this.

I think two places would be in the documentation/docstrings within the models, and perhaps in addition a future blended PSF model tutorial, or the time-series tutorial I'm working on now would be good places.

ConnorStoneAstro commented 9 months ago

I've created a draft PR for a possible way to fix this. Check out #126 and let me know if you think this would have made it clearer from the outset, and where you think any extra documentation might have been helpful :)

ConnorStoneAstro commented 3 months ago

I think this was closed with #126