torchbox.simulator package
Submodules
torchbox.simulator.array module
- torchbox.simulator.array.npwsig(pos, ang, ns=1, ncov=0, scov=1, dim=-1, lambd=1, unit='deg', returns=['sig', 'cov'])
generates the received narrowband plane wave signals at a sensor array
- Parameters:
pos (list, tuple or tensor) – array coordinates (N x 3) or (3 x N)
ns (int, optional) – the number of samples, by default 1
ncov (int, optional) – the noise covariance, by default 0
scov (int, optional) – the signal covariance, by default 1
dim (int, optional) – the dimensional index of coordinate in
posandang, by default -1.lambd (float, optional) – wave length, by default 1.
unit (str, optional) –
'deg'or'rad', by default'deg'returns (list, optional) – values to be returned,
'sig'(signal),'cov'(sample covariance),'covt'(theoretical covariance), by default['sig', 'cov']
- Returns:
array signal
- Return type:
tensor
Examples
import torch as th import torchbox as tb pos = tb.arraypos(th.arange(0, 64, 0.5), dim=0, axes='y') ang = [[-30, 10, 30], [0, 0, 0]] print(pos.shape) X, R = npwsig(pos, ang, ns=4, ncov=0, scov=1, dim=0, lambd=1, unit='deg', returns=['sig', 'cov']) print(X.shape, R.shape) pos = tb.arraypos(th.arange(0, 64, 0.5), dim=-1, axes='y') ang = [[-30, 0], [0, 0], [10, 0]] print(pos.shape) X, R = npwsig(pos, ang, ns=4, ncov=tb.db2pm(-30, 10), scov=1, dim=-1, lambd=1, unit='deg', returns=['sig', 'cov']) X, R = npwsig(pos, ang, ns=4, ncov=0, scov=tb.db2pm(30, 10), dim=-1, lambd=1, unit='deg', returns=['sig', 'cov']) Y = tb.fft(X, dim=-1, shift=True) print(X.shape, R.shape) plt = tb.plot([X.real, X.abs(), Y.abs()], grids=True, titles=['Real part', 'Amplitude', 'FFT of signal']); plt.show()