From e37852e55c9ad218d09b784ffb1ebfc6c7b29253 Mon Sep 17 00:00:00 2001 From: Gregory Ashton <gregory.ashton@ligo.org> Date: Mon, 10 Oct 2016 12:09:54 +0200 Subject: [PATCH] Adds ability to specify different priors for each tglitch --- examples/semi_coherent_twoglitch_search.py | 11 +++++++---- pyfstat.py | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/semi_coherent_twoglitch_search.py b/examples/semi_coherent_twoglitch_search.py index 6b0b77a..8514cbf 100644 --- a/examples/semi_coherent_twoglitch_search.py +++ b/examples/semi_coherent_twoglitch_search.py @@ -19,12 +19,15 @@ theta_prior = {'F0': {'type': 'norm', 'loc': F0, 'scale': abs(1e-6*F0)}, 'delta_F0': {'type': 'halfnorm', 'loc': 0, 'scale': 1e-7*F0}, 'delta_F1': 0, - 'tglitch': {'type': 'unif', - 'lower': tstart+0.01*duration, - 'upper': tstart+0.99*duration}, + 'tglitch_0': {'type': 'unif', + 'lower': tstart+0.01*duration, + 'upper': tstart+0.5*duration}, + 'tglitch_1': {'type': 'unif', + 'lower': tstart+0.5*duration, + 'upper': tstart+0.99*duration}, } -nwalkers = 100 +nwalkers = 50 nsteps = [500, 500, 500] mcmc = pyfstat.MCMCGlitchSearch( diff --git a/pyfstat.py b/pyfstat.py index 73417bb..c340cce 100755 --- a/pyfstat.py +++ b/pyfstat.py @@ -1297,6 +1297,10 @@ _ sftfilepath: str glitch_keys = ['delta_F0', 'delta_F1', 'tglitch'] full_glitch_keys = list(np.array( [[gk]*self.nglitch for gk in glitch_keys]).flatten()) + + if 'tglitch_0' in self.theta_prior: + full_glitch_keys[-self.nglitch:] = [ + 'tglitch_{}'.format(i) for i in range(self.nglitch)] full_theta_keys = ['F0', 'F1', 'F2', 'Alpha', 'Delta']+full_glitch_keys full_theta_keys_copy = copy.copy(full_theta_keys) -- GitLab