Different results in source detection with DAOStarFinder versus DAOPhotPSFPhotometry
See original GitHub issueAs far as I understand, the DAOPhotPSFPhotometry
class uses the DAOStarFinder
class to search for sources.
I’m seeing rather different results using both classes on the same image:
Shouldn’t both return the same results if I use the same parameters?
The code is here, if needed I can upload the original .fits file.
import matplotlib.pyplot as plt
import numpy as np
from astropy.io import fits
from astropy.stats import gaussian_sigma_to_fwhm
from photutils.utils import cutout_footprint
from photutils.background import MADStdBackgroundRMS
from photutils.psf import IntegratedGaussianPRF
from photutils.psf import DAOPhotPSFPhotometry
from photutils import DAOStarFinder
from photutils import CircularAperture
# Load data.
image_file = 'test.fits'
# Image data.
hdulist = fits.open(image_file)
hdu_data = hdulist[0].data
hdulist.close()
# Crop image
crop = cutout_footprint(hdu_data, (2100, 1800), (500, 1100))
hdu_crop = crop[0]
bkgrms = MADStdBackgroundRMS()
std = bkgrms(hdu_crop)
thresh = 50. * std
sigma_psf = 5.
fwhm_sigma = sigma_psf * gaussian_sigma_to_fwhm
fitshape = int(3 * np.ceil(fwhm_sigma) // 2 * 2 + 1)
# DAOStarFinder
stfind = DAOStarFinder(threshold=thresh, fwhm=fwhm_sigma)
sources = stfind(hdu_crop)
print(sources)
# DAOPhotPSFPhotometry
psf_model = IntegratedGaussianPRF(sigma=sigma_psf)
photometry = DAOPhotPSFPhotometry(
crit_separation=3. * fwhm_sigma, threshold=thresh, fwhm=fwhm_sigma,
psf_model=psf_model, fitshape=fitshape)
result_tab = photometry(image=hdu_crop)
print(result_tab)
median, std = np.median(hdu_crop), np.std(hdu_crop)
plt.subplot(1, 2, 1)
plt.title('DAOStarFinder')
plt.imshow(hdu_crop, cmap='viridis', aspect=1, interpolation='nearest',
origin='lower', vmin=0., vmax=median + std)
positions = (sources['xcentroid'], sources['ycentroid'])
apertures = CircularAperture(positions, r=4.)
apertures.plot(color='red', lw=1.5)
plt.colorbar(orientation='horizontal', fraction=0.046, pad=0.04)
plt.subplot(1, 2, 2)
plt.title('DAOPhotPSFPhotometry')
plt.imshow(hdu_crop, cmap='viridis', aspect=1, interpolation='nearest',
origin='lower', vmin=0., vmax=median + std)
positions = (result_tab['x_fit'], result_tab['y_fit'])
apertures = CircularAperture(positions, r=4.)
apertures.plot(color='red', lw=1.5)
plt.colorbar(orientation='horizontal', fraction=0.046, pad=0.04)
plt.show()
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Source Detection (photutils.detection) - Read the Docs
Photutils includes two widely-used tools that are used to detect stars in an image, DAOFIND and IRAF's starfind. DAOStarFinder is a class that...
Read more >photutils Documentation - Read the Docs
(mad_std) of the image. The parameters of the detected sources are returned as an Astropy Table: >>> from photutils import DAOStarFinder.
Read more >commit python-photutils for openSUSE:Factory
[#1227] + photutils.detection + * Fixed the DAOStarFinder import ... IterativelySubtractedPSFPhotometry, and + DAOPhotPSFPhotometry now ...
Read more >Photometry with Photutils - Jupyter Notebooks Gallery
Background Estimation (photutils.background); Source Detection ... to a very large extended source (or when the backrgound is not flat for any other reason)....
Read more >Annual sale champion lululemon athletica | Pants & Jumpsuits ...
I'm ordering another color today and another soon enough . ... astropy Tables which are passed along to the source detection and photometry...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m sure @eteq will comment on changing the default, but I would leave it on 3. Checking the images above, it seems that with more iteration more faint sources are found, which is expected, and in a the case of a crowded field, I expect it to lead to a much better result. (Finding the artefacts around the bright star is an unfortunate, but is also somewhat expected side effect.)
The default is
niters=3
, but I guess we may change that? @eteq