SciML / DiffEqNoiseProcess.jl

A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
https://docs.sciml.ai/DiffEqNoiseProcess/stable/
Other
63 stars 29 forks source link

reinitializing a `NoiseFunction` with `reinit!` not working #113

Closed rmsrosa closed 2 years ago

rmsrosa commented 2 years ago

Currently, reinit! does not work with NoiseFunction.

julia> Y = NoiseFunction(0.0, (u, p, t) -> sin(t));

julia> reinit!(Y, 1/100)
ERROR: type NoiseFunction has no field t

reinit! assumes there is a field t as the other typical noise processes.

See, e.g. https://github.com/SciML/DiffEqNoiseProcess.jl/blob/6536a7d1b6de3c82a22b17b1e7be281d34d59903/src/noise_interfaces/common.jl#L46

There should be a proper dispatch for the special case of a NoiseFunction.

But reinitializing a NoiseFunction has the added complication that the “original” initial time t0 (given in Y = NoiseFunction(t0, y)) goes to Y.curt and is lost when Y is advanced. The sensible solution is to also add a field t0 to the NoiseFunction struct.