Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] Timing Statistic



OK, I got a chance to implement and play with the HMM.
It's simple, and works ridiculously well.

As Prof. Murphy taught us, if things appear to be going
smoothly you've obviously overlooked something. So there
may be a mistake here, but unless it is a really huge
mistake these results are gratifying and promising.

As previously discussed, the observable data is rounded
to the nearest integer number of degrees. Call that the
rounded phase, Rφ. That's non-negotiable.

The rounded phase defines a /lane/ one degree wide, i.e.
Rφ plus-or-minus half a degree on either side. The HMM
is allowed to imagine an analog phase φ anywhere within
that lane. The analog phase allows us to interpolate
between observations, to model the real phase of the
disk, not just the observed data. The non-integer part
accumulates: If the integer was off by 0.1 degrees this
time it will likely be off by 0.2 degrees next time, then
0.3 degrees, and so on. The HMM keeps track of this.
The dynamics of the model has two parts; at each step:
a) We update the model's analog phase:
φ += ω(t) Δt
where ω(t) comes from a super-simple straight-line
fit to the velocity data. It's almost a constant,
i.e. almost independent of time. It starts out at
nearly 46 degrees per centisecond and ends at nearly
44 degrees per centisecond.
b) If the new φ is within the lane, we leave it alone,
and merrily go on to the next timestep. Otherwise,
we say it hit the curb. It gets clipped to the largest
or smallest value consistent with the observed Rφ at
this time (t).

The HMM can fit all the observations using only 98 clips.
Essentially it is typical for the HMM to predict a string
of 10 observations *exactly*. It can do that because
the observations are integers. There's analog modular
arithmetic hidden behind the scenes, as described in
step (a) above, but the observable Rφ is an integer.
That is, the HMM may wander about within the lane, but
it stays well within the interior of the lane for many
timesteps in a row.

https://www.av8n.com/physics/img48/spindown-clips.png

The parameters for modeling ω originally came from a
straight-line fit to the integer Rφ data, but then I
fiddled with them by hand a little bit to improve the
fit to the analog φ data. (An industrial-strength HMM
would do this fit automagically, but for present purposes
that's overkill.) Actually, the original fitted unfiddled
parameters would have been just fine. Implementing the
HMM requires only two or three columns in the spreadsheet,
with ridiculously simple formulas:
https://www.av8n.com/physics/spindown.gnumeric
https://www.av8n.com/physics/spindown.xls

The clips are both small and far between. The RMS clip
is less than 0.03 degrees. That's kinda impressive given
that the data we have to work with is quantized -- by the
hardware -- to the nearest degree. Again, the diagram is:

https://www.av8n.com/physics/img48/spindown-clips.png

The clips are somewhat correlated, in the sense that
if a given clip is positive, it is likely that the next
nonzero clip will also be positive. I assume this
represents real physics: The disk at a certain time
is subject to a disturbance -- perhaps an air current --
that causes it to have very slightly more or less
deceleration than the model predicts. Very slightly!

================================

Bottom line: This thread started with the twin hypotheses:
i) Maybe the experimental errors IID (independent and identically
distributed) according to a normal Gaussian distribution, so
they add in quadrature, so they average out over time.
ii) Or maybe not. Maybe we should be skeptical and careful.

Well, hypothesis (i) is deader than a doornail. The original
skepticism was exceedingly well founded. The originally-apparent
noise on the signal was essentially entirely due to roundoff
error. There was essentially nothing random about it.

Vernier's device appears to be well made, mechanically speaking.
The bearings are such that the disk will spin for many minutes
before the rotation decays to zero. The degree-markings on
the encoder disk are evidently precise to a tiny fraction of
a degree, to the point where imperfections in the are essentially
unobservable. (The electronics are horrifying, as discussed
below.)

In situations like this, you might wish for more resolution,
i.e. less roundoff error, in the mechanics. The "obvious"
(but not necessarily wise) upgrade would be for the encoder
to have not 360 steps per cycle but rather more like 4096
steps per cycle.

From reading the manual I get the impression that the encoder
can be configured to report /quarter/ degrees, although this
limits the top speed. That gives 1440 steps per cycle, and
might be worth doing.

The top-speed limitation tells me their system is severely
limited in its data-transfer speed.

Therefore, rather than increasing the number of data points
it would be wiser if they would please *timestamp* the data
events!!!! That way we wouldn't have to interpolate, we
wouldn't have to estimate the non-integer part of the phase
... as discussed in a previous posting.

Timestamping events (as opposed to merely counting events) is
all the rage in the research lab, and has been for decades.
You can easily buy boxes that will timestamp events to the
nearest nanosecond or even better. Or you can build your
own inexpensive board with 8ns resolution:
https://arxiv.org/pdf/1206.3332.pdf

The idea that Vernier doesn't know what the rotor is doing
between one quantized centisecond snapshot and the next is
horrifying.