From e07b624106edaa5e3cd8629e35f635c8632648f1 Mon Sep 17 00:00:00 2001 From: Colm Talbot <colm.talbot@ligo.org> Date: Thu, 13 Dec 2018 12:33:31 +0000 Subject: [PATCH] make prior reading not fail with empty lines --- bilby/core/prior.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bilby/core/prior.py b/bilby/core/prior.py index f783d52eb..108528be0 100644 --- a/bilby/core/prior.py +++ b/bilby/core/prior.py @@ -66,12 +66,17 @@ class PriorDict(OrderedDict): ---------- filename: str Name of the file to be read in + + Notes + ----- + Lines beginning with '#' or empty lines will be ignored. """ - prior = {} + comments = ['#', '\n'] + prior = dict() with open(filename, 'r') as f: for line in f: - if line[0] == '#': + if line[0] in comments: continue elements = line.split('=') key = elements[0].replace(' ', '') -- GitLab