Skip to content

Commit

Permalink
Merge pull request #1597 from larrybradley/psf-docs
Browse files Browse the repository at this point in the history
Show data and model with residual image in PSF docs
  • Loading branch information
larrybradley committed Jul 31, 2023
2 parents bfd0a11 + 7b09ac3 commit 82fd241
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions docs/psf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ and plot it:

import matplotlib.pyplot as plt
import numpy as np
from astropy.visualization import simple_norm
from photutils.datasets import make_noise_image, make_test_psf_data
from photutils.detection import DAOStarFinder
from photutils.psf import IntegratedGaussianPRF, PSFPhotometry
Expand All @@ -291,9 +292,16 @@ and plot it:
phot = psfphot(data, error=error)

resid = psfphot.make_residual_image(data, (25, 25))
plt.imshow(resid, origin='lower')
plt.title('Residual Image')
plt.colorbar()

fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(15, 5))
norm = simple_norm(data, 'sqrt', percent=99)
ax[0].imshow(data, origin='lower', norm=norm)
ax[1].imshow(data - resid, origin='lower', norm=norm)
im = ax[2].imshow(resid, origin='lower')
ax[0].set_title('Data')
ax[1].set_title('Model')
ax[2].set_title('Residual Image')
plt.tight_layout()

The residual image looks like noise, indicating good fits to the
sources.
Expand Down

0 comments on commit 82fd241

Please sign in to comment.