Skip to content

Data resampling

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

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', 'pseudocolour_error', 'pmra_pseudocolour_corr', 'pmdec_pseudocolour_corr', 'parallax_pseudocolour_corr'. If include_ra_dec=True, then it must also include the keys 'ra', 'dec', 'ra_error', 'dec_error', 'ra_dec_corr', 'ra_pmra_corr', 'ra_pmdec_corr', 'ra_parallax_corr', 'ra_pseudocolour_corr', 'dec_pmra_corr', 'dec_pmdec_corr', 'dec_parallax_corr', 'dec_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'

TODO: Only Cholesky is supported at this time. 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'
include_ra_dec bool

When True, also include ra and dec uncertainties. Requires even more columns! Will be more accurate. Default: False

False
seed optional

Seed for the random number generator. Default: None

None

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, include_ra_dec=True) ¤

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, 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
include_ra_dec bool

When True, also include ra and dec uncertainties, generating an (n_samples, 5, 5) or (n_samples, 6, 6) (six_parameter_sources=True) shape-output instead. Default: True

True

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. include_ra_dec being True adds 2 to this.