WqedLSF

class exovetter.utils.WqedLSF(x, y, s=None, order=2, func=<function sine>, **kwargs)[source]

Bases: object

Least squares fit to an analytic function based on lsf.c in Wqed, which in turn was based on Bevington and Robinson.

Parameters:
xarray_like

1D numpy array containing ordinate (e.g., time).

yarray_like

1D numpy array containing coordinate (e.g., flux).

sarray_like or float

A scalar or 1D numpy array containing 1-sigma uncertainties. If not given, it is set to unity (default).

orderint

How many terms of function to fit. Default is 2.

funcobj

The analytic function to fit. Default is sine().

kwargsdict

Additional keywords to pass to func.

Raises:
ValueError

Invalid input.

Attributes Summary

covariance

Covariance matrix for the best fit.

params

Best fit parameters.

residuals

Residuals, defined as y - best_fit.

variance

Sum of the squares of the residuals.

Methods Summary

compute_amplitude()

Amplitude from best fit.

compute_phase()

Phase from best fit.

get_best_fit_model([x])

Get best fit model to data.

Attributes Documentation

covariance

Covariance matrix for the best fit.

params

Best fit parameters.

residuals

Residuals, defined as y - best_fit.

variance

Sum of the squares of the residuals.

Methods Documentation

compute_amplitude()[source]

Amplitude from best fit.

Note

Taken from Appendix 1 of Breger (1999, A&A 349, 225), which was written by M Montgomery.

Returns:
amp, amp_uncfloat

Amplitude and its uncertainty.

Raises:
ValueError

Fitted function is not sine with order 2.

compute_phase()[source]

Phase from best fit.

Note

Taken from Appendix 1 of Breger (1999, A&A 349, 225), which was written by M Montgomery.

Returns:
phase, phase_uncfloat

Phase and its uncertainty.

Raises:
ValueError

Fitted function is not sine with order 2.

get_best_fit_model(x=None)[source]

Get best fit model to data.

Parameters:
xarray_like

1D numpy array containing ordinates on which to compute the best fit model. If not given, use ordinates used in fit.

Returns:
yarray_like

Best fit model.