From 7a4fd03f8a685ba3258b86114b8c8a139478f07d Mon Sep 17 00:00:00 2001 From: NickSwainston Date: Mon, 26 Feb 2024 20:00:43 +1100 Subject: [PATCH] Fixed small toa issues --- psrdb/tables/toa.py | 22 ++++++++++------------ psrdb/utils/toa.py | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/psrdb/tables/toa.py b/psrdb/tables/toa.py index 1fa4d83..3c35d6a 100644 --- a/psrdb/tables/toa.py +++ b/psrdb/tables/toa.py @@ -324,18 +324,16 @@ def process(self, args): with open(args.toa_path, "r") as f: toa_lines = f.readlines() - for toa_line in toa_lines[1:]: - input_toa_line = toa_line.rstrip("\n") - self.create( - args.pipeline_run_id, - args.ephemeris_id, - args.template_id, - input_toa_line, - args.dm_corrected, - args.minimumNsubs, - args.maximumNsubs, - args.npol, - ) + self.create( + args.pipeline_run_id, + args.ephemeris_id, + args.template_id, + input_toa_line, + args.dm_corrected, + args.minimumNsubs, + args.maximumNsubs, + args.npol, + ) elif args.subcommand == "delete": return self.delete(args.id) elif args.subcommand == "list": diff --git a/psrdb/utils/toa.py b/psrdb/utils/toa.py index d858aeb..9768e56 100644 --- a/psrdb/utils/toa.py +++ b/psrdb/utils/toa.py @@ -40,6 +40,6 @@ def toa_dict_to_line(toa_dict): toa_line = "" toa_line += f"{toa_dict['archive']} {toa_dict['freq_MHz']:.6f} {toa_dict['mjd']}{toa_dict['mjd_err']:>8.3f} {toa_dict['telescope']} " for key, value in toa_dict.items(): - if key not in ["archive", "freq_MHz", "mjd", "mjd_err", "telescope"]: + if key not in ["archive", "freq_MHz", "mjd", "mjd_err", "telescope"] and value is not None: toa_line += f" -{key} {value}" return toa_line \ No newline at end of file