Skip to content

Commit

Permalink
Use DataInterpolations for interpolation (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
bclyons12 authored Sep 29, 2024
1 parent de581a8 commit e7f3572
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "1.4.0"
[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
BandedMatrices = "aae01518-5342-5314-be14-df237901396f"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
FiniteElementHermite = "6ce10167-d368-4c0e-af34-9787cdd175e5"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Expand Down
1 change: 1 addition & 0 deletions src/QED.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module QED

using FiniteElementHermite
using BandedMatrices
import DataInterpolations
import ForwardDiff
import JSON
using ArgParse
Expand Down
4 changes: 2 additions & 2 deletions src/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ function Waveform(value::T) where {T<:Real}
end

# Interpolated waveform
function Waveform(ts::AbstractVector{T}, values::AbstractVector{S}; order=:cubic) where {T<:Real, S<:Real}
function Waveform(ts::AbstractVector{T}, values::AbstractVector{S}) where {T<:Real, S<:Real}
TS = promote_type(T, S)
fitp = IMAS.interp1d(ts, values, order)
fitp = DataInterpolations.CubicSpline(values, ts; extrapolate=true)
return Waveform{TS}(t -> fitp(t))
end

Expand Down

0 comments on commit e7f3572

Please sign in to comment.