TelegraphNoise

Documentation for TelegraphNoise.

TelegraphNoise.TelegraphNoiseModule

Random Telegraph Noise (RTN)

RTN is a type of random signal with two states, on or off, up or down, etc. with a mean dwell time $T_D$ which characterizes the amount of time the signal spends in each state before switching.

This module provides an easy framework to generate such signals, as they happen to have well known analytical properties. For example, the autocovariance of the signal (often called the autocorrelation in physics literature) goes as

\[\mathcal{A}(t, t_0; T_D) = \exp\left( -2\,\frac{\vert t - t_0 \vert}{T_D} \right). \]

Therefore, the characteristic autocorrelation time $\tau = T_D/2$. Importantly, the expression above shows that these random signals are stationary meaning that correlations are time-translation invariant. This means a random telgraph signal is well-suited for testing autocorrelations of random signals, for example those generated by Markov Chain Monte Carlo methods.

source
TelegraphNoise.TelegraphType
Telegraph{T}([amplitude = one(T)], dwell_time, signal)

Wrapper that contains the relevant information for a given Telegraph signal.

source
TelegraphNoise.TelegraphMethod
Telegraph{T}([rng = default_rng()], [amplitude = one(T)], dwell_time, signal_length::Int)

Constructor that specifies the length of the signal rather than the signal itself.

source
Base.eltypeMethod
eltype(tele::Telegraph) → Type

Dispatch Base.eltype for the Telegraph object.

Additional information

  • Wrapper around Base.eltype(tele.signal).
source
Base.lengthMethod
length(tele::Telegraph) → Int

Dispatch Base.length for the Telegraph object.

Additional information

  • Wrapper around length(tele.signal).
source
TelegraphNoise.expd_τMethod
expd_τ(tele::Telegraph{T}) → T

Return the expected autocorrelation time from a random telegraph signal.

source
TelegraphNoise.generate_telegraphMethod
generate_telegraph([rng = default_rng()], dwell_time, signal_length; amplitude = one(T) ) → Telegraph

Function that initializes a random Telegraph signal with a specified dwell_time and of a given length signal_length.

source
TelegraphNoise.poisson_randMethod
poisson_rand([rng = default_rng()], ::Type{T}, dwell_time, []) → T

Generate a random number of steps in which to stay in the next state.

Additional information

The probability that an RTN signal will dwell in its current state for a time $t \in (t_0, t_0 + {\rm d} t)$ is given by

\[{\rm Pr}\left( t \in (t_0, t_0 + {\rm d} t) \right) = {\rm e}^{-t/T_D} \cdot \frac{{\rm d}t}{T_D}.\]

One then samples from this probability distribution using the inverse-CDF method and obtains

\[t \approx {\rm floor} \left[ -T_D \ln \left( 1 - u \right) \right],\]

with $u \in (0, 1)$ being a uniform random Float generated by rand(). The approximation is necessary as $t$ represents a discrete time in a time series.

source