From fd36ea1b8b7b6eabf22988bd5e6b6063bc799cab Mon Sep 17 00:00:00 2001 From: Wang-weiYu <429682828@qq.com> Date: Wed, 20 Dec 2023 00:21:10 +0100 Subject: [PATCH 1/4] Fix to bug, add a parameter dictionary in JumpProposal Class --- enterprise_extensions/sampler.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/enterprise_extensions/sampler.py b/enterprise_extensions/sampler.py index 700caece..9fe840b4 100644 --- a/enterprise_extensions/sampler.py +++ b/enterprise_extensions/sampler.py @@ -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] + # wangwei add + 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 @@ -530,8 +539,9 @@ 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] + + # wangwei add + param = self.params_dict[signal_name] q[self.pmap[str(param)]] = np.random.uniform(param.prior._defaults['pmin'], param.prior._defaults['pmax']) From 155aaf9d76a566dc8f77252bac6cfdedc109bc9a Mon Sep 17 00:00:00 2001 From: Wang-weiYu <429682828@qq.com> Date: Wed, 20 Dec 2023 01:55:30 +0100 Subject: [PATCH 2/4] Fix to bug, add a parameter dictionary in JumpProposal class --- enterprise_extensions/sampler.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/enterprise_extensions/sampler.py b/enterprise_extensions/sampler.py index 9fe840b4..f80b4a5a 100644 --- a/enterprise_extensions/sampler.py +++ b/enterprise_extensions/sampler.py @@ -166,7 +166,7 @@ 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] - # wangwei add + # parameter dictionary self.params_dict = {} for p in self.params: if p.size: @@ -540,7 +540,6 @@ def draw_from_gwb_log_uniform_distribution(self, x, iter, beta): signal_name = [par for par in self.pnames if ('gw' in par and 'log10_A' in par)][0] - # wangwei add param = self.params_dict[signal_name] q[self.pmap[str(param)]] = np.random.uniform(param.prior._defaults['pmin'], param.prior._defaults['pmax']) From 2b935506420eeedd405455b4322e7fb53d733ff8 Mon Sep 17 00:00:00 2001 From: Wang-weiYu <429682828@qq.com> Date: Thu, 21 Dec 2023 10:34:29 +0100 Subject: [PATCH 3/4] delete the whitespace --- enterprise_extensions/sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/enterprise_extensions/sampler.py b/enterprise_extensions/sampler.py index f80b4a5a..584ec86a 100644 --- a/enterprise_extensions/sampler.py +++ b/enterprise_extensions/sampler.py @@ -539,7 +539,7 @@ 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] - + param = self.params_dict[signal_name] q[self.pmap[str(param)]] = np.random.uniform(param.prior._defaults['pmin'], param.prior._defaults['pmax']) From 88072a90113461eb64d44e8feb48c4221f246b4b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:11:38 +0000 Subject: [PATCH 4/4] Bump scikit-learn from 0.24 to 1.0.1 Bumps [scikit-learn](https://github.com/scikit-learn/scikit-learn) from 0.24 to 1.0.1. - [Release notes](https://github.com/scikit-learn/scikit-learn/releases) - [Commits](https://github.com/scikit-learn/scikit-learn/compare/0.24.0...1.0.1) --- updated-dependencies: - dependency-name: scikit-learn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1e5167f5..60263cf9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,7 +6,7 @@ scikit-sparse>=0.4.5 pint-pulsar>=0.8.2 libstempo>=2.4.0 enterprise-pulsar>=3.3.0 -scikit-learn==0.24 +scikit-learn==1.0.1 emcee ptmcmcsampler numdifftools