Localize¶
Bases: object
load_tpf_info()
¶
Load mission-specific metadata from a target pixel file. The returned values are added directly to the object's attributes.
Raises:
| Type | Description |
|---|---|
ValueError
|
If the mission is not supported. |
get_prf_model()
¶
Initialize and return the mission-specific PRF model.
Returns:
| Type | Description |
|---|---|
object or None
|
PRF model instance if supported, otherwise None. |
build_design_matrix(method='spline', order=3)
¶
Construct the full design matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
method
|
str
|
Method used for the systematics component. Currently only 'spline' is supported. |
'spline'
|
order
|
int
|
Order of the spline used when |
3
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If an unsupported method is provided. |
Attributes:
| Name | Type | Description |
|---|---|---|
self.design_matrix |
ndarray
|
Final design matrix combining transit, polynomial, and systematics components. |
solve_transit_weights()
¶
Solve for the spatial transit depth maps for all TCEs.
Attributes:
| Name | Type | Description |
|---|---|---|
self.transit_weights |
list of numpy.ndarray
|
List of 2D transit depth maps, one per TCE. |
self.transit_weights_err |
list of numpy.ndarray
|
List of 2D 1-sigma uncertainty maps corresponding to each transit depth map. |
fit_to_heatmap(model_func=None, which_tce=None, method=None, **fit_kw)
¶
Fit a model to the per-pixel transit depth heatmap.
The spatial transit depth map(s) are fit using one of the following: - 'prf' : Fit a mission PRF model (single TCE or joint fit). - '2dgaussian' : Fit an unconstrained 2D Gaussian model. - 'custom' : Fit a user-supplied residual function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_func
|
callable
|
Custom residual function (used only if |
None
|
which_tce
|
int
|
Index of the TCE to fit. If None and |
None
|
method
|
str
|
Fitting method: 'prf', '2dgaussian', or 'custom'. |
None
|
**fit_kw
|
Additional keyword arguments passed to the custom model. |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
result |
ModelResult or MinimizerResult
|
Full fit result object. |
fit_metrics |
dict
|
Dictionary containing key localization metrics: - 'centerx', 'centery' : best-fit centroid position - 'sigmax', 'sigmay' : 1-sigma uncertainties on centroid |
Raises:
| Type | Description |
|---|---|
ValueError
|
If an unsupported fitting method is provided. |
get_offset(fit_metrics, pix_col, pix_row)
¶
Compute the centroid offset in units of sigma.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit_metrics
|
dict
|
Dictionary containing fitted centroid values and uncertainties ('centerx', 'centery', 'sigmax', 'sigmay'). |
required |
pix_col
|
float
|
Reference pixel column position. |
required |
pix_row
|
float
|
Reference pixel row position. |
required |
Attributes:
| Name | Type | Description |
|---|---|---|
self.offset |
float
|
Radial offset significance in units of sigma. |
plot_heatmap(metrics, which_tce, savefig=False, save_directory='.')
¶
Generate a localization report plot for a given TCE.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metrics
|
dict
|
Dictionary containing fitted centroid values and uncertainties ('centerx', 'centery', 'sigmax', 'sigmay'). |
required |
which_tce
|
int
|
Index of the TCE to visualize. |
required |
savefig
|
bool
|
If True, save the figure to disk (default False). |
False
|
save_directory
|
str
|
Directory where the figure will be saved. |
'.'
|