stochrare.firstpassage

First-passage processes

This module defines a class corresponding to the random variable defined as the first-passage time in a given set for a given stochastic process.

class stochrare.firstpassage.FirstPassageProcess(model)

Bases: object

Represents a first-passage time random variable associated to a stochastic process and a given set.

Parameters:
  • model (stochrare.dynamics.DiffusionProcess1D) – The stochastic process to which the first-passage time is associated
  • CAUTION (methods only tested with ConstantDiffusionProcess1D class, not DiffusionProcess1D!) –
firstpassagetime(x0, t0, A, **kwargs)

Computes the first passage time, defined by $ au_A = inf{t>t0 | x(t)>A}$, for one realization.

Parameters:
  • x0 (float) – The initial position
  • t0 (float) – The initial time
  • A (float) – The threshold
Returns:

t – A realization of the first-passage time

Return type:

float

escapetime_sample(x0, t0, A, **kwargs)

Computes realizations of the first passage time, defined by $ au_A = inf{t>t0 | x(t)>A}$, using direct Monte-Carlo simulations. This method can be overwritten by subclasses to call compiled code for better performance.

escapetime_avg(x0, t0, A, **kwargs)

Compute the average escape time for given initial condition (x0,t0) and threshold A

classmethod escapetime_pdf(samples, **kwargs)

Compute the probability distribution function of the first-passage time based on the input samples

classmethod escapetime_pdfplot(*args, **kwargs)

Plot previously computed pdf of first passage time

firstpassagetime_cdf(x0, A, *args, **kwargs)

Computes the CDF of the first passage time, \(Prob_{x0,t0}[ au_A<t]\), or its derivatives, by solving the Fokker-Planck equation.

firstpassagetime_cdf_adjoint(x0, A, *args, **kwargs)

Computes the CDF of the first passage time, \(Prob_{x0,t0}[ au_A<t]\), or its derivatives, by solving the adjoint Fokker-Planck equation.

firstpassagetime_avg_theory(x0, *args, **kwargs)

Compute the mean first-passage time using the theoretical formula:

\(\mathbb{E}[\tau_M] = \frac{1}{D} \int_{x_0}^{M} dx e^{V(x)/D} \int_{-\infty}^x e^{-V(y)/D}dy.\)

This formula is valid for a homogeneous process, conditioned on the initial position \(x_0\).

Parameters:x0 (float) – Initial position
firstpassagetime_avg_theory2(x0, *args, **kwargs)

Compute the mean first-passage time using the theoretical formula:

\(\mathbb{E}[\tau_M] = \frac{1}{D} \int_{x_0}^{M} dx e^{V(x)/D} \int_{-\infty}^x e^{-V(y)/D}dy.\)

This formula is valid for a homogeneous process, conditioned on the initial position \(x_0\).

Parameters:x0 (float) – Initial position

Classes

FirstPassageProcess(model) Represents a first-passage time random variable associated to a stochastic process and a given set.