komm.BinarySequence
General binary sequence. It may be represented either in bit format, denoted by $b[n]$, with elements in the set $\{ 0, 1 \}$, or in polar format, denoted by $x[n]$, with elements in the set $\{ \pm 1 \}$. The correspondences $0 \mapsto +1$ and $1 \mapsto -1$ from bit format to polar format is assumed.
The constructor expects either the bit sequence or the polar sequence.
Parameters:
-
bit_sequence
(ArrayLike | None
) –The binary sequence in bit format, $b[n] \in \{ 0, 1 \}$.
-
polar_sequence
(ArrayLike | None
) –The binary sequence in polar format, $x[n] \in \{ \pm 1 \}$.
Examples:
>>> seq = komm.BinarySequence(bit_sequence=[0, 1, 1, 0])
>>> seq.bit_sequence
array([0, 1, 1, 0])
>>> seq.polar_sequence
array([ 1, -1, -1, 1])
>>> seq = komm.BinarySequence(polar_sequence=[1, -1, -1, 1])
>>> seq.bit_sequence
array([0, 1, 1, 0])
>>> seq.polar_sequence
array([ 1, -1, -1, 1])
length: int
property
The length (or period) $L$ of the binary sequence.
autocorrelation
Returns the autocorrelation $R[\ell]$ of the binary sequence in polar format. See komm.autocorrelation
for more details.
Parameters:
-
shifts
(ArrayLike | None
) –See the corresponding parameter in
komm.autocorrelation
. -
normalized
(bool
) –See the corresponding parameter in
komm.autocorrelation
.
Returns:
-
NDArray[floating]
–The autocorrelation $R[\ell]$ of the binary sequence.
Examples:
>>> seq = komm.BinarySequence(bit_sequence=[0, 1, 1, 0])
>>> seq.autocorrelation()
array([ 4, -1, -2, 1])
cyclic_autocorrelation
Returns the cyclic autocorrelation $\tilde{R}[\ell]$ of the binary sequence in polar format. See komm.cyclic_autocorrelation
for more details.
Parameters:
-
shifts
(ArrayLike | None
) –See the corresponding parameter in
komm.cyclic_autocorrelation
. -
normalized
(bool
) –See the corresponding parameter in
komm.cyclic_autocorrelation
.
Returns:
-
NDArray[floating]
–The cyclic autocorrelation $\tilde{R}[\ell]$ of the binary sequence.
Examples:
>>> seq = komm.BinarySequence(bit_sequence=[0, 1, 1, 0])
>>> seq.cyclic_autocorrelation()
array([ 4, 0, -4, 0])