<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stats (self, antnames):
 """XXX may be out of date."""

        nbyant = np.zeros (self.nants, dtype=np.int)
        sum = np.zeros (self.nants, dtype=np.complex)
        sumsq = np.zeros (self.nants)
        q = np.abs (self.normvis - 1)

        for i in range (self.nsamps):
            i1, i2 = self.blidxs[i]
            nbyant[i1] += 1
            nbyant[i2] += 1
            sum[i1] += q[i]
            sum[i2] += q[i]
            sumsq[i1] += q[i]**2
            sumsq[i2] += q[i]**2

        avg = sum / nbyant
        std = np.sqrt (sumsq / nbyant - avg**2)
        navg = 1. / np.median (avg)
        nstd = 1. / np.median (std)

        for i in range (self.nants):
            print ('  %2d %10s %3d %f %f %f %f' %
                   (i, antnames[i], nbyant[i], avg[i], std[i], avg[i] * navg, std[i] * nstd))