Open dlakaplan opened 2 years ago
OK, I see. The line that failed just happened to have a leading space and a period in character 41, so it was identified as Parkes. The others were correctly done.
Would it make sense to update:
elif fmt == "Parkes":
...
try:
...
except ValueError:
MJD,d = _parse_toa_line(line, format="TEMPO2")
I don't know enough about the formatting specs to know if this would fail in other ways or create other problems.
I was sent a tim file that was apparently valid for TEMPO2, but which PINT could not parse. Entries were like:
so the initial space led PINT to think that these were Parkes format, and then it barfed. Oddly, it managed to get through some of these and only died on the last one (maybe it had too many periods to interpret as a float?). Once I removed the initial space it was all OK.
I don't know how rigid the parsing is in TEMPO2, or if this initial space is expected/should be allowed.
It wasn't a hard fix but the error messages weren't helpful, so we could also consider some fallback parsing (try multiple formats?).