calc_rad

tessilator.aperture.calc_rad(flux_vals, positions, f_lim=0.1, max_rad=4, default_rad=1, frame_num=0)[source]

Calculate the appropriate pixel radius for the aperture

This function uses a basic algorithm to calculate the most appropriate radius size to use for the circular aperture photometry of the TESS image frames. If the ratio of the median value of neighbouring (8, in a square surrounding the central pixel) pixels compared to the central pixel is greater than ‘f_lim’, then expand the radius by one pixel, and test the next set of surrounding pixels. The pixel radius is linearly interpolated either side of the f_lim boundary. If, after ‘n_pix’ pixels the condition is still satisfied, set the pixel radius equal to 1. The latter constraint is intended to avoid contamination from neighbouring sources.

Parameters:
flux_valsnp.array

The raw flux values from each pixel in the image.

positionstuple

The X,Y position of the central pixel.

f_limfloat, optional, default=0.1

The limiting threshold flux for the criterion.

max_radint, optional, default=4

The maximum number of pixels for the aperture radius.

default_radint, optional, default=1

The default aperture radius to be used in case of an error.

frame_numint

The running number of the image frame of the input fits file. This is only used for logging purposes.

Returns:
aper_radfloat

The pixel radius.