예제 #1
0
    def test_ant_index(self):
        # Only testing rpoco8, rpoco16, and snap
        bof = "rpoco8"
        for i in range(8):
            self.assertEqual(pc.get_ant_index(bof, i), i)
            self.assertEqual(pc.get_ant_index(bof, str(i)), i)
            self.assertEqual(pc.get_ant_index(bof, chr(ord("a") + i)), i)
            self.assertEqual(pc.get_ant_index(bof, chr(ord("a") + i) + "1"), i)

        for i in range(32):
            chan = chr(ord("a") + i / 4) + str(1 + i % 4)
            if i % 4:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chan)
            if i >= 8:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, i)
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, str(i))
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chr(ord("a") + i))

        bof = "rpoco16"
        for i in range(16):
            chan = chr(ord("a") + i / 2) + str(1 + i % 2)
            self.assertEqual(pc.get_ant_index(bof, chan), i)

        for i in range(32):
            chan = chr(ord("a") + i / 4) + str(1 + i % 4)
            if i % 4 > 1:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chan)

        bof = "spoco12"
예제 #2
0
    parser.add_argument('-q',
                        '--quiet',
                        action='store_true',
                        help='Suppress messages to stdout.')
    parser.add_argument('-s',
                        '--scale',
                        action='store_true',
                        help=' '.join([
                            'Scale the output by number of spectra',
                            'per integration.'
                        ]))
    args = parser.parse_args()

    # Get the antenna numbers
    model = pc.get_model_uv(args.infiles)
    ant_i = pc.get_ant_index(model, args.ant_i)
    ant_j = pc.get_ant_index(model, args.ant_j)
    ant_i, ant_j = min(ant_i, ant_j), max(ant_i, ant_j)

    # Initialize arrays to store the spectra
    spectra_r, spectra_i = pc.spec_list(args.infiles, ant_i, ant_j,
                                        not args.quiet)

    # Get the frequency bins of the data
    uv = aipy.miriad.UV(args.infiles[0])
    frequency = 1e3 * aipy.cal.get_freqs(uv['sdf'], uv['sfreq'], uv['nchan'])

    # Compute the means
    mean_spec_r = np.mean(spectra_r, axis=0)
    mean_spec_i = np.mean(spectra_i, axis=0)
    if args.scale:
예제 #3
0
                        help='Plot on a log scale.')
    parser.add_argument('-p', '--plot-all',
                        action='store_true',
                        help='Plot real/imag + abs of correlation.')
    parser.add_argument('-q', '--quiet',
                        action='store_true',
                        help='Suppress messages to stdout.')
    parser.add_argument('-s', '--scale',
                        action='store_true',
                        help=' '.join(['Scale the output by number of spectra',
                                       'per integration.']))
    args = parser.parse_args()

    # Get the antenna numbers
    model = pc.get_model_uv(args.infiles)
    ant_i = pc.get_ant_index(model, args.ant_i)
    ant_j = pc.get_ant_index(model, args.ant_j)
    ant_i, ant_j = min(ant_i, ant_j), max(ant_i, ant_j)

    # Initialize arrays to store the spectra
    spectra_r, spectra_i = pc.spec_list(args.infiles, ant_i, ant_j, not args.quiet)

    # Get the frequency bins of the data
    uv = aipy.miriad.UV(args.infiles[0])
    frequency = 1e3 * aipy.cal.get_freqs(uv['sdf'], uv['sfreq'], uv['nchan'])

    # Compute the means
    mean_spec_r = np.mean(spectra_r, axis=0)
    mean_spec_i = np.mean(spectra_i, axis=0)
    if args.scale:
        fft_size = 2*uv['nchan']
예제 #4
0
    def test_ant_index(self):
        # Only testing rpoco8, rpoco16, and snap
        bof = 'rpoco8'
        for i in range(8):
            self.assertEqual(pc.get_ant_index(bof, i), i)
            self.assertEqual(pc.get_ant_index(bof, str(i)), i)
            self.assertEqual(pc.get_ant_index(bof, chr(ord('a')+i)), i)
            self.assertEqual(pc.get_ant_index(bof, chr(ord('a')+i)+'1'), i)

        for i in range(32):
            chan = chr(ord('a')+i/4) + str(1+i%4)
            if i % 4:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chan)
            if i >= 8:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, i)
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, str(i))
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chr(ord('a')+i))

        bof = 'rpoco16'
        for i in range(16):
            chan = chr(ord('a')+i/2) + str(1+i%2)
            self.assertEqual(pc.get_ant_index(bof, chan), i)

        for i in range(32):
            chan = chr(ord('a')+i/4) + str(1+i%4)
            if i % 4 > 1:
                with self.assertRaises(ValueError):
                    pc.get_ant_index(bof, chan)

        bof = 'spoco12'