The QSO calculator was something that I knocked up a while back whilst sitting in a less than interesting session at a standards meeting.
Basically it works by compiling a list of stations that a member heard and another list of stations that heard that members and using the python set logic to calculate the intersection of the two sets which is the two way contacts or "QSOs". It does this with the line
set(mrx[mc.index(m)]) & set(mtx[mc.index(m)])
in the code below.
What I realised in looking at the code yesterday is that it does this over the whole month so far and not on a one day window as I had intended and told everyone that it was doing. These are valid if we take the definition to be a two-way exchange within the month but that is nit the definition I was using.
I am not sure if I will have time to fix this, but if someone has an interest in fixing it I will provide a more detailed description of how it works and the scrubbed spots file for them to test the code on.
- Stewart/G3YSX
import sys
from collections import Counter print('CARC WSPR Competition Adjudicator 2022') print('QSO Catagory') print mc = [] # member call mtx = [] # member's tx heard by mrx = [] # member heard this call mq = [] # member qso mcw = [] # member country worked def uniqueappend(list, val): if val not in list: list.append(val) return(True) else: return(False) def freqtoband(freq): f=float(freq) if f>14.0 and f<14.3: return('++10m') #another fixup return('REJECT') # # Main program starts here # if len(sys.argv)==1: print "Usage: CWCA.py wsprSpotsFile <-d>" sys.exit() mf = open('members.txt', 'r') for m in mf: md = m.split(',') mc.append(md[0].rstrip().lstrip().upper()) mtx.append([]) mrx.append([]) mq.append([]) spotsFile = sys.argv[1] print 'Spots file = ', spotsFile print prefix = ["0","1","Q"] rejectedReports = 0 f = open(spotsFile, 'r') #r = open('RejectedFrequency.txt', 'w') for l in f: ls = l.split(',') rx = ls[6] tx = ls[2] band = freqtoband(ls[5]) if band == 'REJECT': continue if rx in mc: mem=mc.index(rx) uniqueappend(mtx[mem],tx) if tx in mc: if not rx.startswith(tuple(prefix)): mem=mc.index(tx) uniqueappend(mrx[mem],rx) sm = [] for m in mc: # print mrx[mc.index(m)] # print mtx[mc.index(m) hb = len(mtx[mc.index(m)]) h = len(mrx[mc.index(m)]) x = set(mrx[mc.index(m)]) & set(mtx[mc.index(m)]) xl = len(x) sm.append([m, hb, h, xl]) sm = sorted(sm,key=lambda x: x[3], reverse=True) print "Posn\tCall\t Hrd by\t Hrd\t QSO" for m in sm: i = sm.index(m) sms = str(sm[i]).split(',') sms[0]=sms[0].replace("'",'').replace('[','') sms[3]=sms[3].replace("'",'').replace(']','') print i+1, '\t', sms[0],'\t',sms[1],'\t', sms[2],'\t',sms[3]
No comments:
Post a Comment