|
| 1 | +#!/usr/bin/env python3 |
| 2 | + |
1 | 3 | import numpy
|
2 |
| -import matplotlib.pyplot as plt |
3 | 4 | from scipy import signal
|
4 | 5 |
|
5 | 6 | from p25_control_demod import p25_control_demod
|
| 7 | +from moto_control_demod import moto_control_demod |
| 8 | +from edacs_control_demod import edacs_control_demod |
6 | 9 | from redis_channelizer_manager import redis_channelizer_manager
|
7 | 10 |
|
8 | 11 |
|
9 | 12 | from config import rc_config
|
10 | 13 |
|
11 |
| -import time, uuid |
| 14 | +import time |
| 15 | +import uuid |
| 16 | +import json |
| 17 | +import logging |
12 | 18 | import argparse
|
13 | 19 |
|
| 20 | + |
| 21 | +with open('config.logging.json', 'rt') as f: |
| 22 | + config = json.load(f) |
| 23 | + |
| 24 | +logging.config.dictConfig(config) |
| 25 | + |
14 | 26 | overseer_uuid = '%s' % str(uuid.uuid4())
|
15 | 27 | site_uuid = '876c1a54-8183-4134-a41c-67a5b6121fcd'
|
16 | 28 |
|
|
23 | 35 |
|
24 | 36 |
|
25 | 37 | rcm = redis_channelizer_manager(index=args.index)
|
26 |
| - |
| 38 | +time.sleep(0.5) |
27 | 39 | with open('/tmp/fft_source_%s' % args.index, 'rb') as fh:
|
28 | 40 | data = numpy.fromfile(fh, numpy.float32)
|
29 | 41 |
|
|
61 | 73 | print('Peak %s' % int(frequency))
|
62 | 74 | demods[frequency] = p25_control_demod({
|
63 | 75 | 'type': 'p25',
|
64 |
| - 'id': 'c4fm', |
| 76 | + 'id': 'p25', |
65 | 77 | 'modulation': 'C4FM',
|
66 | 78 | 'default_control_channel': 0,
|
67 |
| - 'channels': { 0: frequency}, |
| 79 | + 'channels': { 0: frequency, 1:frequency}, |
68 | 80 | }, site_uuid, overseer_uuid, rcm=rcm)
|
69 | 81 | demods[frequency].start()
|
70 | 82 |
|
71 |
| - # plt.axvline(line, alpha=0.5, color='r') |
72 |
| - # plt.text(line, .5, frequency, rotation=90) |
73 |
| - #else: |
74 |
| - # plt.axvline(line, alpha=0.5, color='g') |
75 |
| -time.sleep(10) |
| 83 | +time.sleep(30) |
76 | 84 | offsets = []
|
77 | 85 | for frequency in demods:
|
78 | 86 | thread = demods[frequency]
|
|
92 | 100 | thread.keep_running = False
|
93 | 101 | with open('fft.scan.output', 'a') as f:
|
94 | 102 | f.write('%s %s %s\n' % (frequency, offset, detail))
|
95 |
| - |
96 |
| -print('offset average for %s: %s' % (args.index, sum(offsets)/len(offsets))) |
| 103 | +if len(offsets) > 0: |
| 104 | + print('offset average for %s: %s' % (args.index, sum(offsets)/len(offsets))) |
97 | 105 | #plt.plot(data)
|
98 | 106 | #plt.axhline((data_average*2))
|
99 | 107 | #plt.show()
|
|
0 commit comments