Aperture Photometry (photometry.AperturePhotometry)

Simple Aperture Photometry using K2P2 to define masks.

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

class photometry.AperturePhotometry(*args, **kwargs)[source]

Bases: photometry.BasePhotometry.BasePhotometry

Simple Aperture Photometry using K2P2 to define masks.

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

__init__(*args, **kwargs)[source]

Initialize the photometry object.

Parameters:
  • starid (int) – TIC number of star to be processed.
  • input_folder (string) – Root directory where files are loaded from.
  • output_folder (string) – Root directory where output files are saved.
  • datasource (string, optional) – Source of the data. Options are 'ffi' or 'tpf'. Default is 'ffi'.
  • plot (boolean, optional) – Create plots as part of the output. Default is False.
  • camera (integer, optional) – TESS camera (1-4) to load target from (Only used for FFIs).
  • ccd (integer, optional) – TESS CCD (1-4) to load target from (Only used for FFIs).
  • cache (string, optional) – Optional values are 'none', 'full' or 'basic' (Default).
Raises:
  • IOError – If starid could not be found in catalog.
  • ValueError – On invalid datasource.
  • ValueError – If camera and ccd is not provided together with datasource='ffi'.
do_photometry()[source]

Perform photometry on the given target.

This function needs to set
  • self.lightcurve

K2P2 (photometry.AperturePhotometry.k2p2v2)

K2 Pixel Photometry (K2P2)

Create pixel masks and extract light curves from Kepler and K2 pixel data using clustering algorithms.

To read more about the methods used, please see the following papers:

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

Code author: Mikkel Lund <mnl@phys.au.dk>

exception photometry.AperturePhotometry.k2p2v2.K2P2NoFlux[source]

Bases: Exception

exception photometry.AperturePhotometry.k2p2v2.K2P2NoStars[source]

Bases: Exception

photometry.AperturePhotometry.k2p2v2.k2p2FixFromSum(SumImage, thresh=1, output_folder=None, plot_folder=None, show_plot=True, min_no_pixels_in_mask=8, min_for_cluster=4, cluster_radius=1.4142135623730951, segmentation=True, ws_alg='flux', ws_blur=0.5, ws_thres=0.05, ws_footprint=3, extend_overflow=True, catalog=None)[source]

Create pixel masks from Sum-image.

Parameters:
  • SumImage (ndarray) – Sum-image.
  • thres (float, optional) – Threshold for significant flux. The threshold is calculated as MODE+thres*MAD. Default=1.
  • output_folder (string, optional) – Path to directory where output should be saved. Default=None.
  • plot_folder (string, optional) – Path to directory where plots should be saved. Default=None.
  • show_plot (boolean, optional) – Should plots be shown to the user? Default=True.
  • min_no_pixels_in_mask (integer, optional) – Minimim number of pixels to constitute a mask.
  • min_for_cluster (integer, optional) – Minimum number of pixels to be considered a cluster in DBSCAN clustering.
  • cluster_radius (float, optional) – Radius around points to consider cluster in DBSCAN clustering.
  • segmentation (boolean, optional) – Perform segmentation of clusters using Watershed segmentation.
  • ws_alg (string, optional) – Watershed method to use. Default=’flux’.
  • ws_thres (float, optional) – Threshold for watershed segmentation.
  • ws_footprint (integer, optional) – Footprint to use in watershed segmentation.
  • extend_overflow (boolean, optional) – Enable extension of overflow columns for bright stars.
  • catalog (ndarray, optional) – Catalog of stars as an array with three columns (column, row and magnitude). If this is provided the results will only allow masks to be returned for stars in the catalog and the information is also used in the extension of overflow columns.
Returns:

Tuple with two elements: A 3D boolean ndarray of masks and a float indicating the bandwidth used for the estimation background-levels.

Return type:

tuple

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

Code author: Mikkel Lund <mnl@phys.au.dk>

photometry.AperturePhotometry.k2p2v2.k2p2WS(X, Y, X2, Y2, flux0, XX, labels, core_samples_mask, saturated_masks=None, ws_thres=0.1, ws_footprint=3, ws_blur=0.5, ws_alg='flux', output_folder=None, catalog=None)[source]

Segment clusters using Watershed.

photometry.AperturePhotometry.k2p2v2.k2p2_saturated(SumImage, MASKS, idx)[source]
photometry.AperturePhotometry.k2p2v2.k2p2maks(frame, no_combined_images, threshold=0.5)[source]
photometry.AperturePhotometry.k2p2v2.run_DBSCAN(X2, Y2, cluster_radius, min_for_cluster)[source]

Run the DBSCAN clustering algorithm.

Parameters:
  • cluster_radius (float) – Radius from each point to consider inside cluster.
  • min_for_cluster (integer) – Minimum number of points to consider a cluster.
Returns:

Coordinates of points. ndarray: Labels of each point. ndarray: Boolean array which is True if the correspondig point is considered a core point.

Return type:

ndarray