Kalkayotl: A cluster distance inference code
  Context: Stellar clusters are benchmarks for theories of star formation and
evolution. The high precision parallax data of the Gaia mission allows
significant improvements in the distance determination to stellar clusters and
its stars. In order to have accurate and precise distance determinations,
systematics like the parallax spatial correlations need to be accounted for,
especially for stars in small sky regions. Aims: Provide the astrophysical
community with a free and open code designed to simultaneously infer cluster
parameters (i.e. distance and size) and the distances to its stars using Gaia
parallax measurements. It includes cluster oriented prior families and is
specifically designed to deal with the Gaia parallax spatial correlations.
Methods: A Bayesian hierarchical model is created to allow the inference of
both the cluster parameters and distances to its stars. Results: Using
synthetic data that mimics Gaia parallax uncertainties and spatial
correlations, we observe that our cluster oriented prior families result in
distance estimates with smaller errors than those obtained with an
exponentially decreasing space density prior. In addition, the treatment of the
parallax spatial correlations minimizes errors in the estimated cluster size
and stellar distances and avoids the underestimation of uncertainties. Although
neglecting the parallax spatial correlations has no impact on the accuracy of
cluster distance determinations, it underestimates the uncertainties and may
result in measurements that are incompatible with the true value. Conclusions:
The combination of prior knowledge with the treatment of Gaia parallax spatial
correlations produces accurate (error <10%) and trustworthy estimates (i.e.
true values contained within the 2$\sigma$ uncertainties) of clusters distances
for clusters up to ~5 kpc, and cluster sizes for clusters up to ~1 kpc.
