Skip to content

Commit

Permalink
Merge pull request #221 from Wang-weiYu/bugfix_draw_from_gwb_log_unif…
Browse files Browse the repository at this point in the history
…orm_distribution

Bugfix draw_from_gwb_log_uniform_distribution
  • Loading branch information
vhaasteren authored Dec 21, 2023
2 parents 541dd1f + 2b93550 commit 59b81a1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions enterprise_extensions/sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,15 @@ def __init__(self, pta, snames=None, empirical_distr=None, f_stat_file=None, sav
self.ndim = sum(p.size or 1 for p in pta.params)
self.plist = [p.name for p in pta.params]

# parameter dictionary
self.params_dict = {}
for p in self.params:
if p.size:
for ii in range(0, p.size):
self.params_dict.update({p.name + "_{}".format(ii): p})
else:
self.params_dict.update({p.name: p})

# parameter map
self.pmap = {}
ct = 0
Expand Down Expand Up @@ -530,8 +539,8 @@ def draw_from_gwb_log_uniform_distribution(self, x, iter, beta):
# draw parameter from signal model
signal_name = [par for par in self.pnames
if ('gw' in par and 'log10_A' in par)][0]
idx = list(self.pnames).index(signal_name)
param = self.params[idx]

param = self.params_dict[signal_name]

q[self.pmap[str(param)]] = np.random.uniform(param.prior._defaults['pmin'], param.prior._defaults['pmax'])

Expand Down

0 comments on commit 59b81a1

Please sign in to comment.