banzai icon indicating copy to clipboard operation
banzai copied to clipboard

flux computed in ellipses rotated by pi/2 instead of theta

Open richellevc opened this issue 2 years ago • 0 comments

In photometry.py, line 90 to 94, the fluxes of the sources are computed in ellipses that are all rotated by pi/2. See code snippet below:

# Calcuate the equivilent of flux_auto
flux, fluxerr, flag = sep.sum_ellipse(data, sources['x'], sources['y'],
                                      sources['a'], sources['b'],
                                      np.pi / 2.0, 2.5 * kronrad,
                                      subpix=1, err=error)

The same is passed to sep.sum_ellipse when computing background fluxes in the ellipses (line 141 to 144):

# Calculate the average background at each source
bkgflux, fluxerr, flag = sep.sum_ellipse(bkg.back(), sources['x'], sources['y'],
                                         sources['a'], sources['b'], np.pi / 2.0,
                                         2.5 * sources['kronrad'], subpix=1)

This might be a bug, as the ellipse parameters of the extracted sources are (a,b,theta), so each aperture is rotated by a different angle theta. If this is indeed a bug, suggested solutions would be:

# Calcuate the equivilent of flux_auto
flux, fluxerr, flag = sep.sum_ellipse(data, sources['x'], sources['y'],
                                      sources['a'], sources['b'],
                                      sources['theta'], 2.5 * kronrad,
                                      subpix=1, err=error)

# Calculate the average background at each source
bkgflux, fluxerr, flag = sep.sum_ellipse(bkg.back(), sources['x'], sources['y'],
                                         sources['a'], sources['b'], sources['theta'],
                                         2.5 * sources['kronrad'], subpix=1)

richellevc avatar Nov 14 '22 17:11 richellevc