Ejemplo n.º 1
0
def run_detector(detector, detection_queue, websocket_det_queue):
    settings = ss.get_settings_object()
    while True:
        detector.parse_options(settings.read())
        inp = detection_queue.dequeue()
        if inp is not None:
            detect = [int(x) for x in detector.detect(inp)]
            ss.send_to_websocket(websocket_det_queue, detect, ss.websocket.ServerProtocolData.DET_DATA)
Ejemplo n.º 2
0
def run_detector(detector, detection_queue, websocket_det_queue):
    settings = ss.get_settings_object()
    while True:
        detector.parse_options(settings.read())
        inp = detection_queue.dequeue()
        if inp is not None:
            detect = [int(x) for x in detector.detect(inp)]
            ss.send_to_websocket(websocket_det_queue, detect,
                                 ss.websocket.ServerProtocolData.DET_DATA)
Ejemplo n.º 3
0
def run_generator(signal_queue, websocket_src_queue, source, sampler, sample_freq, block_size, upscale_factor):
    settings = ss.get_settings_object()
    while True:
        source.parse_options(settings.read())

        orig_signal = source.generate(block_size)
        sampled = sampler.sample(orig_signal)
        signal_queue.queue(sampled)

        offset = int(block_size / upscale_factor)
        data = sc.fft(sc.auto_correlation(orig_signal, maxlag=offset))

        ss.send_to_websocket(websocket_src_queue, data, ss.websocket.ServerProtocolData.SRC_DATA)
Ejemplo n.º 4
0
def run_generator(signal_queue, websocket_src_queue, source, sampler,
                  sample_freq, block_size, upscale_factor):
    settings = ss.get_settings_object()
    while True:
        source.parse_options(settings.read())

        orig_signal = source.generate(block_size)
        sampled = sampler.sample(orig_signal)
        signal_queue.queue(sampled)

        offset = int(block_size / upscale_factor)
        data = sc.fft(sc.auto_correlation(orig_signal, maxlag=offset))

        ss.send_to_websocket(websocket_src_queue, data,
                             ss.websocket.ServerProtocolData.SRC_DATA)
Ejemplo n.º 5
0
def dashboard_get_content():
    gain_slider = SliderElement(key="antenna_gain", title="Antenna gain",
                                width=1, range=(0, 50))
    freq_slider = SliderElement(key="center_freq", title="Center Frequency",
                                value=2.4, width=2, range=(2.38, 2.42), step=0.001)
    bin_slider = SliderElement(key="num_bins", title="Number of Bins", width=1, range=(100, 200))
    win_len_slider = SliderElement(key="window_length", title="Detection windows", width=1, range=(1, 200))
    vis1 = VisualisationElement(key="vis1", title="", default_type="fft", default_datatype="src_data")
    vis2 = VisualisationElement(key="vis2", title="", default_type="fft", default_datatype="rec_data")

    cnt = Content()
    cnt.add(gain_slider, position=(0, 0))
    cnt.add(freq_slider, position=(1, 0))
    cnt.add(bin_slider, position=(2, 0))
    cnt.add(win_len_slider, position=(3, 0))
    cnt.add(vis1, position=(0, 2))
    cnt.add(vis2, position=(1, 2))

    settings = ss.get_settings_object()

    return cnt
Ejemplo n.º 6
0
def dashboard_get_content():
    gain_slider = SliderElement(key="antenna_gain",
                                title="Antenna gain",
                                width=1,
                                range=(0, 50))
    freq_slider = SliderElement(key="center_freq",
                                title="Center Frequency",
                                value=2.4,
                                width=2,
                                range=(2.38, 2.42),
                                step=0.001)
    bin_slider = SliderElement(key="num_bins",
                               title="Number of Bins",
                               width=1,
                               range=(100, 200))
    win_len_slider = SliderElement(key="window_length",
                                   title="Detection windows",
                                   width=1,
                                   range=(1, 200))
    vis1 = VisualisationElement(key="vis1",
                                title="",
                                default_type="fft",
                                default_datatype="src_data")
    vis2 = VisualisationElement(key="vis2",
                                title="",
                                default_type="fft",
                                default_datatype="rec_data")

    cnt = Content()
    cnt.add(gain_slider, position=(0, 0))
    cnt.add(freq_slider, position=(1, 0))
    cnt.add(bin_slider, position=(2, 0))
    cnt.add(win_len_slider, position=(3, 0))
    cnt.add(vis1, position=(0, 2))
    cnt.add(vis2, position=(1, 2))

    settings = ss.get_settings_object()

    return cnt
Ejemplo n.º 7
0
dump_file_path = args.dump
source_type = args.source.lower()
source_snr = args.snr
control_port = args.controlport
data_port = args.dataport

frequencies = [2e6, 4e6, 4.5e6, 3e6]
widths = [1000, 1000, 1000, 1000]
L = 3
a = 3
b = 4
N = 51
upscale_factor = 2000  # Warning: greatly diminishes performance
block_size = N * upscale_factor * L

settings = ss.get_settings_object()
settings.update({
    'Pfa': 0.01,
    'center_freq': 2.4,  # GHz
    'num_bins': 150,
    'window_length': 200,
    'antenna_gain': 10
})

if source_type == "usrp":
    source = sc.source.UsrpN210(addr=ip, samp_freq=sample_freq)
elif source_type == "dump":
    source = sc.source.File(dump_file_path)
elif source_type == "sinusoidal":
    source = sc.source.Sinusoidal(frequencies, sample_freq, SNR=source_snr)
Ejemplo n.º 8
0
dump_file_path = args.dump
source_type = args.source.lower()
source_snr = args.snr
control_port = args.controlport
data_port = args.dataport

frequencies = [2e6, 4e6, 4.5e6, 3e6]
widths = [1000, 1000, 1000, 1000]
L = 3
a = 3
b = 4
N = 51
upscale_factor = 2000  # Warning: greatly diminishes performance
block_size = N * upscale_factor * L

settings = ss.get_settings_object()
settings.update({"Pfa": 0.01, "center_freq": 2.4, "num_bins": 150, "window_length": 200, "antenna_gain": 10})  # GHz

if source_type == "usrp":
    source = sc.source.UsrpN210(addr=ip, samp_freq=sample_freq)
elif source_type == "dump":
    source = sc.source.File(dump_file_path)
elif source_type == "sinusoidal":
    source = sc.source.Sinusoidal(frequencies, sample_freq, SNR=source_snr)


# sampler = sc.sampling.Coprime(a, b)
sampler = sc.sampling.MinimalSparseRuler(N)

reconstructor = sc.reconstruction.Wessel(L, sampler.get_C(), False)
# reconstructor = sc.reconstruction.CrossCorrelation(L, C=sampler.get_C())