[time-nuts] WWVB PM Time Questions

Scud West scudwest at gmail.com
Fri Jul 31 20:42:54 UTC 2020


The coloring is from matplotlib.  Sometimes I forget what's what. I'm
really not using pandas for much here.  Most of the code in plotting a
minute of data is in making it look fancy.


import numpy as np
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
import matplotlib.mlab as mlab
import pandas as pd

sFile = 'out.txt'  # in current directory, or give full path

df = pd.read_csv(sFile, header=None,
                 names=['sample_time', 'amplitude', 'phase'],
                 sep=' ', index_col=0)

phase_deg = np.rad2deg(df_phase.phase)   # phase_deg is a series


plt.subplots(figsize=(15, 3))
ax = plt.subplot(1,1,1)
plt.title('WWVB Phase    5 - 70 sec')

ax.plot(phase_deg.clip(-120, 120), lw=0.4)

plt.xlim(6, 71)
plt.ylim(-150, 150)

ax.fill_between(phase_deg.index,
                0,
                phase_deg.clip(-120, 120), where=phase_deg>=0,
                color='green', alpha=0.15)

ax.fill_between(phase_deg.index,
                0,
                phase_deg.clip(-120, 120), where=phase_deg<0,
                color='red', alpha=0.15)


ax.xaxis.set_major_locator(tkr.MaxNLocator(8))
ax.xaxis.set_minor_locator(tkr.AutoMinorLocator(n=10))
ax.grid(b=True, which='major', c='g', linestyle='-', linewidth=0.7)
ax.grid(b=True, which='minor', c='g', linestyle='-', linewidth=0.2)

sSave = 'wwvb_phase_5_70.png'
plt.savefig(sSave, bbox_inches='tight', transparent=False, dpi=100)


Rob

On Fri, Jul 31, 2020 at 1:15 PM jimlux <jimlux at earthlink.net> wrote:
>
> On 7/31/20 11:25 AM, Scud West wrote:
> > Back in December 2018 there was a WWVB thread.
> >
> >  From Poul-Henning's post on 2018-12-05 quoting John N8UR:
> >
> > "While everyone's been talking :-) , I recorded some WWVB IQ data for
> > folks to play with.  You can download it from
> >
> > http://febo.com/pages/wwvb/
> >
> > The receiver ran at 48 ksps and was centered on 80 kHz (to allow a 20
> > kHz IF to move away from 0 Hz crud).  The data was taken in early
> > afternoon in Dayton, Ohio.  WWVB was easily visible in an FFT."
> >
> >
> > I ran the python code posted by Poul-Henning with the WWVB IQ data.
> > The resulting file 'out.txt' has columns for sample time, amplitude,
> > and phase.  It was used for the plots below.  There is about 10
> > minutes of data.
> >
> > initial data: n8ur_rx_center=0.08MHz_rate=48ksps_start=2018.12.05.13.57.54.bin
> >   (236 MB)
> > plotted data: out.txt   (2.4 MB, 61,000 datapoints)
> >
> > I hadn't looked at phase data before, and it took a while to make any
> > sense of it.  It's surprising how well the bit per second data came
> > through, compared to amplitude modulation.  Different filtering will
> > likely improve the AM performance, but the phase plot looked good now,
> > so here it is.
> >
> > The first graph shows the +90 degree phase shift (top line) and -90
> > (bottom line).  The SDR clock appears relatively stable at first, but
> > drifts lower in frequency at a fairly steady rate until about 550
> > seconds, when it flattens out again.  Overall a bit over 180 degrees
> > more than expected.  A half cycle at 60 kHz, or about 8.3e-06 drift in
> > 10 minutes.  The unpleasantness at about 470 seconds is reflected in
> > the 10 minute plot during minute 7 (3 lines down from the top).  I
> > removed the 'drift' in a crude manner, and it's a wonder it worked as
> > well as it did.
> >
> > The middle two graphs are the same data at different time scales.  I'm
> > not sure if the short term phase variation has any meaning, or if it's
> > 'just noise' at this level.  The WWVB phase change actually takes
> > place 0.1 seconds after the start of the second, but it fit just right
> > for display as is.  The real minute begins at second 6, and this is
> > adjustment is made in the 10 minute waterfall plot.  The first few
> > seconds of data are at the bottom left corner.
> >
> > Green denotes binary 1, phase shift +90 degrees.
> > Red is binary 0, phase shift -90 degrees.
> >
> > A simplified description of WWVB phase-modulated time code:
> >
> > seconds  0 - 12  fixed sync  0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0
> > seconds 13 - 18  time parity (ECC)
> > seconds 19 - 46  binary minute of century
> > seconds 47 - 58  DST and leap sec
> > second  59       fixed sync  0
> >
> > these seconds are notable here:
> >
> > 43, 44, 45, 46 contain changing binary minutes 3, 2, 1, 0
> > 19  a copy of binary minute 0
> > 29, 39  Reserved, but also a copy of binary minute 0 in this sample.
> >
> >
> > I'm using python, numpy, matplotlib, and Pandas.  It all runs pretty
> > quick on my machine, only a few seconds to load, calculate, and
> > display the graphs.
> >
> > I'm going to try looking directly at John's IQ data to see the effect
> > of the larger dataset on results and calculation time.  It's a big
> > help knowing what the processed IQ should look like.  Thanks for the
> > data and code,
> >
> > Rob
> >
>
>
> Nice looking plots..Did you generate the colored red/green "fill to
> baseline" in matplotlib, or is that out of Pandas?
>
> The stacked plot is also very nice.
>
> Good looking plots really help to understand what's going on.
>
> (and of course, a shout out to Edward Tufte, who I am often inspired by)
>
> _______________________________________________
> time-nuts mailing list -- time-nuts at lists.febo.com
> To unsubscribe, go to http://lists.febo.com/mailman/listinfo/time-nuts_lists.febo.com
> and follow the instructions there.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wwvb_phase_5_70.png
Type: image/png
Size: 68180 bytes
Desc: not available
URL: <http://febo.com/pipermail/time-nuts_lists.febo.com/attachments/20200731/ef27de3a/attachment.png>


More information about the Time-nuts_lists.febo.com mailing list