def auto_classify_transmitters(detections):
"""Identify transmitter IDs based on carrier frequency."""
# Split by receiver
detections_by_rx = defaultdict(list)
for detection in detections:
detections_by_rx[detection.rxid].append(detection)
edges = {}
for rxid, rx_detections in detections_by_rx.iteritems():
freqs = np.array([d.carrier_info.bin for d in rx_detections])
rx_edges = detect_transmitter_windows(freqs)
summary = ("Detected {} transmitter(s) at RX {}:"
.format(len(rx_edges) - 1, rxid))
for i in range(len(rx_edges) - 1):
summary += " {}-{}".format(rx_edges[i], rx_edges[i+1] - 1)
print(summary)
edges[rxid] = rx_edges[:-1]
txids = [np.digitize(d.carrier_info.bin, edges[d.rxid]) - 1
for d in detections]
return txids
评论列表
文章目录