Skip to content

Commit

Permalink
Allow relbin fiducial parameters to not be floats
Browse files Browse the repository at this point in the history
  • Loading branch information
Collin Capano committed Dec 12, 2024
1 parent 3f53cfa commit ad1242d
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions pycbc/inference/models/relbin.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,23 @@ def extra_args_from_config(cp, section, skip_args=None, dtypes=None):
)

# get fiducial params from config
fid_params = {
p.replace("_ref", ""): float(cp.get("model", p))
for p in cp.options("model")
if p.endswith("_ref")
}
fid_params = {}
for p in cp.options("model"):
if p.endswith("_ref"):
val = cp.get("model", p)
if val == '':
# means had "param =", indicating a boolean that should be
# True
val = True
else:
# try casting to float
try:
val = float(val)
# will get a value error if val is a string; just keep
# as a string in that case
except ValueError:
pass
fid_params[p.replace("_ref", "")] = val

# add optional params with default values if not specified
opt_params = {
Expand Down

0 comments on commit ad1242d

Please sign in to comment.