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:
-
contaminante.contaminante.
calculate_contamination
(tpfs, period, t0, duration, sigma=5, plot=True, cbvs=True, sff=False, windows=20, bins=5, spline_period=1, **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 sigma: The significance level at which to create an aperture for the contaminanting source.
If the apertures are large, try increasing sigma. If the apertures are small, or contaminante fails, you could try (slightly) lowering sigma.Parameters: - plot (bool) -- If True, will generate a figure
- cbvs (bool) -- If True, will use Kepler/TESS CBVs to detrend. Default is True
- sff (bool) -- If True, will use the SFF method to correct variability. Default is False.
- spline_period (float) -- 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
-
contaminante.contaminante.
create_threshold_mask
(thumb, threshold=3, reference_pixel='max')¶ Lifted from lightkurve.
- thumb : np.ndarray
- 2D image, in this case the transit depth in every pixel divided by the error.
- threshold : float
- A value for the number of sigma by which a pixel needs to be brighter than the median flux to be included in the aperture mask.
- reference_pixel: (int, int) tuple, 'center', 'max', or None
- (col, row) pixel coordinate closest to the desired region. In this case we use the maximum of the thumbnail.
Returns: aperture_mask -- 2D boolean numpy array containing True for pixels above the threshold. Return type: ndarray