def resample(self, data, stats=None, mask=None, niter=None):
stats = self._get_statistics(data, mask=mask) if stats is None else stats<EOL>stats = self._stats_ensure_array(stats)<EOL>niter = niter if niter else self.niter<EOL>for itr in range(niter):<EOL><INDENT>self._resample_A(stats)<EOL>self._resample_sigma(stats)<EOL><DEDENT>
Introduce a mask that allows for missing data