def test_send(): floatlist = ds_accessor.get_data_samples(["AM-DSB-SC"], [30])[0][0] print(floatlist) buf = struct.pack('%sf' % len(floatlist), *floatlist) while True: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(("127.0.0.1", 1337)) print("Sum of payload: %f" % sum(floatlist)) sock.sendall(buf) response = sock.recv(BUFFER_SIZE) sock.close() classification, confidence = struct.unpack("If", response) print("Response %d,%f" % (classification, confidence))
] easy_modulation_targets = [ "OOK", "4ASK", "BPSK", "QPSK", "8PSK", "16QAM", "AM-SSB-SC", "AM-DSB-SC", "FM", "GMSK", "OQPSK" ] all_snr_targets = [ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, -20, -18, -16, -14, -12, -10, -8, -6, -4, -2 ] modulation_targets = subset_modulation_targets snr_targets = [30] dataset = ds_accessor.get_data_samples(modulation_targets, snr_targets) random.shuffle(dataset) set_split_point = int(len(dataset) * 0.75) for i in range(0, set_split_point): train_x.append(dataset[i][0]) train_y.append(dataset[i][2]) for i in range(set_split_point, len(dataset)): test_x.append(dataset[i][0]) test_y.append(dataset[i][2]) # Python optimisation variables learning_rate = 0.001 # Orignally 0.001 for Adam epochs = 100
('OQPSK', 30), ('8ASK', 30), ('BPSK', 30), ('8PSK', 30), ('AM-SSB-SC', 30), ('4ASK', 30), ('16PSK', 30), ('64APSK', 30), ('128QAM', 30), ('128APSK', 30), ('AM-DSB-SC', 30), ('AM-SSB-WC', 30), ('64QAM', 30), ('QPSK', 30), ('256QAM', 30), ('AM-DSB-WC', 30), ('OOK', 30), ('16QAM', 30) ] for target in targets: # Have to make them into lists since that's what the ds_accesor requires dataset = ds_accessor.get_data_samples([target[0]], [target[1]]) IQ = dataset[0][0] print(IQ) blob = struct.pack("2048f", *IQ) with open(target[0] + "_" + str(target[1]) + ".bin", "wb") as file_out: file_out.write(blob)
# Seed our randomizer for reproducability random.seed(1337) # Some info about our data LEN_X = 2048 LEN_Y = 24 # Build our training and test data TRAIN_TEST_RATIO = 0.75 # X% of the dataset will be for training data train_x = [] train_y = [] test_x = [] test_y = [] dataset = ds_accessor.get_data_samples(["32PSK", "32QAM"], [30]) random.shuffle(dataset) set_split_point = int(len(dataset) * 0.75) for i in range(0, set_split_point): train_x.append(dataset[i][0]) train_y.append(dataset[i][2]) for i in range(set_split_point, len(dataset)): test_x.append(dataset[i][0]) test_x.append(dataset[i][2]) # Python optimisation variables learning_rate = 0.5 epochs = 1000