- 
sdr.kasami_code(length: int, index: int | tuple[int, int] = 
0, poly: PolyLike | None =None, output: 'binary' ='binary') ndarray[Any, dtype[int64]] - 
sdr.kasami_code(length: int, index: int | tuple[int, int] = 
0, poly: PolyLike | None =None, output: 'field' ='binary') FieldArray - 
sdr.kasami_code(length: int, index: int | tuple[int, int] = 
0, poly: PolyLike | None =None, output: 'bipolar' ='binary') ndarray[Any, dtype[float64]] Generates the Kasami code/sequence of length \(n = 2^m - 1\).
- Parameters:¶
 - length: int¶
 The length \(n = 2^m - 1\) of the Kasami code/sequence. The degree \(m\) must be even.
- index:   int   |   tuple[int,   int]   =   
0¶ The index of the Kasami code.
int: The index \(j\) in \([-1, 2^{m/2} - 1)\) from the Kasami code small set. There are \(2^{m/2}\) codes in the small set.tuple[int, int]: The index \((i, j)\) from the Kasami code large set, with \(i \in [-2, 2^m - 1)\) and \(j \in [-1, 2^{m/2} - 1)\). There are \((2^m + 1) \cdot 2^{m/2}\) codes in the large set.
- poly:   PolyLike   |   None   =   
None¶ The primitive polynomial of degree \(m\) over \(\mathrm{GF}(2)\). The default is
None, which uses the default primitive polynomial of degree \(m\), i.e.galois.primitive_poly(2, m).- output:   'binary'   =   
'binary'¶ - output:   'field'   =   
'binary' - output:   'bipolar'   =   
'binary' The output format of the Kasami code/sequence.
"binary"(default): The Kasami code with binary values of 0 and 1."field": The Kasami code as a Galois field array over \(\mathrm{GF}(2)\)."bipolar": The Kasami sequence with bipolar values of 1 and -1.
- Returns:¶
 The Kasami code/sequence of length \(n = 2^m - 1\).
References¶
Examples¶
Create a Kasami code and sequence of length 15.
In [1]: sdr.kasami_code(15, 1) Out[1]: array([1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0]) In [2]: sdr.kasami_code(15, 1, output="bipolar") Out[2]: array([-1., -1., -1., 1., 1., -1., 1., 1., 1., 1., 1., -1., -1., 1., 1.]) In [3]: sdr.kasami_code(15, 1, output="field") Out[3]: GF([1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0], order=2)Create several Kasami codes of length 63 from the small set.
In [4]: x1 = sdr.kasami_code(63, 0, output="bipolar"); \ ...: x2 = sdr.kasami_code(63, 1, output="bipolar"); \ ...: x3 = sdr.kasami_code(63, 2, output="bipolar"); ...: In [5]: plt.figure(); \ ...: sdr.plot.time_domain(x1 + 3); \ ...: sdr.plot.time_domain(x2 + 0); \ ...: sdr.plot.time_domain(x3 - 3) ...:
Examine the auto-correlation of the Kasami sequences.
In [6]: plt.figure(); \ ...: sdr.plot.correlation(x1, x1, mode="circular"); \ ...: sdr.plot.correlation(x2, x2, mode="circular"); \ ...: sdr.plot.correlation(x3, x3, mode="circular"); \ ...: plt.ylim(0, 63); ...:
Examine the cross-correlation of the Kasami sequences.
In [7]: plt.figure(); \ ...: sdr.plot.correlation(x1, x2, mode="circular"); \ ...: sdr.plot.correlation(x1, x3, mode="circular"); \ ...: sdr.plot.correlation(x2, x3, mode="circular"); \ ...: plt.ylim(0, 63); ...: