2.3.1. sdepy.source¶
-
class
sdepy.source(*, paths=1, vshape=(), dtype=None)[source]¶ Base class for stochasticity sources.
Parameters: - paths : int
Number of paths (last dimension) of the source realizations.
- vshape : tuple of int
Shape of source values.
- dtype : data-type
Data type of source values. Defaults to
None.
Returns: - array
Once instantiated as
dz,dz(t, dt)returns a random realization of the stochasticity source increments from timetto timet + dt, with shape(t + dt).shape + vshape + (paths,). For sources with memory (true_sourceclass and subclasses),dz(t)returns the realized value at timetof the source process, according to initial conditions set at instantiation. The definition of source specific parameters, and computation of actual source realizations, are delegated to subclasses. Defaults to an array ofnumpy.nan.
Notes
Any callable object
dz(t, dt), with attributespathsandvshape, returning arrays broadcastable to shapet_shape + vshape + (paths,), wheret_shapeis the shape oftand/ordt, complies with thesourceprotocol. Such object may be passed to any of the process realization classes, to be used as a stochasticity source in integrating or computing the relevant SDE solution.processinstances, in particular, may be used as stochasticity sources.When calling
dz(t, dt),tand/ordtcan take any shape.Attributes: Methods
__call__(t[, dt])Realization of stochasticity source values or increments.