contaminante API

contaminante Core Functions

Basic contaminante functionality

contaminante.contaminante.build_X(time, pos_corr1, pos_corr2, flux=None, t_model=None, background=False, cbvs=None, spline=True, spline_period=0.75, sff=False, windows=20, bins=15)

Build a design matrix to model pixel in target pixel files

Parameters:
  • tpf (lightkurve.TargetPixelFile) -- Input target pixel file to make the design matrix for
  • flux (np.ndarray) -- The SAP flux to use for creating the design matrix
  • t_model (None or np.ndarray) -- The transit model, if None no transit model will be used in the design matrix
  • cbvs (None or np.ndarray) -- Cotrending Basis vectors. If None will not be used in design matrix
  • spline (bool) -- Whether to use a B-Spline in time
  • spline_period (float) -- If using a spline, what time period the knots should be spaced at
Returns:

SA -- The design matrix to use to detrend the input TPF

Return type:

scipy.sparse.csr_matrix

contaminante.contaminante.calculate_contamination(tpfs, period, t0, duration, sigma=5, plot=True, cbvs=True, **kwargs)

Calculate the contamination for a target :param period: Period of transiting object in days :type period: float :param t0: Transit midpoint of transiting object in days :type t0: float :param duration: Duration of transit in days :type duration: float :param plot: If True, will generate a figure :type plot: bool :param cbvs: If True, will use Kepler/TESS CBVs to detrend. Default is True :type cbvs: bool :param sff: If True, will use the SFF method to correct variability. Default is False. :type sff: bool :param spline_period: The period of a spline to fit. For short period variability,

set this value to a smaller number. Default is 0.75 days.
Returns:result -- List of dictionaries containing the contamination properties If plot is True, will show a figure, and will put the matplotlib.pyplot.figure object into the result dictionary.
Return type:list of dict