flystar.fit_velocity

Attributes

x

Functions

linear(x, k, b)

linear_fit(x, y[, sigma, absolute_sigma])

Weighted linear regression (See https://en.wikipedia.org/wiki/Weighted_least_squares#Solution). Recommended for low-dimension, non-degenerate data. Otherwise, please use scipy.curve_fit.

calc_chi2(x, y, sigma, slope, intercept)

fit_velocity(startable[, weighting, use_scipy, ...])

Fit proper motion with weighted linear regression equations (see https://en.wikipedia.org/wiki/Weighted_least_squares#Solution).

Module Contents

flystar.fit_velocity.linear(x, k, b)
flystar.fit_velocity.linear_fit(x, y, sigma=None, absolute_sigma=True)

Weighted linear regression (See https://en.wikipedia.org/wiki/Weighted_least_squares#Solution). Recommended for low-dimension, non-degenerate data. Otherwise, please use scipy.curve_fit.

Parameters

xarray-like

x data

yarray-like

y data

sigmaarray-like, optional

Weighted by 1/sigma**2. If not provided, weight = 1, by default None

absolute_sigmabool, optional

If True (default), sigma is used in an absolute sense and the estimated parameter uncertainty reflects these absolute values. If False, only the relative magnitudes of the sigma values matter, by default True

Returns

resultdictionary

Dictionary with keys ‘slope’, ‘e_slope’, ‘intercept’, ‘e_intercept’, and ‘chi2’ if return_chi2=True.

flystar.fit_velocity.calc_chi2(x, y, sigma, slope, intercept)
flystar.fit_velocity.fit_velocity(startable, weighting='var', use_scipy=False, absolute_sigma=True, epoch_cols='all', art_star=False)

Fit proper motion with weighted linear regression equations (see https://en.wikipedia.org/wiki/Weighted_least_squares#Solution). Assumes that all data are valid.

Parameters

startableStarTable

StarTable object

weightingstr, optional

Weighting by variance (1/ye**2) or standard deviation (1/ye), by default ‘var’

use_scipybool, optional

Use scipy.curve_fit or flystar.fit_velocity.linear_fit, by default False

absolute_sigmabool, optional

If True (default), sigma is used in an absolute sense and the estimated parameter uncertainty reflects these absolute values. If False, only the relative magnitudes of the sigma values matter, by default True

epoch_colsstr or list of intergers, optional

List of indicies of columns to use. If ‘all’, use all columns, by default ‘all’

art_starbool, optional

Artificial star catalog or not. If True, use startable[‘x’][:, epoch_ols, 1] as the location, by default False.

Returns

resultpd.DataFrame

Proper motion dataframe with keys vx, vxe, vy, vye, x0, x0e, y0, y0e

Raises

ValueError

If weighting is neither ‘std’ nor ‘var’

flystar.fit_velocity.x