Skip to content

Commit 7b807e8

Browse files
Use strict SciMLTesting 2.4 QA
Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
1 parent 56c6b7a commit 7b807e8

5 files changed

Lines changed: 42 additions & 9 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ QuadGK = "2.9.1"
4949
RecipesBase = "1.3.4"
5050
Reexport = "1"
5151
SafeTestsets = "0.1"
52-
SciMLTesting = "2.1"
52+
SciMLTesting = "2.4"
5353
SparseConnectivityTracer = "1"
5454
StableRNGs = "1"
5555
StaticArrays = "1.9.8"

src/DataInterpolations.jl

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,46 @@ struct CurvefitCache{
197197
end
198198

199199
"""
200-
Curvefit(u, t, m, p0, alg; extrapolate = false, ub = nothing, lb = nothing)
200+
Curvefit(
201+
u, t, model, p0, alg, box = false, lb = nothing, ub = nothing;
202+
extrapolate = false
203+
) -> CurvefitCache
201204
202-
Construct an interpolation by fitting the model `m(t, p)` to data values `u` at
203-
timepoints `t`, using `p0` as the initial parameter guess and `alg` as the
204-
optimization algorithm.
205+
Fit `model(t, p)` to data values `u` at sample locations `t` with Optim.jl and return the
206+
resulting callable interpolation. The returned interpolation evaluates `model` with the
207+
optimized parameters available as its `pmin` field.
208+
209+
# Arguments
210+
211+
- `u`: observed scalar data values.
212+
- `t`: sample locations corresponding to `u`.
213+
- `model`: callable with signature `model(t, p)`, where `p` is a parameter vector.
214+
- `p0`: initial parameter vector supplied to Optim.jl.
215+
- `alg`: Optim.jl optimization algorithm, such as `LBFGS()`.
216+
- `box::Bool = false`: use boxed optimization when `true`; both bounds must then be given.
217+
- `lb = nothing`: lower parameter bounds used when `box` is `true`.
218+
- `ub = nothing`: upper parameter bounds used when `box` is `true`.
219+
220+
# Keywords
221+
222+
- `extrapolate::Bool = false`: permit evaluation outside the range of `t`. When `false`,
223+
out-of-range evaluation throws `ExtrapolationError`.
224+
225+
# Returns
226+
227+
- `CurvefitCache`: a callable fitted interpolation. Its `pmin` field contains the optimized
228+
parameter vector.
229+
230+
# Examples
231+
232+
```julia
233+
using DataInterpolations, Optim
234+
235+
model(t, p) = p[1] .* t .+ p[2]
236+
A = Curvefit([1.0, 3.0, 5.0], [0.0, 1.0, 2.0], model, [0.0, 0.0], LBFGS())
237+
238+
A(1.5)
239+
```
205240
"""
206241
function Curvefit()
207242
error("CurveFit requires loading Optim and ForwardDiff, e.g. `using Optim, ForwardDiff`")

test/Extensions/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ForwardDiff = "1"
1515
LinearAlgebra = "1.10"
1616
Mooncake = "0.4.175, 0.5"
1717
SafeTestsets = "0.1"
18-
SciMLTesting = "2.1"
18+
SciMLTesting = "2.4"
1919
SparseConnectivityTracer = "1"
2020
Test = "1.10"
2121
Zygote = "0.6.77, 0.7"

test/qa/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
1111
AllocCheck = "0.2"
1212
Aqua = "0.8"
1313
SafeTestsets = "0.0.1, 0.1"
14-
SciMLTesting = "2.1"
14+
SciMLTesting = "2.4"
1515
StaticArrays = "1.9.8"
1616
Test = "1"

test/qa/qa.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ using SciMLTesting, DataInterpolations, Test
22

33
run_qa(
44
DataInterpolations;
5-
explicit_imports = true,
65
ei_kwargs = (;
76
# `@enumx ExtrapolationType ...` generates a submodule with dynamic includes
87
# that ExplicitImports cannot statically analyze; allow it to be unanalyzable
@@ -14,5 +13,4 @@ run_qa(
1413
# declares them public.
1514
all_qualified_accesses_are_public = (; ignore = (:Dual, :derivative, :value)),
1615
),
17-
api_docs_kwargs = (; rendered = true),
1816
)

0 commit comments

Comments
 (0)