Skip to content

Commit 384d957

Browse files
committed
fix: use public api in diffusion_function
1 parent 84fb0f3 commit 384d957

5 files changed

Lines changed: 16 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v3.16
2+
3+
- Support StochasticDiffEq v6.96+, where the diffusion function is no longer reachable via `integrator.g`. The extension now reads it from the `SDEProblem` (`prob.g`), which is a stable SciMLBase accessor that works across both old and new StochasticDiffEq versions.
4+
- Run the multiplicative and non-diagonal noise examples on the `CoupledSDEs` docs page so they actually integrate a trajectory.
5+
16
# v3.15
27

38
- New function `named_variables(ds)` for getting the variable names of an MTK-generated dynamical system.

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "3.15.6"
4+
version = "3.16.0"
55

66
[deps]
77
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"

docs/src/CoupledSDEs.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ function g!(du, u, p, t)
8484
return nothing
8585
end
8686
sde = CoupledSDEs(f!, rand(2)./10; g=g!)
87+
tr = trajectory(sde, 1.0)
88+
plot_trajectory(tr...)
8789
```
8890

8991
#### Non-diagonal noise
@@ -105,6 +107,8 @@ function g!(du, u, p, t)
105107
end
106108
diffeq = (alg = RKMilCommute(), reltol = 1e-3, abstol = 1e-3, dt=0.1)
107109
sde = CoupledSDEs(f!, rand(2)./10; g=g!, noise_prototype = zeros(2, 2), diffeq = diffeq)
110+
tr = trajectory(sde, 1.0)
111+
plot_trajectory(tr...)
108112
```
109113

110114
!!! warning

ext/src/classification.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function diffusion_function(g, IIP, noise_prototype)
5050
end
5151

5252
function diffusion_function(ds::CoupledSDEs{IIP}) where {IIP}
53-
return diffusion_function(ds.integ.g, IIP, referrenced_sciml_prob(ds).noise_rate_prototype)
53+
prob = referrenced_sciml_prob(ds)
54+
return diffusion_function(prob.g, IIP, prob.noise_rate_prototype)
5455
end
5556

5657
"""

test/stochastic.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,10 @@ end
104104
corr = CoupledSDEs(f, zeros(2); covariance = [1 0.3; 0.3 1])
105105
corr_alt = CoupledSDEs(f, zeros(2); g = g, noise_prototype = zeros(2, 2))
106106
@test corr.noise_type == corr_alt.noise_type
107-
@test all(corr.integ.g(zeros(2), (), 0.0) .== corr_alt.integ.g(zeros(2), (), 0.0))
107+
@test all(
108+
DynamicalSystemsBase.referrenced_sciml_prob(corr).g(zeros(2), (), 0.0) .==
109+
DynamicalSystemsBase.referrenced_sciml_prob(corr_alt).g(zeros(2), (), 0.0)
110+
)
108111
end
109112

110113
@testset "ArgumentError" begin

0 commit comments

Comments
 (0)