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
78 stars 9 forks source link

output best-fit model(s) in .fits format #195

Closed eiani closed 2 months ago

eiani commented 2 months ago

Good morning, I was wondering if there is an easy way to have the best-fit models derived with astrophot in a .fits format (as with Galfit). It would be of great help to easily save the best-fit model(s) in a fits file with an extension for each fitted galaxy/component and a final one with the residuals. Would it be possible to add such a feature?

ConnorStoneAstro commented 2 months ago

Hi @eiani , good question! that is already an available feature. For any AstroPhot image object you can call image.save("name.fits") and the image will be saved in fits format. So to save the final model image you can call model().save("model.fits") to save the residual image you can call (target - model()).save("residual.fits") and you should get the images you're looking for. There are more details in the tutorial Jupyter notebooks here: https://astrophot.readthedocs.io/en/latest/tutorials/GettingStarted.html