ait.core.tlm module

AIT Telemetry

The ait.core.tlm module provides telemetry fields and telemetry dictionaries. Dictionaries contain packet, header, data, and field definitions.

class ait.core.tlm.DNToEUConversion(equation, units=None, when=None, terms=None)

Bases: ait.core.json.SlotSerializer, object

__init__(equation, units=None, when=None, terms=None)

x.__init__(…) initializes x; see help(type(x)) for signature

eval(packet)

Returns the result of evaluating this DNToEUConversion in the context of the given Packet.

units
class ait.core.tlm.FieldDefinition(*args, **kwargs)

Bases: ait.core.json.SlotSerializer, object

FieldDefinitions encapsulate all information required to define a single packet field. This includes the field name, byte offset, its format, and an optional bitmask.

Use the get() and set() methods to extract and set a field’s value in the underlying raw packet data.

__init__(*args, **kwargs)

Creates a new FieldDefinition.

decode(bytes, raw=False, index=None)

Decodes the given bytes according to this Field Definition.

If raw is True, no enumeration substitutions will be applied to the data returned.

If index is an integer or slice (and the type of this FieldDefinition is an ArrayType), then only the element(s) at the specified position(s) will be decoded.

encode(value)

Encodes the given value according to this FieldDefinition.

slice(offset=0)

Returns a Python slice object (e.g. for array indexing) indicating the start and stop byte position of this Telemetry field. The start and stop positions may be translated by the optional byte offset.

validate(value, messages=None)

Returns True if the given field value is valid, False otherwise. Validation error messages are appended to an optional messages array.

aliases
bytes

The argument bytes.

desc
dntoeu
enum
expr
mask
name
nbytes

The number of bytes required to represent this packet field.

shift
title

The argument title.

type

The argument type.

units
when
class ait.core.tlm.FieldList(packet, defn, raw)

Bases: _abcoll.Sequence

FieldLists encapsulate a packet field array so that it behaves like a Python list (or more generally a sequence) when accessed.

A FieldList should not be created directly. It’s created internally by the private Packet field accessor _getattr().

__init__(packet, defn, raw)

x.__init__(…) initializes x; see help(type(x)) for signature

class ait.core.tlm.Packet(defn, data=None)

Bases: object

__init__(defn, data=None)

Creates a new Packet based on the given Packet Definition and binary (raw) packet data.

toJSON()
validate(messages=None)

Returns True if the given Packet is valid, False otherwise. Validation error messages are appended to an optional messages array.

nbytes

The size of this packet in bytes.

words

Packet data as a wordarray.

class ait.core.tlm.PacketContext(packet)

Bases: object

A PacketContext provides a simple wrapper around a Packet so that field accesses of the form:

packet.fieldname

may also be specified as:

packet[fieldname]

This latter syntax allows a PacketContext to be used as a symbol table when evaluating PacketExpressions.

__init__(packet)

Creates a new PacketContext for the given Packet.

class ait.core.tlm.PacketDefinition(*args, **kwargs)

Bases: ait.core.json.SlotSerializer, object

__init__(*args, **kwargs)

Creates a new PacketDefinition.

toJSON()
validate(pkt, messages=None)

Returns True if the given Packet is valid, False otherwise. Validation error messages are appended to an optional messages array.

NextUID = 2
ccsds
constants
desc
fieldmap
fields
functions
globals
history
name
nbytes

The number of bytes for this telemetry packet

uid
class ait.core.tlm.PacketExpression(expr)

Bases: object

A Packet Expression is a simple mathematical expression that can be evaluted in the context of a Packet. Names in the formula refer to fields in the packet.

Packet Expressions provide a convenient mechanism to express and perform Digital Number (DN) to Engineering Unit (EU) conversions. They can also be used to specify packet field guard conditions. For example, a packet field may only be interpreted as a particular housekeeping value when a corresponding mux field in the same packet is equal to some contsant value.

__init__(expr)

Creates a new PacketExpression from the given string expression.

eval(packet)

Returns the result of evaluating this PacketExpression in the context of the given Packet.

toJSON()
class ait.core.tlm.PacketFunction(signature, expression, syms)

Bases: object

__init__(signature, expression, syms)

Creates a new PacketFunction from the given string signature and expression.

invoke(*args)

Returns the result of invoking this PacketFunction.

arguments
expression
name
signature
class ait.core.tlm.PacketHistory(defn, names=None)

Bases: object

__init__(defn, names=None)

x.__init__(…) initializes x; see help(type(x)) for signature

add(packet)

Add the given Packet to this PacketHistory.

toJSON()
class ait.core.tlm.RawPacket(packet)

Bases: object

Wraps a packet such that:

packet.raw.fieldname

returns the value of fieldname as a raw value with no enumeration substitutions or DN to EU conversions applied.

__init__(packet)

Creates a new RawPacket based on the given Packet.

class ait.core.tlm.TlmDict(*args, **kwargs)

Bases: dict

Tlm Dictionaries provide a Python dictionary (i.e. hashtable) interface mapping Packet names to Packet Definitions.

__init__(*args, **kwargs)

Creates a new Telemetry Dictionary from the given telemetry dictionary filename or YAML string.

add(defn)

Adds the given Packet Definition to this Telemetry Dictionary.

create(name, data=None)

Creates a new packet with the given definition and raw data.

load(content)

Loads Packet Definitions from the given YAML content into this Telemetry Dictionary. Content may be either a filename containing YAML content or a YAML string.

Load has no effect if this Command Dictionary was already instantiated with a filename or YAML content.

toJSON()
class ait.core.tlm.TlmDictWriter(tlmdict=None)

Bases: object

Writes telemetry dictionary to a file in selected formats

__init__(tlmdict=None)

x.__init__(…) initializes x; see help(type(x)) for signature

writeToCSV(output_path=None)

writeToCSV - write the telemetry dictionary to csv

class ait.core.tlm.wordarray(bytes)

Bases: object

Wordarrays are somewhat analogous to Python bytearrays, but currently much more limited in functionality. They provide a readonly view of a bytearray addressable and iterable as a sequence of 16-bit words. This is convenient for telemetry processing as packets are often more naturally addressable on word, as opposed to byte, boundaries.

__init__(bytes)

Creates a new wordarray from the given bytearray.

The given bytearray should contain an even number of bytes. If odd, the last byte is ignored.

ait.core.tlm.YAMLCtor_FieldDefinition(loader, node)
ait.core.tlm.YAMLCtor_PacketDefinition(loader, node)
ait.core.tlm.YAMLCtor_include(loader, node)
ait.core.tlm.getDefaultDict(reload=False)
ait.core.tlm.getDefaultDictFilename()
ait.core.tlm.getDefaultSchema()
ait.core.tlm.handle_includes(defns)

Recursive handling of includes for any input list of defns. The assumption here is that when an include is handled by the pyyaml reader, it adds them as a list, which is stands apart from the rest of the expected YAML definitions.