comnum.ccsds_randomizer#

comnum.ccsds_randomizer(sequence, n)#

The first bits of a pseudo-randomizer of CCSDS 131.0-B-5, Sec. 10.4: "long", h(x) = x^17 + x^14 + 1 started at 00011100011100011 (period 131 071, Sec. 10.4.2), or "short", h(x) = x^8 + x^7 + x^5 + x^3 + 1 started at all ones (period 255, Sec. 10.4.3).

Parameters:
  • sequence (str) – "long" or "short".

  • n (int) – the number of bits.

Returns:

n bits (uint8).

Return type:

numpy.ndarray

Raises:

ValueError – for another sequence.

Examples

The first 40 bits of the short sequence, FF 48 0E C0 9A (Sec. 10.4.3, NOTE 2):

>>> import comnum, numpy as np
>>> s = comnum.ccsds_randomizer("short", 40)
>>> np.packbits(s).tobytes().hex()
'ff480ec09a'