split_by_apid

ccsdspy.split_by_apid(mixed_file, valid_apids=None)[source]

Split a stream of mixed APIDs into separate streams by APID.

This works with a mix of both fixed length and variable length packets.

Parameters:
mixed_file: str, file-like

Path to file on the local file system, or file-like object

valid_apids: list of int, None

Optional list of valid APIDs. If specified, warning will be issued when an APID is encountered outside this list.

Returns:
stream_by_apiddict, int to BytesIO

Dictionary mapping integer apid number to BytesIO instance with the file pointer at the beginning of the stream.