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

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

classmethod traj_fpt(M, *args)

Compute the first passage time for each trajectory given as argument

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

Computes the CDF of the first passage time, Prob_{x0,t0}[ au_A<t] by solving the Fokker-Planck equation

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

Computes the moments of the first passage time, <tau_A^n>_{x0,t0}, by solving the Fokker-Planck equation

firstpassagetime_avg(x0, *args, **kwargs)

Compute the mean first passage time by one of the following methods: solving the FP equation, its adjoint, or using the theoretical solution.

x0 is the initial condition (at t0), and ‘args’ contains the list of threshold values for which to compute the first passage time.

The theoretical formula is valid only for an homogeneous process; for the computation, we ‘freeze’ the potential at t=t0.

Classes

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