Sunday, November 28, 2010

WSPR analysis with gnuplot

Just posting this for my own reference really. I find that spreadsheets don't really cope with lots of data to plot so gnuplot is the way to go, but it's a little hard to figure out.

I want to plot Ross VK1UN's reception of my WSPR signal using the data on the site. Here's the output I want (pretty much).

WSPR.png

To get this, I go to the wsprnet.org site, run a report of my transmissions and vk1un's receptions of me. Then I copy the table data from the web browser and paste it into a text file called "wspr.txt", then I run this python script to clean it up ready for gnuplot.


import csv

INFILE = "wspr.txt"
OUTFILE = "data.txt"

infile = csv.reader(open(INFILE, "r"),
delimiter = "\t")
outfile = csv.writer(open(OUTFILE, "w"))
for row in infile:
timestamp = row[0].strip()
call = row[1].strip()
sn = row[3].strip()
receiver = row[7].strip()
#print("'%s': '%s'" % (timestamp, sn))
outrow = (timestamp, sn)
outfile.writerow(outrow)


Then I run the following gnuplot commands to draw the graph above.


set terminal png size 405, 320
set title "40m WSPR VK2TPM - VK1UN"
set output "WSPR.png"
set xlabel "DATE"
set ylabel "S/N"
set xdata time
set timefmt "%Y-%m-%d %H:%M"
set xtics format "%d"
set datafile separator ","
plot "data.txt" using 1:2 title 'S/N' with points


One thing that eludes me is how to get the date xlabel to change once a day. Any tips most welcome.

By the way the plot shows two days on the half wave dipole followed by one day on the half size G5RV. Not much between them. (Well, not enough data to tell).

Here's VK6ZRY's reception reports:

WSPR.png

No comments: