Try to find optimal dive sample merge offset

Linus Torvalds torvalds at linux-foundation.org
Sat Nov 10 03:23:13 PST 2012


When we merge dives where the samples have come from different dive
computers, the samples may be offset from each other due to the dive
computers not having decided that the dive starts at quite the same
time.

For example, some dive computers may take a while to wake up when
submerged, or there may be differences in exactly when the dive
computer decides that a dive has started. Different computers tend to
have different depths that they consider the start of a real dive.

So when we merge two dives, look for differences in the sample data,
and search for the sample time offset that minimizes the differences
(logic: minimize the sum-of-square of the depth differences over a
two-minute window at the start of the dive).

This still doesn't really result in perfect merges, since different
computers will give slightly different values anyway, but it improves
the dive merging noticeably. To the point that this seems to have
found a bug in our Uemis data import (it looks like the Uemis importer
does an incorrect saltwater pressure conversion, and the data is
actually in centimeter, not in pressure).

So there is room for improvement, but this is at least a reasonable
approximation and starting point.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

With this, I can import my last dives using three different dive
computers, and modulo the uemis importer bug, it actually looks quite
nice. The whole concept of just interleaving data from different dive
computers is admittedly a bit odd, but if you want just the data from
one of your computers, don't import the other ones..
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 6270 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20121110/f308576b/attachment.obj>


More information about the subsurface mailing list