Stochastic field
SpiDy.bfield
— Functionbfield(N, Δt, J::AbstractSD, noise::Noise; distro=Normal(0., 1/sqrt(Δt)), interpolation=true)
Generate a stochastic field realisation time series (of length N
and spacing Δt
) based on the given noise model noise
and spectral density J
.
Arguments
N
: The number of time steps.Δt
: The time step size.J::AbstractSD
: The environment spectral density.noise::Noise
: The noise model for the environment.distro=Normal(0., 1/sqrt(Δt))
: (Optional) The distribution of noise samples. Default is a normal distribution with mean 0 and standard deviation1/sqrt(Δt)
.interpolation=true
: (Optional) Specifies whether to use linear interpolation for the stochastic field time series. Default istrue
.
Note: The AbstractSD
type is provided by the SpectralDensities.jl package.
Returns
A time series of the stochastic field values.
bfield(tend, J::AbstractSD, noise::Noise; distro=Normal(0., 1/sqrt(Δt)), interpolation=true, atol=0, rtol=sqrt(eps()), maxiters=Int(1e6))
Generate a stochastic field realisation time series of length tend
given the noise model noise
and spectral density J
. The optional parameters atol
, rtol
control the accuracy of the power spectral density of the generated noise.
Arguments
tend
: The total evolution time.J::AbstractSD
: The environment spectral density.noise::Noise
: The noise model for the environment.atol=0
: (Optional) The absolute tolerance for the spectral density estimation. Default is0
.rtol=sqrt(eps())
: (Optional) The relative tolerance for the spectral density estimation. Default issqrt(eps())
.maxiters=Int(1e6)
: (Optional) The maximum number of iterations for the spectral density estimation. Default is1e6
.interpolation=true
: (Optional) Specifies whether to use linear interpolation for the stochastic field time series. Default istrue
.
Note: The parameters used for generating the stochastic field are estimated using the estimate_bfield_parameters
function. See the documentation for more details.
Returns
A time series of the stochastic field values.
SpiDy.estimate_bfield_parameters
— Functionestimate_bfield_parameters(J::AbstractSD, noise::Noise; atol=0, rtol=sqrt(eps()), maxiters=Int(1e6))
Estimate the minimum time step size Δt
and minimum total evolution time tmin
required to generate a stochastic field realisation time series based on the given noise model noise
and spectral density J
, such that the power spectral density of the generated noise matches the target power spectral density within absolute atol
and relative tolerances rtol
.
Arguments
J::AbstractSD
: The environment spectral density.noise::Noise
: The noise model for the environment.atol=0
: (Optional) The absolute tolerance for the spectral density estimation. Default is0
.rtol=sqrt(eps())
: (Optional) The relative tolerance for the spectral density estimation. Default issqrt(eps())
.maxiters=Int(1e6)
: (Optional) The maximum number of iterations for the spectral density estimation. Default is1e6
.
Returns
The minimum time step size Δt
and minimum total evolution time tmin
.