ADIFファイルをPSK Reporterからダウンロードして比較する(3)

Station 1:
from: QSO_DATE: 20180517, TIME_ON: 033544
to: QSO_DATE: 20180523, TIME_ON: 212959
5067 lines.

Station 2:
from: QSO_DATE: 20180523, TIME_ON: 104403
to: QSO_DATE: 20180524, TIME_ON: 025314
3504 lines.

First match: QSO_DATE: 20180523, TIME_ON: 113844
Last match: QSO_DATE: 20180523, TIME_ON: 212959
909 matches are found.

2つの局での”TIME_ON”時間の差です。多くの場合、同じDX局は同時にレポートされています。

時間の差は、秒単位です。

SNRの比較です。時間差がゼロの場合(緑)と、600秒以内の場合(赤)です。

file_name1 = 'station1.adif'
file_name2 = 'station2.adif'
 
def parse_adif(fn):
    raw = re.split('<eor>|<eoh>',open(fn).read() )
    raw.pop(0)
    raw.pop()
    logbook =[]
    for record in raw:
        qso = {}
        tags = re.findall('<(.*?):\d+.*?>([^<\t\n\r\f\v]+)',record)
        for tag in tags:
            qso[tag[0]] = tag[1]
        logbook.append(qso)    
    return logbook

def time2sec(time):
    sec = int(time[0:2])*60*60+int(time[2:4])*60+int(time[4:6])
    return sec

l1 = parse_adif(file_name1)
l2 = parse_adif(file_name2)

pattern = r"7."

for qso1 in l1:
    if re.match(pattern, qso1['FREQ']):
        for qso2 in l2:
            if (qso1['CALL'] in qso2.values()):
                if (qso1['QSO_DATE'] == qso2['QSO_DATE']):
                    time1 = time2sec(qso1['TIME_ON'])
                    time2 = time2sec(qso2['TIME_ON'])
                    if (abs(time1 - time2) < 600):
                        print(qso1['APP_PSKREP_SNR'], qso2['APP_PSKREP_SNR'], time1-time2)
% python3 adif_parse.py > data.csv
% R
> data=read.csv("data.csv", header=F, sep="")
> hist(data$V3, col="#00ffff80", breaks=seq(-625,625,50))
> plot(data$V3, col="#0000ff80", xlab="index", ylab="time diff")
> plot(data$V1, data$V2, xlab="My SNR", ylab="His SNR", pch=16, col="#00ff0080", tck=1, xlim=c(-30,20), ylim=c(-30,20))