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

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

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.

stream_by_apiddict, int to BytesIO

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