TelegraphNoise
Documentation for TelegraphNoise.
TelegraphNoise.TelegraphNoise
TelegraphNoise.Telegraph
TelegraphNoise.Telegraph
Base.eltype
Base.length
TelegraphNoise.expd_τ
TelegraphNoise.generate_telegraph
TelegraphNoise.poisson_rand
TelegraphNoise.poisson_rand
TelegraphNoise.TelegraphNoise
— ModuleRandom 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.
TelegraphNoise.Telegraph
— TypeTelegraph{T}([amplitude = one(T)], dwell_time, signal)
Wrapper that contains the relevant information for a given Telegraph
signal.
TelegraphNoise.Telegraph
— MethodTelegraph{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.
Base.eltype
— Methodeltype(tele::Telegraph) → Type
Dispatch Base.eltype
for the Telegraph
object.
Additional information
- Wrapper around
Base.eltype(tele.signal)
.
Base.length
— Methodlength(tele::Telegraph) → Int
Dispatch Base.length
for the Telegraph
object.
Additional information
- Wrapper around
length(tele.signal)
.
TelegraphNoise.expd_τ
— Methodexpd_τ(tele::Telegraph{T}) → T
Return the expected autocorrelation time from a random telegraph signal.
TelegraphNoise.generate_telegraph
— Methodgenerate_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
.
TelegraphNoise.poisson_rand
— Methodpoisson_rand([rng = default_rng()], dwell_time) → Int
Default implementation of the poisson_rand
is to return an Int
for the size of the dwell.
TelegraphNoise.poisson_rand
— Methodpoisson_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.