pqc.io.timfile

Parse tempo2 timfiles into structured metadata tables.

This module implements a permissive parser for tempo2-style timfiles with INCLUDE recursion. It handles common control lines and converts TOA records into a pandas DataFrame suitable for merging with libstempo timing arrays.

Features:
  • INCLUDE recursion.

  • TIME <seconds> offsets applied to subsequent TOAs.

  • Ignores comment/control lines (C, #, MODE, FORMAT, EFAC, EQUAD, JUMP).

  • Parses TOA schemas that optionally include a leading sat column.

Flag parsing treats negative numeric values (e.g., -padd -0.193655) as values rather than flag names by distinguishing flag-name tokens from numbers.

Output columns include filename, freq, mjd, sat, toaerr_tim, tel, _timfile, _timfile_base, _time_offset_sec, plus any -flag values as additional columns.

See also

pqc.io.libstempo_loader.load_libstempo: Load timing arrays via libstempo. pqc.io.merge.merge_time_and_meta: Merge timfile metadata with timing data.

Module Attributes

SECONDS_PER_DAY

Number of seconds in one day (used for TIME offsets).

COMMENT_TOKENS

Tokens that mark an entire line as a comment.

CONTROL_KEYWORDS

Tempo2 timfile control keywords that are ignored by the parser.

Functions

parse_all_timfiles(all_timfile, *[, ...])

Parse a tempo2 *_all.tim file with INCLUDE recursion.

Classes

TimParseResult(df, dropped_lines, ...)

Hold the result of parsing timfiles.