TransitModelFit#

class stellarphot.transit_fitting.TransitModelFit[source]#

Bases: object

Transit model fits to observed light curves.

Parameters:
batman_paramsbatman.TransitParams

Parameters for the batman transit model. If not provided, the default parameters will be used.

Attributes:
BICfloat

Bayesian Information Criterion for the fit. This is calculated after the fit is performed.

n_fit_parametersint

Number of parameters that were fit. This is calculated after the fit is performed.

widtharray-like

weights : array-like

Attributes Summary

BIC

airmass

airmass : array-like

data

data : array-like

model

model : astropy.modeling.Model

n_fit_parameters

spp

spp : array-like

times

times : array-like

width

weights : array-like

Methods Summary

data_light_curve([data, detrend_by])

Function to return data light curve, optionally detrended by one or more parameters.

fit()

Perform a fit and update the model with best-fit values.

model_light_curve([at_times, detrend_by])

Calculate the light curve corresponding to the model, optionally detrended by one or more parameters.

setup_model([binned_data, t0, depth, ...])

Configure a transit model for fitting.

Attributes Documentation

BIC#
airmass#
airmassarray-like

Airmass at each time. Must be set before fitting.

data#
dataarray-like

Observed fluxes. Must be set before fitting.

model#
modelastropy.modeling.Model

The model used for fitting. This is a combination of the batman transit model and any other trends that are included in the fit. This is set up when the setup_model method is called.

n_fit_parameters#
spp#
spparray-like

Sky per pixel at each time. Must be set before fitting.

times#
timesarray-like

Times at which the light curve is observed. Must be set before fitting.

width#
weightsarray-like

Weights to use for fitting. If not provided, all weights are set to 1.

Methods Documentation

data_light_curve(data=None, detrend_by=None)[source]#

Function to return data light curve, optionally detrended by one or more parameters.

Parameters:
dataarray-like, optional

Data to use for calculating the light curve. If not provided, the data used for fitting will be used.

detrend_bystr or list of str

Parameter(s) to detrend by. If None, no detrending is done. If 'all', all parameters that are set will be used for detrending.

Returns:
dataarray-like

Data light curve, detrended if requested.

fit()[source]#

Perform a fit and update the model with best-fit values.

model_light_curve(at_times=None, detrend_by=None)[source]#

Calculate the light curve corresponding to the model, optionally detrended by one or more parameters.

Parameters:
at_timesarray-like

Times at which to calculate the model. If not provided, the times used for fitting will be used.

detrend_bystr or list of str

Parameter(s) to detrend by. If None, no detrending is done. If 'all', all parameters that are set will be used for detrending.

Returns:
modelarray-like

Model light curve.

setup_model(binned_data=None, t0=0, depth=0, duration=0, period=1, inclination=90, airmass_trend=0.0, width_trend=0.0, spp_trend=0.0, model_options=None)[source]#

Configure a transit model for fitting. The duration and depth are used to estimate underlying fit parameters; they are not themselves fit parameters.

Parameters:
t0float

Time of the center of the transit. Can be in any units but should be consistent with the units for the period and for the times used for fitting.

depthfloat

Depth of the transit in parts per thousand.

durationfloat

Duration of the transit,in the same units as t0 and period.

periodfloat

Period of the planet. Should be in the same units as t0 and times used for fitting.

inclinationfloat

Inclination of the orbit, in degrees.

airmass_trendfloat, optional

Coefficient for a linear trend in airmass.

width_trendfloat

Coefficient for a linear trend in stellar width.

spp_trendfloat

Coefficient for a linear trend in sky per pixel.

optionsTransitModelOptions, optional

Options for the transit model fit.

Returns:
None

Sets values for the model parameters.