Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D PSF models? #198

Open
entaylor opened this issue May 16, 2024 · 2 comments
Open

2D PSF models? #198

entaylor opened this issue May 16, 2024 · 2 comments

Comments

@entaylor
Copy link

entaylor commented May 16, 2024

I'm not sure if this is more a request for guidance or a real feature request.

I'm interested in trialing a 2D PSF model, but not (yet) brave enough to try coding my own class.

I think my biggest question is, before i dive into this, whether/how feasible it is? Is there anything in the code to prefer/require 1D (parametric) PSF models?

Alternatively, this might be a good candidate for a new set of PSF models; i.e. Gaussian2d, Moffat2d.

@ConnorStoneAstro
Copy link
Member

You can certainly create 2D PSF models. I have wanted to make something like a diffraction spike model for a long time now, but I just don't really know what the correct mathematical representation would be.

It is also possible to make composite models where instead of a group model you make a psf group model. There are some extra considerations for a composite model. In regular PSF models, the "center" is fixed to (0,0) in an arbitrary coordinate system (which aligns with the image coordinate system), and any flux parameters are fixed to some constant value. When a PSF model is generated it evaluates the model then just normalizes the total flux to 1. If you are making a composite PSF model, then you will want to relax some of these constraints. Certainly the flux parameters would no longer be locked, they should be unlocked so they can encode the relative flux in different components. You can also allow some of the models to have a variable center, although that would be a very odd PSF.

Would it be helpful if I made a custom psf tutorial like how I have the custom model tutorial?

For something like a gaussian2d or moffat2d, that would be relatively easy to put together if you're thinking of just making them into ellipses. I could add that at any time, I just never did because I didn't think anyone would need it.

If you're thinking of more creative 2D models and want to experiment on your own, then I suggest for now you trace through what happens in a PSF model that already exists and then adapt from there. Here is the Gaussian PSF model, which is actually pretty short because it leans on other code that's already out there:

class Gaussian_PSF(PSF_Model):

To see the full detail of what's going on when you call something like psf_model().data to see an image of the PSF, you can look at the sample function in the PSF model base class:
https://github.com/Autostronomy/AstroPhot/blob/main/astrophot/models/psf_model_object.py

but that is really getting in the weeds :)

@entaylor
Copy link
Author

All good. After today i am pretty sure that i will go ahead with trying to do this, and will come back to you with my best attempt! Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants