ait.core.bin.ait_mps_seq_convert module

ait.core.bin.ait_mps_seq_convert.convert_sequence(input_file, output_file_path)

Convert a MPS Seq file into absolute and relative time AIT sequences

Args:

input_file: (file object) Input MPS Seq file output_file_path: (string) Output file path excluding file extension.

This path / name will be used to write an Relative Time Sequence (RTS) and Absolute Time Sequence (ATS) version of the sequence.
ait.core.bin.ait_mps_seq_convert.decode_sequence_time(time, prev_time=None)

Decode a MPS Seq time into a datetime object

Decode an absolute or relative time MPS Seq command time string into an absolute time datetime object. If a relative command time is passed a previous time must be supplied from which the absolute time should be calculated.

Args:
time: (string) A MPS Seq command time string to convert into
a datetime object.
prev_time: (datetime) A datetime object from which a relative time
command time will be calculated. Required if time is a relative command time.
Returns:
A datetime object representing the time string
Raises:
TypeError: If prev_time is not supplied or is not a datetime object
and time is a relative command time.

ValueError: If time has a time code other than A or R.

ait.core.bin.ait_mps_seq_convert.extract_seq_header(input_file)

Extract Seq file header setting values

Seq files can start with a header specifying the values for configurable attributes. This extracts those values and returns key=value pairs as a dictionary.

Note, this reads lines from the open input file handle until it encounters a line not starting with a comment indicator ‘;’. Ensure the file handle points to the beginning of the SEQ file.

Args:
input_file: (file handle) The open file handle from which lines should be read.
Returns:
Dictionary containing the key=value pairs from the header