/  PyMDB  /  Encodings

Encodings

Charset

class yamcs.pymdb.Charset

Bases: Enum

String encoding

US_ASCII = 1

US-ASCII

ISO_8859_1 = 2

ISO-8859-1

WINDOWS_1252 = 3

Windows-1252

UTF_8 = 4

UTF-8

UTF_16 = 5

UTF-16

UTF_16LE = 6

UTF-16LE

UTF_16BE = 7

UTF-16BE

UTF_32 = 8

UTF-32

UTF_32LE = 9

UTF-32LE

UTF_32BE = 10

UTF-16BE

FloatEncodingScheme

class yamcs.pymdb.FloatEncodingScheme

Bases: Enum

Float encoding

IEEE754_1985 = 1

IEEE 754-1985

MILSTD_1750A = 2

MIL-STD-1750A

STRING = 3

String-encoded float

Warning

This scheme is not supported by XTCE, and will lead to invalid XML exports. However, that XML will be correctly understood by Yamcs, which does support string-based float encodings.

An alternative is to use a StringEncoding for a FloatParameter, but then you will not be able to use use calibrators.

IntegerEncodingScheme

class yamcs.pymdb.IntegerEncodingScheme

Bases: Enum

Integer encoding

UNSIGNED = 1

Unsigned

SIGN_MAGNITUDE = 2

Sign-magnitude

TWOS_COMPLEMENT = 3

Two’s complement

ONES_COMPLEMENT = 4

Ones’ complement

STRING = 5

String-encoded integer

Warning

This scheme is not supported by XTCE, and will lead to invalid XML exports. However, that XML will be correctly understood by Yamcs, which does support string-based integer encodings.

An alternative is to use a StringEncoding for an IntegerParameter, but then you will not be able to use use calibrators.

Encoding

class yamcs.pymdb.Encoding

Bases: object

__init__(bits: Optional[int] = None) None

BinaryEncoding

class yamcs.pymdb.BinaryEncoding

Bases: Encoding

__init__(bits: int | None = None, length_bits: int | None = None, encoder: UnnamedAlgorithm | None = None, decoder: UnnamedAlgorithm | None = None) None
decoder: UnnamedAlgorithm | None

Custom decoder, when this encoding is used for telemetry

encoder: UnnamedAlgorithm | None

Custom encoder, when this encoding is used for telecommanding

length_bits: int | None

Length in bits of a leading size tag

IntegerEncoding

class yamcs.pymdb.IntegerEncoding

Bases: Encoding

__init__(bits: int, little_endian: bool = False, scheme: IntegerEncodingScheme = IntegerEncodingScheme.UNSIGNED, string_encoding: Optional[StringEncoding] = None) None
string_encoding: StringEncoding | None

String encoding, required when scheme is set to STRING.

FloatEncoding

class yamcs.pymdb.FloatEncoding

Bases: Encoding

__init__(bits: int, little_endian: bool = False, scheme: FloatEncodingScheme = FloatEncodingScheme.IEEE754_1985, string_encoding: Optional[StringEncoding] = None) None
string_encoding: StringEncoding | None

String encoding, required when scheme is set to STRING.

FloatTimeEncoding

class yamcs.pymdb.FloatTimeEncoding

Bases: FloatEncoding

__init__(bits: int, little_endian: bool = False, scheme: FloatEncodingScheme = FloatEncodingScheme.IEEE754_1985, offset: float = 0, scale: float = 1) None
little_endian: bool
scheme: FloatEncodingScheme
string_encoding: StringEncoding | None

String encoding, required when scheme is set to STRING.

IntegerTimeEncoding

class yamcs.pymdb.IntegerTimeEncoding

Bases: IntegerEncoding

__init__(bits: int, little_endian: bool = False, scheme: IntegerEncodingScheme = IntegerEncodingScheme.UNSIGNED, offset: float = 0, scale: float = 1) None
little_endian: bool
scheme: IntegerEncodingScheme
string_encoding: StringEncoding | None

String encoding, required when scheme is set to STRING.

StringEncoding

class yamcs.pymdb.StringEncoding

Bases: Encoding

__init__(bits: Optional[int] = None, length_bits: Optional[int] = None, max_bits: int | None = 8388608, charset: Charset = Charset.US_ASCII, termination: bytes = b'\x00') None
max_bits: int | None

Maximum number of bits, in case of a dynamically sized string.

This value hints Yamcs about the buffer size that is allocated to read the string, although Yamcs can choose to use a smaller buffer when it can.

Default is 1 MB

Common encodings

The encodings module contains reusable data encodings. These are optional to use as you can create entirely custom data encodings.

Unsigned integers

pymdb.uint1_t unsigned 1-bit integer
pymdb.uint2_t unsigned 2-bit integer
pymdb.uint3_t unsigned 3-bit integer
pymdb.uint4_t unsigned 4-bit integer
pymdb.uint5_t unsigned 5-bit integer
pymdb.uint6_t unsigned 6-bit integer
pymdb.uint7_t unsigned 7-bit integer
pymdb.uint8_t unsigned 8-bit integer
pymdb.uint9_t unsigned 9-bit integer
pymdb.uint10_t unsigned 10-bit integer
pymdb.uint11_t unsigned 11-bit integer
pymdb.uint12_t unsigned 12-bit integer
pymdb.uint13_t unsigned 13-bit integer
pymdb.uint14_t unsigned 14-bit integer
pymdb.uint15_t unsigned 15-bit integer
pymdb.uint16_t unsigned 16-bit integer
pymdb.uint24_t unsigned 24-bit integer
pymdb.uint32_t unsigned 32-bit integer

Signed integers

pymdb.int8_t signed 8-bit integer (big endian)
pymdb.int16_t signed 16-bit integer (big endian)
pymdb.int24_t signed 24-bit integer (big endian)
pymdb.int32_t signed 32-bit integer (big endian)

Boolean integer

pymdb.bool_t Same as uint8_t. 0=False, 1=True

Floats

pymdb.float32_t 32-bit float in IEEE754-1985 encoding (big endian)
pymdb.float64_t 64-bit float in IEEE754-1985 encoding (big endian)

Little endian variants

pymdb.uint16le_t unsigned 16-bit integer (little endian)
pymdb.int16le_t signed 16-bit integer in two's complement notation (little endian)
pymdb.uint32le_t unsigned 32-bit integer (little endian)
pymdb.int32le_t signed 32-bit integer in two's complement notation (little endian)
pymdb.float32le_t 32-bit float in IEEE754-1985 encoding (little endian)
pymdb.float64le_t 64-bit float in IEEE754-1985 encoding (little endian)