thztools.NoiseModel.noise_sim#

method

NoiseModel.noise_sim(x, *, axis=-1, seed=None)[source]#

Simulate time-domain noise.

Parameters:
xarray_like

Time-domain signal array.

axisint, optional

Signal axis. Default is the last axis in x.

seedint or None, optional

Random number generator seed.

Returns:
noise_simulationndarray

Simulated time-domain noise, in signal units.

Notes

For noise parameters \(\sigma_\alpha\), \(\sigma_\beta\), \(\sigma_\tau\) and signal vector \(\boldsymbol{\mu}\), the \(k\)-th element of the time-domain noise amplitude vector \(\boldsymbol{\sigma}\) is given by [1]

\[\sigma_k = \sqrt{\sigma_\alpha^2 + \sigma_\beta^2\mu_k^2 \ + \sigma_\tau^2(\mathbf{D}\boldsymbol{\mu})_k^2},\]

where \(\mathbf{D}\) is the time-domain derivative operator.

References

[1]

Laleh Mohtashemi, Paul Westlund, Derek G. Sahota, Graham B. Lea, Ian Bushfield, Payam Mousavi, and J. Steven Dodge, “Maximum- likelihood parameter estimation in terahertz time-domain spectroscopy,” Opt. Express 29, 4912-4926 (2021), https://doi.org/10.1364/OE.417724.

Examples

The following example shows a noise sample \(\sigma_\mu(t_k)\epsilon(t_k)\) for noise parameters \(\sigma_\alpha = 10^{-4}\), \(\sigma_\beta = 10^{-2}\), \(\sigma_\tau = 10^{-3}\) and the simulated signal \(\mu(t)\).

>>> import thztools as thz
>>> from matplotlib import pyplot as plt
>>> n, dt = 256, 0.05
>>> t = thz.timebase(n, dt=dt)
>>> mu = thz.wave(n, dt=dt)
>>> alpha, beta, tau = 1e-4, 1e-2, 1e-3
>>> noise_model = thz.NoiseModel(sigma_alpha=alpha, sigma_beta=beta,
... sigma_tau=tau, dt=dt)
>>> noise = noise_model.noise_sim(mu, seed=1234)
>>> _, axs = plt.subplots(2, 1, sharex=True, layout="constrained")
>>> axs[0].plot(t, noise / beta)
>>> axs[0].set_ylabel(r"$\sigma_\mu\epsilon/(\sigma_\beta\mu_0)$")
>>> axs[1].plot(t, mu)
>>> axs[1].set_ylabel(r"$\mu/\mu_0$")
>>> axs[1].set_xlabel("t (ps)")
>>> plt.show()
../_images/thztools-NoiseModel-noise_sim-1.png