nanograv / pint_pal

A long-lived repository for NANOGrav Pulsar Timing workflows and analysis.
MIT License
6 stars 17 forks source link

Bug in reflagger.py when searching for missing -pta flags #55

Open NihanPol opened 9 months ago

NihanPol commented 9 months ago

There is a small bug in the reflag_add_value in reflagger, where it only looks at the first entry in the tim file to determine if flags exist. This is not robust to -pta flags missing deeper in the tim file. This exact scenario happens for J0711 in the t2 tim file, for reference.

The fix is fairly straightforward, and involves replacing line 14 with the following, which checks if a NoneType exists anywhere in the list, not just the first entry/line: if None in toa.get_flag_value(flag_name)[0]:

I will try to make a formal PR later, but if someone gets to this before I can, please feel free to fold it in.