init_luts

baseband.vdif.payload.init_luts()[source] [edit on github]

Sets up the look-up tables for levels as a function of input byte.

Returns:
lut1bit, lut2bit, lut4butndarray

Look-up table for decoding bytes to samples of 1, 2, and 4 bits, resp.

Notes

Look-up tables are two-dimensional arrays whose first axis is indexed by byte value (in uint8 form) and whose second axis represents sample temporal order. Table values are decoded sample values. Sec. 10 in the VDIF Specification states that samples are encoded by offset-binary, such that all 0 bits is lowest and all 1 bits is highest. I.e., for 2-bit sampling, the order is 00, 01, 10, 11. These are decoded using decoder_levels.

For example, the 2-bit sample sequence -1, -1, 1, 1 is encoded as 0b10100101 (or 165 in uint8 form). To translate this back to sample values, access lut2bit using the byte as the key:

>>> lut2bit[0b10100101]
array([-1., -1.,  1.,  1.], dtype=float32)