Utils¶
get_p_tdur_t0(tce)
¶
Extract the orbital period, transit duration, and transit epoch (t0) from a TCE NumPy array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tce
|
ndarray
|
One-dimensional array containing TCE parameters in a fixed order. This function assumes: tce[1] = orbital period tce[4] = transit duration tce[3] = transit epoch (t0) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
|
A tuple (period, tdur, t0). |
create_spline_design_matrix(time, tdur, order=3)
¶
Construct a spline design matrix for a normalized time series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
ndarray
|
One-dimensional array of time values. |
required |
tdur
|
float
|
Transit duration in the same units as |
required |
order
|
int
|
Order of the spline (default is 3 for cubic splines). |
3
|
Returns:
| Type | Description |
|---|---|
numpy.ndarray :
|
The spline design matrix evaluated at the normalized time values. |
create_polynomial_design_matrix(time)
¶
Construct a piecewise quadratic polynomial design matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time
|
ndarray
|
One-dimensional array of time values. |
required |
Returns:
| Type | Description |
|---|---|
numpy.ndarray :
|
Piecewise polynomial design matrix with separate quadratic trends for each continuous time segment. |
coords_to_pixels(wcs, ra, dec)
¶
Convert sky coordinates (RA, Dec) to detector pixel coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wcs
|
WCS
|
World Coordinate System transformation object. |
required |
ra
|
float
|
Right ascension in degrees. |
required |
dec
|
float
|
Declination in degrees. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
|
(pix_col, pix_row) pixel coordinates corresponding to the input sky coordinates. |
query_vizier_background(wcs, ra_targ, dec_targ, tpf_shape)
¶
Query background sources from Vizier and convert them to pixel coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wcs
|
WCS
|
World Coordinate System transformation object. |
required |
ra_targ
|
float
|
Target right ascension in degrees. |
required |
dec_targ
|
float
|
Target declination in degrees. |
required |
tpf_shape
|
tuple
|
Shape of the target pixel file (e.g., (n_rows, n_cols)), used to estimate the search radius. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
coord_bkgd |
SkyCoord or None
|
Sky coordinates of catalog sources within the search region, or None if no sources are found. |
pix_bkgd |
tuple
|
Pixel coordinates of the sources as returned by WCS (arrays of x and y positions). |
prf_residual(params, prf, data, data_err, origin, shape)
¶
Compute the flattened, uncertainty-weighted residual for PRF fitting.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Parameters
|
Fit parameters containing 'amplitude', 'centerx', and 'centery'. |
required |
prf
|
object
|
PRF model object with an |
required |
data
|
ndarray
|
2D array of observed pixel values. |
required |
data_err
|
ndarray
|
2D array of per-pixel uncertainties. |
required |
origin
|
tuple
|
(row_origin, col_origin) CCD reference position. |
required |
shape
|
tuple
|
Shape of the image stamp used for PRF evaluation. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Flattened array of finite, uncertainty-weighted residuals. |
all_prf_residual(params, prf, data, data_err, origin, shape, tces)
¶
Compute concatenated, uncertainty-weighted residuals for multiple TCEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
Parameters
|
Fit parameters containing 'centerx', 'centery', and 'amplitude_i' for each TCE index i. |
required |
prf
|
object
|
PRF model object with an |
required |
data
|
ndarray
|
Array of 2D pixel data for each TCE (shape: n_tces × rows × cols). |
required |
data_err
|
ndarray
|
Array of per-pixel uncertainties for each TCE. |
required |
origin
|
tuple
|
(row_origin, col_origin) CCD reference position. |
required |
shape
|
tuple
|
Shape of the image stamp used for PRF evaluation. |
required |
tces
|
sequence
|
Collection of TCEs used to determine the number of amplitudes. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Flattened array of finite, concatenated residuals across all TCEs. |