Skip to content
Snippets Groups Projects
Commit f82b7bde authored by Jan David Mol's avatar Jan David Mol
Browse files

L2SS-192: Added more comments, type annotation

parent 067ecc91
No related branches found
No related tags found
1 merge request!45L2SS-192: Provide interface for raw header fields, add example packet (needs...
......@@ -4,8 +4,13 @@ import numpy
__all__ = ["StatisticsPacket"]
def extract_bits(value, first, last=None):
""" Return bits [first:last] from value. If last is not given, the value of bit 'first' is returned. Bit 0 = LSB. """
def extract_bits(value: bytes, first: int, last:int=None) -> int:
""" Return bits [first:last] from value, and return their integer value. Bit 0 = LSB.
For example, extracting bits 2-3 from b'01100' returns 11 binary = 3 decimal:
extract_bits(b'01100', 2, 3) == 3
If last is not given, just the value of bit 'first' is returned. """
# default last to first
if last is None:
......@@ -161,7 +166,7 @@ class StatisticsPacket(object):
}
@property
def payload_sst(self):
def payload_sst(self) -> numpy.array:
""" The payload of this packet, interpreted as SST data. """
# derive which and how many elements to read from the packet header
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment