Skip to content

Commit ccd89d7

Browse files
Fix get_transition_ts (#432)
1 parent c189719 commit ccd89d7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/interpolation_utils.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,18 +392,17 @@ function smooth_arc_length_params_2(u_int, uⱼ, uⱼ₊₁)
392392
end
393393

394394
function get_transition_ts(A::SmoothedConstantInterpolation)
395-
out = similar(A.t, 3 * length(A.t))
395+
out = similar(A.t, 3 * length(A.t) - 2)
396396

397397
for idx in 1:(length(A.t) - 1)
398398
d_lower, d_upper, _, _ = get_parameters(A, idx)
399399
if idx == 1
400400
out[1] = A.t[1]
401-
out[2] = A.t[1]
402-
out[3] = A.t[1] + d_lower
401+
out[2] = A.t[1] + d_lower
403402
else
404-
out[3idx - 2] = A.t[idx] - d_upper
405-
out[3idx - 1] = A.t[idx]
406-
out[3idx] = A.t[idx] + d_lower
403+
out[3idx - 3] = A.t[idx] - d_upper
404+
out[3idx - 2] = A.t[idx]
405+
out[3idx - 1] = A.t[idx] + d_lower
407406
end
408407
end
409408

test/interpolation_tests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ end
627627
A = SmoothedConstantInterpolation(u, t; d_max)
628628
test_cached_index(A)
629629

630+
@test DataInterpolations.get_transition_ts(A) == [
631+
1.2, 1.7, 2.0, 2.5, 3.0, 5.2, 5.7, 6.2, 8.2, 8.7]
630632
@test A(1.9) == u[1]
631633
@test A(3.1) == u[2]
632634
@test A(2.5) (u[1] + u[2]) / 2

0 commit comments

Comments
 (0)