libera_utils.packets#

Module for reading packet data

Functions

array_from_packets(packets[, apid])

Create an array from a list of packets.

parse_packets(packet_parser, ...[, apid])

Parse a recarray from a list of packet filepaths, assuming the same parser for all

libera_utils.packets.array_from_packets(packets: list, apid: int = None)#

Create an array from a list of packets. This function assumes that the fields and format for every packet is identical for a given APID.

Parameters:
  • packets (list) – List of lasp_packets.parser.Packet objects.

  • apid (int) – Application Packet ID to create an array from. We can only create an array for a single APID because we need to assume the same fields in every packet. If not specified, every packet must be of the same APID.

Returns:

Record array with one column per field name in the packet type. Values are derived if a derived value exists, otherwise, the values are the raw values.

Return type:

numpy.recarray

libera_utils.packets.parse_packets(packet_parser: PacketParser, packet_data_filepaths: list, apid: int = None)#

Parse a recarray from a list of packet filepaths, assuming the same parser for all

Parameters:
  • packet_parser (space_packet_parser.parser.PacketParser) – Parser, already initialized with the anticipated definition.

  • packet_data_filepaths (list) – List of filepaths to packets files.

  • apid (int) – Filter on APID so we don’t get mismatches in case the parser finds multiple parsable packet definitions in the files. This can happen if the XTCE document contains definitions for multiple packet types and >1 of those packet types is present in the packet data files.

Returns:

Concatenated arrays of packet data.

Return type:

numpy.recarray