Data Preparation (photometry.prepare)

photometry.prepare.create_hdf5(input_folder=None, sectors=None, cameras=None, ccds=None, calc_movement_kernel=False, backgrounds_pixels_threshold=0.5)[source]

Restructure individual FFI images (in FITS format) into a combined HDF5 file which is used in the photometry pipeline.

In this process the background flux in each FFI is estimated using the backgrounds.fit_background function.

Parameters:
  • input_folder (string) – Input folder to create TODO list for. If None, the input directory in the environment variable TESSPHOT_INPUT is used.
  • cameras (iterable of integers, optional) – TESS camera number (1-4). If None, all cameras will be processed.
  • ccds (iterable of integers, optional) – TESS CCD number (1-4). If None, all cameras will be processed.
  • calc_movement_kernel (boolean, optional) – Should Image Movement Kernels be calculated for each image? If it is not calculated, only the default WCS movement kernel will be available when doing the folllowing photometry. Default=False.
  • backgrounds_pixels_threshold (float) – Percentage of times a pixel has to use used in background calculation in order to be included in the final list of contributing pixels. Default=0.5.
Raises:

NotADirectoryError – If the specified input_folder is not an existing directory or if settings table could not be loaded from the catalog SQLite file.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

photometry.prepare.quality_from_tpf(tpffile, time_start, time_end)[source]

Background estimation (photometry.backgrounds)

Estimation of sky background in TESS Full Frame Images.

Code author: Rasmus Handberg <rasmush@phys.au.dk>

class photometry.backgrounds.ModeBackground(sigma_clip=SigmaClip(sigma=3.0, sigma_lower=3.0, sigma_upper=3.0, maxiters=10, cenfunc=<function _nanmedian>, stdfunc=<function _nanstd>))[source]

Bases: photutils.background.core.BackgroundBase

calc_background(data, axis=None)[source]

Calculate the background value.

Parameters:
  • data (array_like or ~numpy.ma.MaskedArray) – The array for which to calculate the background value.
  • axis (int or None, optional) – The array axis along which the background is calculated. If None, then the entire array is used.
Returns:

result – The calculated background value. If axis is None then a scalar will be returned, otherwise a ~numpy.ma.MaskedArray will be returned.

Return type:

float or ~numpy.ma.MaskedArray

photometry.backgrounds.fit_background(image, catalog=None, flux_cutoff=80000.0, bkgiters=3, radial_cutoff=2400, radial_pixel_step=15, radial_smooth=3)[source]

Estimate background in Full Frame Image.

The background is estimated using a combination of a 2D estimate of the mode of the images (using background estimator from SExtractor), and a radial component to account for the corner-glow that is present in TESS FFIs.

Parameters:
  • image (ndarray or string) – Either the image as 2D ndarray or a path to FITS or NPY file where to load image from.
  • catalog (astropy.table.Table object) – Catalog of stars in the image. Is not yet being used for anything.
  • flux_cutoff (float) – Flux value at which any pixel above will be masked out of the background estimation.
  • bkgiters (integer) – Number of times to iterate the background components. Default=3.
  • radial_cutoff (float) – Radial distance in pixels from camera centre to start using radial component. Default=2400.
  • radial_pixel_step (integer) – Step sizes to use in radial component. Default=15.
  • radial_smooth (integer) – Width of median smoothing on radial profile. Default=3.
Returns:

Estimated background with the same size as the input image. ndarray: Boolean array specifying which pixels was used to estimate the background (True if pixel was used).

Return type:

ndarray

Code author: Rasmus Handberg <rasmush@phys.au.dk>