def test_region_dr2sf(self): r = region.get("US915") dr2sf = dr2sf = ["SF10BW125", "SF9BW125", "SF8BW125", "SF7BW125", "SF8BW500", None,None,None, "SF12BW500", "SF11BW500","SF10BW500","SF9BW500", "SF8BW500", "SF7BW500"] for dr in range(0,len(dr2sf)): sf = r.dr2sf(dr) self.assertTrue(sf == dr2sf[dr])
def test_region_rx1(self): tx_dr = [0,1,2,3] rx1_dr = [10, 11, 12, 13] rx1_freqs = [ round(923.3 + (i * .6),2) for i in range(0, 8)] r = region.get("US915") for chnl in range(2,63): tx_freq = round(902.3 + (chnl * .2), 1) for dr in tx_dr: rx1 = r.get_rx1_conf(tx_freq, dr) self.assertTrue(rx1[0] == rx1_freqs[chnl % 8]) self.assertTrue(rx1[1] == rx1_dr[dr])
def __init__(self, server_host, server_port, region_name, discard_mtypes=None): self.server_host = server_host self.server_port = server_port self.counter = {SOCK_RX_CNT: 0, PUSH_DATA_CNT: 0, PULL_RESP_CNT: 0} self.rx_handler = None self.region = region.get(region_name) self.discard_mtypes = discard_mtypes self.socket_up = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.socket_down = self.socket_up self.socket_up.bind((self.server_host, self.server_port)) self.pull_dest_addr = None self.push_dest_addr = None
def test_region_rx2(self): expected = (923.3, 8) r = region.get("US915") rx2 = r.get_rx2_conf() self.assertTrue(rx2 == expected)
def test_get_us915region(self): r = region.get("US915") self.assertTrue(r != None)
if not os.path.exists(constants.FILE_RECOVERED): wget.download(constants.URL_RECOVERED, out=constants.FILE_RECOVERED) # load the data from csv files data.confirmed, data.death, data.recovered = data.load( constants.FILE_CONFIRMED, constants.FILE_DEATH, constants.FILE_RECOVERED) if __name__ == "__main__": if args.country: country = args.country plot.countries([str(country)], title=country) elif args.region and args.exclude: region_name = args.region region, excluded = region.get(region_name, region.countries, data.confirmed, exclude=[str(args.exclude)]) if region and excluded: plot.countries(region, title=region_name + " excluding " + args.exclude) elif region: print(args.exclude + " not in " + args.region) print("Plotting data for the whole region.") plot.countries(region, title=region_name) elif args.region: region_name = args.region region, _ = region.get(region_name, region.countries, data.confirmed) if region: plot.countries(region, title=region_name) elif args.update: print("\n\nFresh data downloaded.")