Example #1
0
    ax.set_ylim(top=3, bottom=-3)
    ax.legend(loc=2)
    plt.show()


if __name__ == '__main__':
    # logging infrastructure
    logger = logging.getLogger('main')
    handler = logging.StreamHandler()
    colored_formatter = ColoredFormatter(
        "%(log_color)s%(asctime)s%(levelname)s:%(name)s:%(message)s")
    handler.setFormatter(colored_formatter)
    logger.addHandler(handler)
    logger.setLevel(logging.DEBUG)

    correlator = Correlator(logger=logger.getChild('correlator'))
    correlator.set_shift_schedule(0b00000000000)
    correlator.set_accumulation_len(40000)
    correlator.add_frequency_bin_calibrations('baseline.json')
    time.sleep(1)
    correlator.re_sync()

    siggen = SCPI(host='localhost')

    offsets = {}
    offsets['axis'] = []
    for a, b in correlator.cross_combinations:
        offsets["{a}{b}".format(a=a, b=b)] = []

    for f in correlator.frequency_correlations[(0, 1)].frequency_bins:
        siggen.setFrequency(f)
#!/usr/bin/env python

import numpy as np
import matplotlib.pyplot as plt
from directionFinder_backend.correlator import Correlator
import scipy.signal
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset

if __name__ == '__main__':
    c = Correlator()
    c.fetch_time_domain_snapshot(force=True)

    time_domain_padding = 10
    fs = 800e6
    upsample_factor = 100
    a_idx = 0
    b_idx = 1
    a = np.concatenate(
        (np.zeros(time_domain_padding), c.time_domain_signals[a_idx],
         np.zeros(time_domain_padding)))
    a_time = np.linspace(-(time_domain_padding / fs),
                         (len(a) - time_domain_padding) / fs,
                         len(a),
                         endpoint=False)
    b = c.time_domain_signals[b_idx]
    b_time = np.linspace(0, len(b) / fs, len(b), endpoint=False)
    correlation = np.correlate(a, b, mode='valid')
    correlation_time = np.linspace(a_time[0] - b_time[0],
                                   a_time[-1] - b_time[-1],
                                   len(correlation),