Skip to content

Data resampling

ocelot.cluster.resample_gaia_astrometry(data_gaia, n_resamples=1, suffixes=None, method='svd') ¤

Resample Gaia astrometric parameters for pmra, pmdec and parallax, given input best estimate means and covariance matrices.

Parameters:

Name Type Description Default
data_gaia DataFrame

data for the field, including keys 'astrometric_params_solved', 'pmra', 'pmdec', 'parallax', 'pmra_error', 'pmdec_error', 'parallax_error', 'pmra_pmdec_corr', 'parallax_pmra_corr', 'parallax_pmdec_corr', 'pseudocolour_error', 'pmra_pseudocolour_corr', 'pmdec_pseudocolour_corr', 'parallax_pseudocolour_corr'

required
n_resamples int

Number of resamples to perform. Default: 1

1
suffixes Iterable[str] | None

Suffixes to apply in the output dataframe's pmra, pmdec, and parallax columns per-resample.

None
method 'svd', 'eigh', 'cholesky'

Method to use for matrix decompositions. From the numpy docs: "The cov input is used to compute a factor matrix A such that A @ A.T = cov. This argument is used to select the method used to compute the factor matrix A. The default method 'svd' is the slowest, while 'cholesky' is the fastest but less robust than the slowest method. The method eigh uses eigen decomposition to compute A and is faster than svd but slower than cholesky." Default: 'svd'

'svd'

Returns:

Type Description
DataFrame

Output dataframe with same length as input, including 3*n_resamples columns containing resampled astrometry.

Notes

When using cholesky decomposition to speed this up, all covariance matrices must be positive definite. Basically, this means they should be symmetric and have no negative numbers. This is not always the case for Gaia covariance matrices; hence, the default method is the slower (but more robust) svd.

ocelot.cluster.generate_gaia_covariance_matrix(data_gaia, six_parameter_sources=False) ¤

Generates a covariance matrix for Gaia data. Currently only has pmra/pmdec/parallax(/color) covariance matrix support, but could be easily extended in the future to also/or re-sample more things.

Parameters:

Name Type Description Default
data_gaia DataFrame

Gaia data to make a covariance matrix for. Must contain the following keys: pmra_error, pmdec_error, parallax_error, pmra_pmdec_corr, parallax_pmra_corr, parallax_pmdec_corr For resampling for six parameter sources (i.e. six_parameter_sources=True), it must also contain: pseudocolour_error, pmra_pseudocolour_corr, pmdec_pseudocolour_corr, parallax_pseudocolour_corr see Gaia release notes for help.

required
six_parameter_sources bool

whether or not ALL sources in data_gaia also depend on the estimated pseudocolour. If true, will return matrices of shape (n_samples, 4, 4) instead. Default: False

False

Returns:

Type Description
ndarray

Array of covariance matrices of shape (n_stars, n_params, n_params). n_params is 4 if six_parameter_sources is true, otherwise it is 3.