Weird interpolation for vectors in different time base
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
kst (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
As I don't have the possibility right now to register an account at KDE Bug Tracking System, I'll try posting here. This is possibly not a bug, but a problem in my expectations - but I thought I'd report it anyway.
I generate some data using the following Perl script:
$step = 0.01;
open my $F1, '>/tmp/dat1.txt';
open my $F2, '>/tmp/dat2.txt';
for ($ix=0;
$it = $ix * $step;
if ($ix%3==0) {
print {$F1} "$it $ix\n";
} else {
print {$F2} "$it\n";
}
}
close $F1;
close $F2;
`dat1.txt` represents some data with few samples, timestamps in column 1, and values in column 2; `dat2.txt` represents some different values in time I'd like to interpolate `dat1.txt` onto. As I had some problems with subtracting other data fitting this format, I originally thought that `kst` interpolates vectors sample by sample, as discussed in this post:
... but actually it seems to be due to this "weird" result of interpolation. In the screenshot in the attachment below, you can see `dat1` with blue line/points; and the interpolation should be in red - I'd expect the interpolation to be the exact same blue line, just defined in different points - but you can see some distance between the lines; and further, the red line has a sort of a step behavior. In any case, I don't see why the red points should deviate from that line at all.
This is the procedure I used to generate the image: since due to
[https:/
... I use Windows version of `kst`under `wine`, first I try to load up both data files:
wine ~/.wine/
... this will only import dat1.txt and plot it (with points); so dat2.txt has to be imported manually, through the GUI:
# Click Create/Vector;
# Name: uncheck Auto, name as "ts2"
# Filename: /tmp/dat2.txt
# Field or column: Column 1
# Read to End + Ok
# Click Data Manager:
# Double-click "Column 1" from dat1.txt, uncheck Auto for name, rename as "ts1"
# Double-click "Column 2" from dat1.txt, uncheck Auto for name, rename as "val1"
# Close Data Manager
# ts1, val1 should be 34 in length; ts2 should be 66 in length
# Click Create/Equation
# Equation: type/choose [val1 (V2)]
# X vector: ts2 (V3)
# Check: Interpolate to highest resolution vector
# From Appearance, choose Lines and Points; make color red
# From Placement - place in existing plot
# Click OK
# Right-click plot - Edit curve - val1 vs ts1
# From Appearance - it's already on points, maybe choose another; add lines; make it blue
# File/Export as image(s)... (png)
Maybe I expect too much of the equation "[val1 (V2)]"/"ts2 (V3)" - but seeing "interpolate" there makes me think it would do a proper interpolation; and seemingly it doesn't. Please forgive (and explain) if it's not a bug :)
Cheers!