def __init__(self, incard, cat, oneband): self.mycall = weakutil.cfg("wsprmon", "mycall") self.mygrid = weakutil.cfg("wsprmon", "mygrid") self.running = True self.rate = 12000 self.logname = "wspr-log.txt" self.bandname = "wspr-band.txt" self.jtname = "wspr" self.verbose = False self.incard = incard self.oneband = oneband if cat != None: self.cat = weakcat.open(cat) self.cat.sync() self.cat.set_usb_data() else: self.cat = None # for each band, count of received signals last time we # looked at it, to guess most profitable band. self.bandinfo = {} # for each two-minute interval, the band we were listening on. self.minband = {} # has readall() processed each interval? self.mindone = {} self.prefixes = load_prefixes()
def main(): parser = weakargs.stdparse('Decode phase-shift WWVB.') parser.add_argument("-center", metavar='Hz', default=1000.0, type=float) parser.add_argument("-file") args = weakargs.parse_args(parser) if args.cat != None: cat = weakcat.open(args.cat) cat.set_usb_data() cat.setf(0, 59000) if (args.card == None) == (args.file == None): parser.error("one of -card and -file are required") if args.file != None: r = WWVB() r.center = args.center r.gowav(args.file, 0) sys.exit(0) if args.card != None: r = WWVB() r.center = args.center r.opencard(args.card) r.gocard() sys.exit(0) parser.error("one of -card, -file, or -levels is required") sys.exit(1)
def main(): parser = weakargs.stdparse('Decode phase-shift WWVB.') parser.add_argument("-center", metavar='Hz', default=1000.0, type=float) parser.add_argument("-file") args = weakargs.parse_args(parser) if args.cat != None: cat = weakcat.open(args.cat) cat.set_usb_data() cat.setf(0, 59000) if (args.card == None) == (args.file == None): parser.error("one of -card and -file are required") if args.file != None: r = WWVB() r.center = args.center r.gowav(args.file, 0) sys.exit(0) if args.card != None: r = WWVB() r.center = args.center r.opencard(args.card) r.gocard() sys.exit(0) parser.error("one of -card, -file, or -levels is required") sys.exit(1)
def soundsetup(self): if self.outcard != None: # do this early because the Mac sound system gets # upset if threads are already running. # we want 12000, but some cards don't support it. outcard = int(self.outcard) self.snd_rate = weakaudio.pya_output_rate(outcard, 12000) # receive card(s) and cat(s) self.r = [ ] # FT8 instance per sound card self.cats = [ ] # CAT receiver (or transceiver) per sound card self.rth = [ ] # thread that runs the FT8 for ci in range(len(self.card_args)): desc = self.card_args[ci] r = self.recv_class() # ft8.FT8 or jt65.JT65 self.r.append(r) r.opencard(desc) th = threading.Thread(target=lambda r=r: r.gocard()) th.daemon = True th.start() self.rth.append(th) if ci > 0 and self.cat_args[ci][0] == "k3" and self.cat_args[ci][1] == "-": # -catX k3 - # this is for the sub-receiver, and card zero must be the main K3. if self.cat_args[0][0] == "k3": self.cats.append(self.cats[0]) else: sys.stderr.write("-cat k3 - can only be used if it follows -cat k3 /dev/...\n") sys.exit(1) elif self.cat_args[ci] != None: self.cats.append(weakcat.open(self.cat_args[ci])) elif self.oneband != None: self.cats.append(None) else: sys.stderr.write("card but no cat\n") sys.exit(1) # send card if self.outcard != None: # we want 12000, but some cards don't support it. outcard = int(self.outcard) if self.snd_rate == 44100: self.snd_rate = 48000 print("for rigblaster, output rate %d rather than 44100 or 12000" % (self.snd_rate)) elif self.snd_rate != 12000: print("using rate %d rather than 12000" % (self.snd_rate)) self.snd = weakaudio.pya().open(format=pyaudio.paInt16, output_device_index=outcard, channels=1, rate=self.snd_rate, output=True) self.sender = self.send_class() # ft8.FT8Send or jt65.JT65Send
def main(): parser = weakargs.stdparse('Decode APRS.') args = weakargs.parse_args(parser) if args.cat != None: cat = weakcat.open(args.cat) cat.set_fm_data() # cat.sdr.setgain(0) cat.setf(0, 144390000) if args.card == None: parser.error("aprsmon requires -card") ar = aprsrecv.APRSRecv() ar.callback = cb ar.opencard(args.card) ar.gocard() sys.exit(0)
def main(): if False: optimize() sys.exit(0) if False: total = 0 total += onebench("wwvx2.wav", 2017, 41, 20, 55, 18, True) total += onebench("wwvx3.wav", 2017, 41, 21, 17, 60, True) total += onebench("wwvx4.wav", 2017, 41, 22, 25, 92, True) total += onebench("wwvx7.wav", 2017, 43, 21, 18, 50, True) total += onebench("wwvx8.wav", 2017, 43, 22, 15, 72, True) total += onebench("wwvx9.wav", 2017, 43, 23, 33, 51, True) total += onebench("wwvx10.wav", 2017, 44, 9, 19, 54, True) print("%d total" % (total)) sys.exit(0) parser = weakargs.stdparse('Decode WWV.') parser.add_argument("-file") args = weakargs.parse_args(parser) if (args.card == None) == (args.file == None): parser.error("one of -card and -file are required") if args.file != None: r = WWV() r.gofile(args.file, True) sys.exit(0) if args.card != None: if args.cat != None: hz = 15000000 cat = weakcat.open(args.cat) cat.setf(0, hz) print("Frequency set to %.1f MHz" % (hz / 1000000.0)) r = WWV() r.opencard(args.card) r.gocard() sys.exit(0) parser.error("one of -card, -file, or -levels is required") sys.exit(1)
def __init__(self, desc1, desc2, cat, oneband): self.mycall = weakutil.cfg("jt65mon", "mycall") self.mygrid = weakutil.cfg("jt65mon", "mygrid") self.oneband = oneband self.verbose = False self.rate = 11025 self.allname = "jt65-all.txt" self.bandname = "jt65-band.txt" self.jtname = "jt65" self.incards = [] self.incards.append(desc1) if desc2 != None: self.incards.append(desc2) if cat != None: self.cat = weakcat.open(cat) self.cat.sync() self.cat.set_usb_data() else: self.cat = None # for each band, count of received signals last time we # looked at it, to guess most profitable band. self.bandinfo = {} self.prefixes = load_prefixes() if self.mycall != None and self.mygrid != None: # talk to pskreporter. print("reporting to pskreporter as %s at %s" % (self.mycall, self.mygrid)) self.pskr = pskreport.T(self.mycall, self.mygrid, "weakmon 0.2", False) else: print( "not reporting to pskreporter since call/grid not in weak.cfg") self.pskr = None
def __init__(self, desc1, desc2, cat, oneband): self.mycall = weakutil.cfg("jt65mon", "mycall") self.mygrid = weakutil.cfg("jt65mon", "mygrid") self.oneband = oneband self.verbose = False self.rate = 11025 self.allname = "jt65-all.txt" self.bandname = "jt65-band.txt" self.jtname = "jt65" self.incards = [ ] self.incards.append(desc1) if desc2 != None: self.incards.append(desc2) if cat != None: self.cat = weakcat.open(cat) self.cat.sync() self.cat.set_usb_data() else: self.cat = None # for each band, count of received signals last time we # looked at it, to guess most profitable band. self.bandinfo = { } self.prefixes = load_prefixes() if self.mycall != None and self.mygrid != None: # talk to pskreporter. print("reporting to pskreporter as %s at %s" % (self.mycall, self.mygrid)) self.pskr = pskreport.T(self.mycall, self.mygrid, "weakmon 0.2", False) else: print("not reporting to pskreporter since call/grid not in weak.cfg") self.pskr = None