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 timet
to timet + dt
, with shape(t + dt).shape + vshape + (paths,)
. For sources with memory (true_source
class and subclasses),dz(t)
returns the realized value at timet
of 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 attributespaths
andvshape
, returning arrays broadcastable to shapet_shape + vshape + (paths,)
, wheret_shape
is the shape oft
and/ordt
, complies with thesource
protocol. 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.process
instances, in particular, may be used as stochasticity sources.When calling
dz(t, dt)
,t
and/ordt
can take any shape.Attributes: Methods
__call__
(t[, dt])Realization of stochasticity source values or increments.