Skip to content
Snippets Groups Projects
Commit 62b4b816 authored by Colm Talbot's avatar Colm Talbot
Browse files

change prior printing to logging

parent 02b1ca4a
No related branches found
No related tags found
No related merge requests found
......@@ -332,9 +332,9 @@ class FromFile(Interped):
xx, yy = np.genfromtxt(self.id).T
Interped.__init__(self, xx=xx, yy=yy, minimum=minimum, maximum=maximum, name=name, latex_label=latex_label)
except IOError:
print("Can't load {}.".format(self.id))
print("Format should be:")
print(r"x\tp(x)")
logging.warning("Can't load {}.".format(self.id))
logging.warning("Format should be:")
logging.warning(r"x\tp(x)")
def fix(prior, value=None):
......@@ -389,8 +389,8 @@ def parse_floats_to_fixed_priors(old_parameters):
for key in parameters:
if type(parameters[key]) is not float and type(parameters[key]) is not int \
and type(parameters[key]) is not Prior:
print("Expected parameter " + str(key) + " to be a float or int but was " + str(type(parameters[key]))
+ " instead. Will not be converted.")
logging.info("Expected parameter " + str(key) + " to be a float or int but was "
+ str(type(parameters[key])) + " instead. Will not be converted.")
continue
elif type(parameters[key]) is Prior:
continue
......@@ -424,10 +424,10 @@ def fill_priors(prior, waveform_generator):
continue
elif isinstance(prior[key], float) or isinstance(prior[key], int):
prior[key] = DeltaFunction(prior[key])
print("{} converted to delta function prior.".format(key))
logging.info("{} converted to delta function prior.".format(key))
else:
print("{} cannot be converted to delta function prior.".format(key))
print("If required the default prior will be used.")
logging.warning("{} cannot be converted to delta function prior.".format(key))
logging.warning("If required the default prior will be used.")
bad_keys.append(key)
missing_keys = set(waveform_generator.parameters) - set(prior.keys())
......@@ -435,8 +435,8 @@ def fill_priors(prior, waveform_generator):
for missing_key in missing_keys:
prior[missing_key] = create_default_prior(missing_key)
if prior[missing_key] is None:
print("No default prior found for unspecified variable {}.".format(missing_key))
print("This variable will NOT be sampled.")
logging.warning("No default prior found for unspecified variable {}.".format(missing_key))
logging.warning("This variable will NOT be sampled.")
bad_keys.append(missing_key)
for key in bad_keys:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment