  Radio interferometers designed to probe the 21cm signal from Cosmic Dawn and
the Epoch of Reionisation must contend with systematic effects that make it
difficult to achieve sufficient dynamic range to separate the 21cm signal from
foreground emission and other effects. For instance, the instrument's chromatic
response modulates the otherwise spectrally smooth foregrounds, making them
difficult to model, while a significant fraction of the data must be excised
due to the presence of radio frequency interference (RFI), leaving gaps in the
data. Errors in modelling the (modulated and gappy) foregrounds can easily
generate spurious contamination of what should otherwise be 21cm
signal-dominated modes. Various approaches have been developed to mitigate
these issues by (e.g.) using non-parametric reconstruction of the foregrounds,
in-painting the gaps, and weighting the data to reduce the level of
contamination. We present a Bayesian statistical method that combines these
approaches, using the coupled techniques of Gaussian constrained realisations
(GCR) and Gibbs sampling. This provides a way of drawing samples from the joint
posterior distribution of the 21cm signal modes and their power spectrum in the
presence of gappy data and an uncertain foreground model in a computationally
scalable manner. The data are weighted by an inverse covariance matrix that is
estimated as part of the inference, along with a foreground model that can then
be marginalised over. We demonstrate the application of this technique on a
simulated HERA-like delay spectrum analysis, comparing three different
approaches for accounting for the foreground components.
